gsl-ocaml / lib / mlgsl_complex.h

/* gsl-ocaml - OCaml interface to GSL                       */
/* Copyright (©) 2002-2005 - Olivier Andrieu                */
/* Distributed under the terms of the LGPL version 2.1      */

#include <gsl/gsl_complex.h>

#include "wrappers.h"

static inline value 
#ifndef FLOAT_COMPLEX
copy_complex(gsl_complex * c)
#else
copy_complex(gsl_complex_float * c)
#endif /* FLOAT_COMPLEX */
{
  return copy_two_double_arr(GSL_COMPLEX_P_REAL(c), GSL_COMPLEX_P_IMAG(c));
}

#ifndef FLOAT_COMPLEX
#define _DECLARE_COMPLEX(v) gsl_complex z_##v
#else
#define _DECLARE_COMPLEX(v) gsl_complex_float z_##v
#endif /* FLOAT_COMPLEX */
#define _DECLARE_COMPLEX2(v1,v2) _DECLARE_COMPLEX(v1); _DECLARE_COMPLEX(v2)
#define _DECLARE_COMPLEX3(v1,v2,v3) _DECLARE_COMPLEX2(v1,v2); _DECLARE_COMPLEX(v3)

#define _CONVERT_COMPLEX(v) GSL_SET_COMPLEX(&z_##v,Double_field(v, 0), Double_field(v,1))
#define _CONVERT_COMPLEX2(v1,v2) _CONVERT_COMPLEX(v1); _CONVERT_COMPLEX(v2)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.