19#define A_COMPLEX_C(real, imag) {a_float_c(real), a_float_c(imag)}
23#define a_complex_c(x) a_cast_s(a_complex, x)
24#define a_complex_(_, x) a_cast_s(a_complex _, x)
35#if defined(__cplusplus)
38#if defined(LIBA_COMPLEX_C)
40#define A_INTERN A_INLINE
124#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
127A_EXTERN
void a_complex_proj_(
a_complex *ctx);
128#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
141#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
144#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
151#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
152A_EXTERN
void a_complex_conj_(
a_complex *ctx);
154#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
155A_INTERN
void a_complex_conj_(
a_complex *ctx)
166#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
169#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
176#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
177A_EXTERN
void a_complex_neg_(
a_complex *ctx);
179#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
180A_INTERN
void a_complex_neg_(
a_complex *ctx)
182 ctx->real = -ctx->real;
193#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
196#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
199 ctx->real = x.real + y.real;
203#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
206#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
213#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
216#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
219 ctx->real = x.real + y;
223#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
226#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
232#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
235#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
242#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
245#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
258#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
261#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
264 ctx->real = x.real - y.real;
268#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
271#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
278#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
281#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
284 ctx->real = x.real - y;
288#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
291#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
297#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
300#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
307#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
310#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
323#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
327#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
330 a_complex_mul_(&x, y);
334#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
337#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
340 ctx->real = x.real * y;
344#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
347#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
354#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
357#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
360 ctx->real = -x.
imag * y;
361 ctx->
imag = x.real * y;
364#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
367#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
370 a_float const real = ctx->real;
371 ctx->real = -ctx->
imag * x;
372 ctx->
imag = real * x;
382#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
386#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
389 a_complex_div_(&x, y);
393#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
396#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
399 ctx->real = x.real / y;
403#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
406#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
413#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
416#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
419 ctx->real = -x.
imag / y;
420 ctx->
imag = x.real / y;
423#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
426#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
429 a_float const real = ctx->real;
430 ctx->real = -ctx->
imag / x;
431 ctx->
imag = real / x;
440#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
443A_EXTERN
void a_complex_inv_(
a_complex *ctx);
444#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
459#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
462A_EXTERN
void a_complex_sqrt_(
a_complex *ctx);
464#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
478#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
482#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
485 a_complex_pow_(&z, a);
496#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
500#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
503 a_complex_pow_real_(&z, a);
513#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
516A_EXTERN
void a_complex_exp_(
a_complex *ctx);
517#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
530#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
533A_EXTERN
void a_complex_log_(
a_complex *ctx);
534#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
547#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
550A_EXTERN
void a_complex_log2_(
a_complex *ctx);
551#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
564#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
567A_EXTERN
void a_complex_log10_(
a_complex *ctx);
568#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
571 a_complex_log10_(&z);
582#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
586#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
589 a_complex_logb_(&z, b);
601#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
604A_EXTERN
void a_complex_sin_(
a_complex *ctx);
605#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
618#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
621A_EXTERN
void a_complex_cos_(
a_complex *ctx);
622#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
635#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
638A_EXTERN
void a_complex_tan_(
a_complex *ctx);
639#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
652#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
655A_EXTERN
void a_complex_sec_(
a_complex *ctx);
656#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
669#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
672A_EXTERN
void a_complex_csc_(
a_complex *ctx);
673#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
686#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
689A_EXTERN
void a_complex_cot_(
a_complex *ctx);
690#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
705#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
708A_EXTERN
void a_complex_asin_(
a_complex *ctx);
710#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
723#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
726A_EXTERN
void a_complex_acos_(
a_complex *ctx);
728#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
741#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
744A_EXTERN
void a_complex_atan_(
a_complex *ctx);
745#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
758#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
761A_EXTERN
void a_complex_asec_(
a_complex *ctx);
763#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
776#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
779A_EXTERN
void a_complex_acsc_(
a_complex *ctx);
781#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
794#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
797A_EXTERN
void a_complex_acot_(
a_complex *ctx);
798#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
813#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
816A_EXTERN
void a_complex_sinh_(
a_complex *ctx);
817#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
830#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
833A_EXTERN
void a_complex_cosh_(
a_complex *ctx);
834#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
847#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
850A_EXTERN
void a_complex_tanh_(
a_complex *ctx);
851#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
864#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
867A_EXTERN
void a_complex_sech_(
a_complex *ctx);
868#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
881#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
884A_EXTERN
void a_complex_csch_(
a_complex *ctx);
885#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
898#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
901A_EXTERN
void a_complex_coth_(
a_complex *ctx);
902#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
917#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
920A_EXTERN
void a_complex_asinh_(
a_complex *ctx);
921#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
924 a_complex_asinh_(&z);
934#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
937A_EXTERN
void a_complex_acosh_(
a_complex *ctx);
939#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
942 a_complex_acosh_(&z);
952#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
955A_EXTERN
void a_complex_atanh_(
a_complex *ctx);
957#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
960 a_complex_atanh_(&z);
970#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
973A_EXTERN
void a_complex_asech_(
a_complex *ctx);
974#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
977 a_complex_asech_(&z);
987#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
990A_EXTERN
void a_complex_acsch_(
a_complex *ctx);
991#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
994 a_complex_acsch_(&z);
1004#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
1007A_EXTERN
void a_complex_acoth_(
a_complex *ctx);
1008#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
1011 a_complex_acoth_(&z);
1016#if defined(LIBA_COMPLEX_C)
1018#define A_INTERN static A_INLINE
1020#if defined(__cplusplus)
void a_complex_asin(a_complex *ctx, a_complex z)
computes the complex arc sine
void a_complex_coth(a_complex *ctx, a_complex z)
computes the complex hyperbolic cotangent
void a_complex_conj(a_complex *ctx, a_complex z)
computes the complex conjugate
void a_complex_asech(a_complex *ctx, a_complex z)
computes the complex arc hyperbolic secant
a_float a_complex_arg(a_complex z)
computes the phase angle of a complex number
void a_complex_sub(a_complex *ctx, a_complex x, a_complex y)
subtraction of complex numbers
void a_complex_csch(a_complex *ctx, a_complex z)
computes the complex hyperbolic cosecant
static void a_complex_rect(a_complex *ctx, a_float real, a_float imag)
constructs a complex number from real and imaginary parts
Definition complex.h:49
void a_complex_sec(a_complex *ctx, a_complex z)
computes the complex secant
void a_complex_pow(a_complex *ctx, a_complex z, a_complex a)
complex number z raised to complex power a
a_float a_complex_abs(a_complex z)
computes the magnitude of a complex number
a_bool a_complex_eq(a_complex x, a_complex y)
complex number x is equal to complex number y
void a_complex_csc(a_complex *ctx, a_complex z)
computes the complex cosecant
void a_complex_atan(a_complex *ctx, a_complex z)
computes the complex arc tangent
a_bool a_complex_ne(a_complex x, a_complex y)
complex number x is not equal to complex number y
void a_complex_inv(a_complex *ctx, a_complex z)
inverse of a complex number
void a_complex_asinh(a_complex *ctx, a_complex z)
computes the complex arc hyperbolic sine
void a_complex_acot(a_complex *ctx, a_complex z)
computes the complex arc cotangent
void a_complex_pow_real(a_complex *ctx, a_complex z, a_float a)
complex number z raised to real power a
void a_complex_acsc(a_complex *ctx, a_complex z)
computes the complex arc cosecant
void a_complex_acos(a_complex *ctx, a_complex z)
computes the complex arc cosine
a_float a_complex_logabs(a_complex z)
computes the natural logarithm of magnitude of a complex number
void a_complex_tan(a_complex *ctx, a_complex z)
computes the complex tangent
a_float a_complex_abs2(a_complex z)
computes the squared magnitude of a complex number
void a_complex_cos(a_complex *ctx, a_complex z)
computes the complex cosine
void a_complex_div(a_complex *ctx, a_complex x, a_complex y)
division of complex numbers
void a_complex_sinh(a_complex *ctx, a_complex z)
computes the complex hyperbolic sine
void a_complex_acsch(a_complex *ctx, a_complex z)
computes the complex arc hyperbolic cosecant
void a_complex_sech(a_complex *ctx, a_complex z)
computes the complex hyperbolic secant
void a_complex_tanh(a_complex *ctx, a_complex z)
computes the complex hyperbolic tangent
void a_complex_asec(a_complex *ctx, a_complex z)
computes the complex arc secant
void a_complex_acoth(a_complex *ctx, a_complex z)
computes the complex arc hyperbolic cotangent
void a_complex_log(a_complex *ctx, a_complex z)
computes the complex natural logarithm
void a_complex_sin(a_complex *ctx, a_complex z)
computes the complex sine
void a_complex_logb(a_complex *ctx, a_complex z, a_complex b)
computes the complex base-b logarithm
void a_complex_neg(a_complex *ctx, a_complex z)
computes the complex negative
void a_complex_sqrt(a_complex *ctx, a_complex z)
computes the complex square root
void a_complex_mul(a_complex *ctx, a_complex x, a_complex y)
multiplication of complex numbers
void a_complex_polar(a_complex *ctx, a_float rho, a_float theta)
constructs a complex number from polar form
void a_complex_acosh(a_complex *ctx, a_complex z)
computes the complex arc hyperbolic cosine
unsigned int a_complex_parse(a_complex *ctx, char const *str)
parse a string into a complex number
void a_complex_cot(a_complex *ctx, a_complex z)
computes the complex cotangent
void a_complex_add(a_complex *ctx, a_complex x, a_complex y)
addition of complex numbers
void a_complex_atanh(a_complex *ctx, a_complex z)
computes the complex arc hyperbolic tangent
void a_complex_log2(a_complex *ctx, a_complex z)
computes the complex base-2 logarithm
void a_complex_cosh(a_complex *ctx, a_complex z)
computes the complex hyperbolic cosine
void a_complex_exp(a_complex *ctx, a_complex z)
computes the complex base-e exponential
void a_complex_log10(a_complex *ctx, a_complex z)
computes the complex base-10 logarithm
void a_complex_proj(a_complex *ctx, a_complex z)
computes the projection on Riemann sphere
double a_float
compiler built-in floating-point number type
Definition a.h:1003
bool a_bool
type, capable of holding one of the two values: 1 and 0
Definition a.h:320
instance structure for complex number
Definition complex.h:30
a_float imag
Definition complex.h:32