Learning by doing: Reading books and trying to understand the (code) examples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.2 KiB

  1. #include <complex.h>
  2. #include <gsl/gsl_vector.h>
  3. gsl_vector_complex *cvec_dot_gslcplx(gsl_vector_complex *v, gsl_complex x);
  4. gsl_vector_complex *vec_dot_gslcplx(gsl_vector *v, gsl_complex x);
  5. gsl_vector_complex *cvec_dot_c(gsl_vector_complex *v, complex double x);
  6. gsl_vector_complex *vec_dot_c(gsl_vector *v, complex double x);
  7. void gsl_vector_complex_print(gsl_vector_complex *v);
  8. #define gsl_cplx_from_c99(x) (gsl_complex){.dat = {creal(x), cimag(x)}}
  9. complex double ddot(complex double x, complex double y);
  10. #define dot(x, y) _Generic((x), \
  11. gsl_vector* : dot_given_vec(y), \
  12. gsl_vector_complex* : dot_given_cplx_vec(y), \
  13. default : ddot) \
  14. ((x), (y))
  15. #define dot_given_vec(y) _Generic ((y), \
  16. gsl_complex : vec_dot_gslcplx, \
  17. default : vec_dot_c)
  18. #define dot_given_cplx_vec(y) _Generic((y), \
  19. gsl_complex : cvec_dot_gslcplx, \
  20. default : cvec_dot_c)