liba 0.1.15
An algorithm library based on C/C++
Loading...
Searching...
No Matches
complex.h
Go to the documentation of this file.
1
6#ifndef LIBA_COMPLEX_H
7#define LIBA_COMPLEX_H
8
9#include "a.h"
10
17// clang-format off
19#define A_COMPLEX_PRI(RF, RC, IF, IC) "(" A_FLOAT_PRI(RF, RC) "," A_FLOAT_PRI(IF, IC) ")"
21#if !defined __cplusplus
22#define A_COMPLEX_C(R, I) (a_complex){A_FLOAT_C(R), A_FLOAT_C(I)}
23#else /* !__cplusplus */
24#define A_COMPLEX_C(R, I) {A_FLOAT_C(R), A_FLOAT_C(I)}
25#endif /* __cplusplus */
27#if !defined __cplusplus
28#define a_complex_c(r, i) (a_complex){a_float_c(r), a_float_c(i)}
29#else /* !__cplusplus */
30#define a_complex_c(r, i) {a_float_c(r), a_float_c(i)}
31#endif /* __cplusplus */
32// clang-format on
33
42
43#if defined(__cplusplus)
44extern "C" {
45#endif /* __cplusplus */
46#if defined(LIBA_COMPLEX_C)
47#undef A_INTERN
48#define A_INTERN A_INLINE
49#endif /* LIBA_COMPLEX_C */
50
57static A_INLINE void a_complex_rect(a_complex *ctx, a_float real, a_float imag)
58{
59 ctx->real = real;
60 ctx->imag = imag;
61}
62
69A_EXTERN void a_complex_polar(a_complex *ctx, a_float rho, a_float theta);
70
77A_EXTERN unsigned int a_complex_parse(a_complex *ctx, char const *str);
78
86
94
95/* Properties of complex numbers */
96
103
110
117
124
125/* Complex arithmetic operators */
126
132#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
133A_EXTERN void a_complex_proj(a_complex *ctx, a_complex z);
134#endif /* A_HAVE_INLINE */
135A_EXTERN void a_complex_proj_(a_complex *ctx);
136#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
137A_INTERN void a_complex_proj(a_complex *ctx, a_complex z)
138{
139 a_complex_proj_(&z);
140 *ctx = z;
141}
142#endif /* A_HAVE_INLINE */
143
149#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
150A_EXTERN void a_complex_conj(a_complex *ctx, a_complex z);
151#endif /* A_HAVE_INLINE */
152#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
153A_INTERN void a_complex_conj(a_complex *ctx, a_complex z)
154{
155 ctx->real = +z.real;
156 ctx->imag = -z.imag;
157}
158#endif /* A_HAVE_INLINE */
159#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
160A_EXTERN void a_complex_conj_(a_complex *ctx);
161#endif /* A_HAVE_INLINE */
162#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
163A_INTERN void a_complex_conj_(a_complex *ctx)
164{
165 ctx->imag = -ctx->imag;
166}
167#endif /* A_HAVE_INLINE */
168
174#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
175A_EXTERN void a_complex_neg(a_complex *ctx, a_complex z);
176#endif /* A_HAVE_INLINE */
177#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
178A_INTERN void a_complex_neg(a_complex *ctx, a_complex z)
179{
180 ctx->real = -z.real;
181 ctx->imag = -z.imag;
182}
183#endif /* A_HAVE_INLINE */
184#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
185A_EXTERN void a_complex_neg_(a_complex *ctx);
186#endif /* A_HAVE_INLINE */
187#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
188A_INTERN void a_complex_neg_(a_complex *ctx)
189{
190 ctx->real = -ctx->real;
191 ctx->imag = -ctx->imag;
192}
193#endif /* A_HAVE_INLINE */
194
201#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
202A_EXTERN void a_complex_add(a_complex *ctx, a_complex x, a_complex y);
203#endif /* A_HAVE_INLINE */
204#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
205A_INTERN void a_complex_add(a_complex *ctx, a_complex x, a_complex y)
206{
207 ctx->real = x.real + y.real;
208 ctx->imag = x.imag + y.imag;
209}
210#endif /* A_HAVE_INLINE */
211#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
212A_EXTERN void a_complex_add_(a_complex *ctx, a_complex z);
213#endif /* A_HAVE_INLINE */
214#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
215A_INTERN void a_complex_add_(a_complex *ctx, a_complex z)
216{
217 ctx->real += z.real;
218 ctx->imag += z.imag;
219}
220#endif /* A_HAVE_INLINE */
221#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
222A_EXTERN void a_complex_add_real(a_complex *ctx, a_complex x, a_float y);
223#endif /* A_HAVE_INLINE */
224#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
225A_INTERN void a_complex_add_real(a_complex *ctx, a_complex x, a_float y)
226{
227 ctx->real = x.real + y;
228 ctx->imag = x.imag;
229}
230#endif /* A_HAVE_INLINE */
231#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
232A_EXTERN void a_complex_add_real_(a_complex *ctx, a_float x);
233#endif /* A_HAVE_INLINE */
234#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
235A_INTERN void a_complex_add_real_(a_complex *ctx, a_float x)
236{
237 ctx->real += x;
238}
239#endif /* A_HAVE_INLINE */
240#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
241A_EXTERN void a_complex_add_imag(a_complex *ctx, a_complex x, a_float y);
242#endif /* A_HAVE_INLINE */
243#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
244A_INTERN void a_complex_add_imag(a_complex *ctx, a_complex x, a_float y)
245{
246 ctx->real = x.real;
247 ctx->imag = x.imag + y;
248}
249#endif /* A_HAVE_INLINE */
250#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
251A_EXTERN void a_complex_add_imag_(a_complex *ctx, a_float x);
252#endif /* A_HAVE_INLINE */
253#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
254A_INTERN void a_complex_add_imag_(a_complex *ctx, a_float x)
255{
256 ctx->imag += x;
257}
258#endif /* A_HAVE_INLINE */
259
266#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
267A_EXTERN void a_complex_sub(a_complex *ctx, a_complex x, a_complex y);
268#endif /* A_HAVE_INLINE */
269#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
270A_INTERN void a_complex_sub(a_complex *ctx, a_complex x, a_complex y)
271{
272 ctx->real = x.real - y.real;
273 ctx->imag = x.imag - y.imag;
274}
275#endif /* A_HAVE_INLINE */
276#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
277A_EXTERN void a_complex_sub_(a_complex *ctx, a_complex z);
278#endif /* A_HAVE_INLINE */
279#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
280A_INTERN void a_complex_sub_(a_complex *ctx, a_complex z)
281{
282 ctx->real -= z.real;
283 ctx->imag -= z.imag;
284}
285#endif /* A_HAVE_INLINE */
286#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
287A_EXTERN void a_complex_sub_real(a_complex *ctx, a_complex x, a_float y);
288#endif /* A_HAVE_INLINE */
289#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
290A_INTERN void a_complex_sub_real(a_complex *ctx, a_complex x, a_float y)
291{
292 ctx->real = x.real - y;
293 ctx->imag = x.imag;
294}
295#endif /* A_HAVE_INLINE */
296#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
297A_EXTERN void a_complex_sub_real_(a_complex *ctx, a_float x);
298#endif /* A_HAVE_INLINE */
299#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
300A_INTERN void a_complex_sub_real_(a_complex *ctx, a_float x)
301{
302 ctx->real -= x;
303}
304#endif /* A_HAVE_INLINE */
305#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
306A_EXTERN void a_complex_sub_imag(a_complex *ctx, a_complex x, a_float y);
307#endif /* A_HAVE_INLINE */
308#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
309A_INTERN void a_complex_sub_imag(a_complex *ctx, a_complex x, a_float y)
310{
311 ctx->real = x.real;
312 ctx->imag = x.imag - y;
313}
314#endif /* A_HAVE_INLINE */
315#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
316A_EXTERN void a_complex_sub_imag_(a_complex *ctx, a_float x);
317#endif /* A_HAVE_INLINE */
318#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
319A_INTERN void a_complex_sub_imag_(a_complex *ctx, a_float x)
320{
321 ctx->imag -= x;
322}
323#endif /* A_HAVE_INLINE */
324
331#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
332A_EXTERN void a_complex_mul(a_complex *ctx, a_complex x, a_complex y);
333#endif /* A_HAVE_INLINE */
334A_EXTERN void a_complex_mul_(a_complex *ctx, a_complex z);
335#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
336A_INTERN void a_complex_mul(a_complex *ctx, a_complex x, a_complex y)
337{
338 a_complex_mul_(&x, y);
339 *ctx = x;
340}
341#endif /* A_HAVE_INLINE */
342#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
343A_EXTERN void a_complex_mul_real(a_complex *ctx, a_complex x, a_float y);
344#endif /* A_HAVE_INLINE */
345#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
346A_INTERN void a_complex_mul_real(a_complex *ctx, a_complex x, a_float y)
347{
348 ctx->real = x.real * y;
349 ctx->imag = x.imag * y;
350}
351#endif /* A_HAVE_INLINE */
352#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
353A_EXTERN void a_complex_mul_real_(a_complex *ctx, a_float x);
354#endif /* A_HAVE_INLINE */
355#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
356A_INTERN void a_complex_mul_real_(a_complex *ctx, a_float x)
357{
358 ctx->real *= x;
359 ctx->imag *= x;
360}
361#endif /* A_HAVE_INLINE */
362#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
363A_EXTERN void a_complex_mul_imag(a_complex *ctx, a_complex x, a_float y);
364#endif /* A_HAVE_INLINE */
365#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
366A_INTERN void a_complex_mul_imag(a_complex *ctx, a_complex x, a_float y)
367{
368 ctx->real = -x.imag * y;
369 ctx->imag = x.real * y;
370}
371#endif /* A_HAVE_INLINE */
372#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
373A_EXTERN void a_complex_mul_imag_(a_complex *ctx, a_float x);
374#endif /* A_HAVE_INLINE */
375#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
376A_INTERN void a_complex_mul_imag_(a_complex *ctx, a_float x)
377{
378 a_float const real = ctx->real;
379 ctx->real = -ctx->imag * x;
380 ctx->imag = real * x;
381}
382#endif /* A_HAVE_INLINE */
383
390#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
391A_EXTERN void a_complex_div(a_complex *ctx, a_complex x, a_complex y);
392#endif /* A_HAVE_INLINE */
393A_EXTERN void a_complex_div_(a_complex *ctx, a_complex z);
394#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
395A_INTERN void a_complex_div(a_complex *ctx, a_complex x, a_complex y)
396{
397 a_complex_div_(&x, y);
398 *ctx = x;
399}
400#endif /* A_HAVE_INLINE */
401#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
402A_EXTERN void a_complex_div_real(a_complex *ctx, a_complex x, a_float y);
403#endif /* A_HAVE_INLINE */
404#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
405A_INTERN void a_complex_div_real(a_complex *ctx, a_complex x, a_float y)
406{
407 ctx->real = x.real / y;
408 ctx->imag = x.imag / y;
409}
410#endif /* A_HAVE_INLINE */
411#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
412A_EXTERN void a_complex_div_real_(a_complex *ctx, a_float x);
413#endif /* A_HAVE_INLINE */
414#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
415A_INTERN void a_complex_div_real_(a_complex *ctx, a_float x)
416{
417 ctx->real /= x;
418 ctx->imag /= x;
419}
420#endif /* A_HAVE_INLINE */
421#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
422A_EXTERN void a_complex_div_imag(a_complex *ctx, a_complex x, a_float y);
423#endif /* A_HAVE_INLINE */
424#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
425A_INTERN void a_complex_div_imag(a_complex *ctx, a_complex x, a_float y)
426{
427 ctx->real = -x.imag / y;
428 ctx->imag = x.real / y;
429}
430#endif /* A_HAVE_INLINE */
431#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
432A_EXTERN void a_complex_div_imag_(a_complex *ctx, a_float x);
433#endif /* A_HAVE_INLINE */
434#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
435A_INTERN void a_complex_div_imag_(a_complex *ctx, a_float x)
436{
437 a_float const real = ctx->real;
438 ctx->real = -ctx->imag / x;
439 ctx->imag = real / x;
440}
441#endif /* A_HAVE_INLINE */
442
448#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
449A_EXTERN void a_complex_inv(a_complex *ctx, a_complex z);
450#endif /* A_HAVE_INLINE */
451A_EXTERN void a_complex_inv_(a_complex *ctx);
452#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
453A_INTERN void a_complex_inv(a_complex *ctx, a_complex z)
454{
455 a_complex_inv_(&z);
456 *ctx = z;
457}
458#endif /* A_HAVE_INLINE */
459
460/* Elementary Complex Functions */
461
467#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
468A_EXTERN void a_complex_sqrt(a_complex *ctx, a_complex z);
469#endif /* A_HAVE_INLINE */
470A_EXTERN void a_complex_sqrt_(a_complex *ctx);
471A_EXTERN void a_complex_sqrt_real(a_complex *ctx, a_float x);
472#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
473A_INTERN void a_complex_sqrt(a_complex *ctx, a_complex z)
474{
475 a_complex_sqrt_(&z);
476 *ctx = z;
477}
478#endif /* A_HAVE_INLINE */
479
486#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
487A_EXTERN void a_complex_pow(a_complex *ctx, a_complex z, a_complex a);
488#endif /* A_HAVE_INLINE */
489A_EXTERN void a_complex_pow_(a_complex *ctx, a_complex a);
490#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
491A_INTERN void a_complex_pow(a_complex *ctx, a_complex z, a_complex a)
492{
493 a_complex_pow_(&z, a);
494 *ctx = z;
495}
496#endif /* A_HAVE_INLINE */
497
504#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
506#endif /* A_HAVE_INLINE */
507A_EXTERN void a_complex_pow_real_(a_complex *ctx, a_float a);
508#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
509A_INTERN void a_complex_pow_real(a_complex *ctx, a_complex z, a_float a)
510{
511 a_complex_pow_real_(&z, a);
512 *ctx = z;
513}
514#endif /* A_HAVE_INLINE */
515
521#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
522A_EXTERN void a_complex_exp(a_complex *ctx, a_complex z);
523#endif /* A_HAVE_INLINE */
524A_EXTERN void a_complex_exp_(a_complex *ctx);
525#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
526A_INTERN void a_complex_exp(a_complex *ctx, a_complex z)
527{
528 a_complex_exp_(&z);
529 *ctx = z;
530}
531#endif /* A_HAVE_INLINE */
532
538#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
539A_EXTERN void a_complex_log(a_complex *ctx, a_complex z);
540#endif /* A_HAVE_INLINE */
541A_EXTERN void a_complex_log_(a_complex *ctx);
542#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
543A_INTERN void a_complex_log(a_complex *ctx, a_complex z)
544{
545 a_complex_log_(&z);
546 *ctx = z;
547}
548#endif /* A_HAVE_INLINE */
549
555#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
556A_EXTERN void a_complex_log2(a_complex *ctx, a_complex z);
557#endif /* A_HAVE_INLINE */
558A_EXTERN void a_complex_log2_(a_complex *ctx);
559#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
560A_INTERN void a_complex_log2(a_complex *ctx, a_complex z)
561{
562 a_complex_log2_(&z);
563 *ctx = z;
564}
565#endif /* A_HAVE_INLINE */
566
572#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
573A_EXTERN void a_complex_log10(a_complex *ctx, a_complex z);
574#endif /* A_HAVE_INLINE */
575A_EXTERN void a_complex_log10_(a_complex *ctx);
576#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
577A_INTERN void a_complex_log10(a_complex *ctx, a_complex z)
578{
579 a_complex_log10_(&z);
580 *ctx = z;
581}
582#endif /* A_HAVE_INLINE */
583
590#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
591A_EXTERN void a_complex_logb(a_complex *ctx, a_complex z, a_complex b);
592#endif /* A_HAVE_INLINE */
593A_EXTERN void a_complex_logb_(a_complex *ctx, a_complex b);
594#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
595A_INTERN void a_complex_logb(a_complex *ctx, a_complex z, a_complex b)
596{
597 a_complex_logb_(&z, b);
598 *ctx = z;
599}
600#endif /* A_HAVE_INLINE */
601
602/* Complex Trigonometric Functions */
603
609#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
610A_EXTERN void a_complex_sin(a_complex *ctx, a_complex z);
611#endif /* A_HAVE_INLINE */
612A_EXTERN void a_complex_sin_(a_complex *ctx);
613#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
614A_INTERN void a_complex_sin(a_complex *ctx, a_complex z)
615{
616 a_complex_sin_(&z);
617 *ctx = z;
618}
619#endif /* A_HAVE_INLINE */
620
626#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
627A_EXTERN void a_complex_cos(a_complex *ctx, a_complex z);
628#endif /* A_HAVE_INLINE */
629A_EXTERN void a_complex_cos_(a_complex *ctx);
630#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
631A_INTERN void a_complex_cos(a_complex *ctx, a_complex z)
632{
633 a_complex_cos_(&z);
634 *ctx = z;
635}
636#endif /* A_HAVE_INLINE */
637
643#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
644A_EXTERN void a_complex_tan(a_complex *ctx, a_complex z);
645#endif /* A_HAVE_INLINE */
646A_EXTERN void a_complex_tan_(a_complex *ctx);
647#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
648A_INTERN void a_complex_tan(a_complex *ctx, a_complex z)
649{
650 a_complex_tan_(&z);
651 *ctx = z;
652}
653#endif /* A_HAVE_INLINE */
654
660#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
661A_EXTERN void a_complex_sec(a_complex *ctx, a_complex z);
662#endif /* A_HAVE_INLINE */
663A_EXTERN void a_complex_sec_(a_complex *ctx);
664#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
665A_INTERN void a_complex_sec(a_complex *ctx, a_complex z)
666{
667 a_complex_sec_(&z);
668 *ctx = z;
669}
670#endif /* A_HAVE_INLINE */
671
677#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
678A_EXTERN void a_complex_csc(a_complex *ctx, a_complex z);
679#endif /* A_HAVE_INLINE */
680A_EXTERN void a_complex_csc_(a_complex *ctx);
681#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
682A_INTERN void a_complex_csc(a_complex *ctx, a_complex z)
683{
684 a_complex_csc_(&z);
685 *ctx = z;
686}
687#endif /* A_HAVE_INLINE */
688
694#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
695A_EXTERN void a_complex_cot(a_complex *ctx, a_complex z);
696#endif /* A_HAVE_INLINE */
697A_EXTERN void a_complex_cot_(a_complex *ctx);
698#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
699A_INTERN void a_complex_cot(a_complex *ctx, a_complex z)
700{
701 a_complex_cot_(&z);
702 *ctx = z;
703}
704#endif /* A_HAVE_INLINE */
705
706/* Inverse Complex Trigonometric Functions */
707
713#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
714A_EXTERN void a_complex_asin(a_complex *ctx, a_complex z);
715#endif /* A_HAVE_INLINE */
716A_EXTERN void a_complex_asin_(a_complex *ctx);
717A_EXTERN void a_complex_asin_real(a_complex *ctx, a_float x);
718#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
719A_INTERN void a_complex_asin(a_complex *ctx, a_complex z)
720{
721 a_complex_asin_(&z);
722 *ctx = z;
723}
724#endif /* A_HAVE_INLINE */
725
731#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
732A_EXTERN void a_complex_acos(a_complex *ctx, a_complex z);
733#endif /* A_HAVE_INLINE */
734A_EXTERN void a_complex_acos_(a_complex *ctx);
735A_EXTERN void a_complex_acos_real(a_complex *ctx, a_float x);
736#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
737A_INTERN void a_complex_acos(a_complex *ctx, a_complex z)
738{
739 a_complex_acos_(&z);
740 *ctx = z;
741}
742#endif /* A_HAVE_INLINE */
743
749#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
750A_EXTERN void a_complex_atan(a_complex *ctx, a_complex z);
751#endif /* A_HAVE_INLINE */
752A_EXTERN void a_complex_atan_(a_complex *ctx);
753#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
754A_INTERN void a_complex_atan(a_complex *ctx, a_complex z)
755{
756 a_complex_atan_(&z);
757 *ctx = z;
758}
759#endif /* A_HAVE_INLINE */
760
766#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
767A_EXTERN void a_complex_asec(a_complex *ctx, a_complex z);
768#endif /* A_HAVE_INLINE */
769A_EXTERN void a_complex_asec_(a_complex *ctx);
770A_EXTERN void a_complex_asec_real(a_complex *ctx, a_float x);
771#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
772A_INTERN void a_complex_asec(a_complex *ctx, a_complex z)
773{
774 a_complex_asec_(&z);
775 *ctx = z;
776}
777#endif /* A_HAVE_INLINE */
778
784#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
785A_EXTERN void a_complex_acsc(a_complex *ctx, a_complex z);
786#endif /* A_HAVE_INLINE */
787A_EXTERN void a_complex_acsc_(a_complex *ctx);
788A_EXTERN void a_complex_acsc_real(a_complex *ctx, a_float x);
789#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
790A_INTERN void a_complex_acsc(a_complex *ctx, a_complex z)
791{
792 a_complex_acsc_(&z);
793 *ctx = z;
794}
795#endif /* A_HAVE_INLINE */
796
802#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
803A_EXTERN void a_complex_acot(a_complex *ctx, a_complex z);
804#endif /* A_HAVE_INLINE */
805A_EXTERN void a_complex_acot_(a_complex *ctx);
806#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
807A_INTERN void a_complex_acot(a_complex *ctx, a_complex z)
808{
809 a_complex_acot_(&z);
810 *ctx = z;
811}
812#endif /* A_HAVE_INLINE */
813
814/* Complex Hyperbolic Functions */
815
821#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
822A_EXTERN void a_complex_sinh(a_complex *ctx, a_complex z);
823#endif /* A_HAVE_INLINE */
824A_EXTERN void a_complex_sinh_(a_complex *ctx);
825#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
826A_INTERN void a_complex_sinh(a_complex *ctx, a_complex z)
827{
828 a_complex_sinh_(&z);
829 *ctx = z;
830}
831#endif /* A_HAVE_INLINE */
832
838#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
839A_EXTERN void a_complex_cosh(a_complex *ctx, a_complex z);
840#endif /* A_HAVE_INLINE */
841A_EXTERN void a_complex_cosh_(a_complex *ctx);
842#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
843A_INTERN void a_complex_cosh(a_complex *ctx, a_complex z)
844{
845 a_complex_cosh_(&z);
846 *ctx = z;
847}
848#endif /* A_HAVE_INLINE */
849
855#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
856A_EXTERN void a_complex_tanh(a_complex *ctx, a_complex z);
857#endif /* A_HAVE_INLINE */
858A_EXTERN void a_complex_tanh_(a_complex *ctx);
859#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
860A_INTERN void a_complex_tanh(a_complex *ctx, a_complex z)
861{
862 a_complex_tanh_(&z);
863 *ctx = z;
864}
865#endif /* A_HAVE_INLINE */
866
872#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
873A_EXTERN void a_complex_sech(a_complex *ctx, a_complex z);
874#endif /* A_HAVE_INLINE */
875A_EXTERN void a_complex_sech_(a_complex *ctx);
876#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
877A_INTERN void a_complex_sech(a_complex *ctx, a_complex z)
878{
879 a_complex_sech_(&z);
880 *ctx = z;
881}
882#endif /* A_HAVE_INLINE */
883
889#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
890A_EXTERN void a_complex_csch(a_complex *ctx, a_complex z);
891#endif /* A_HAVE_INLINE */
892A_EXTERN void a_complex_csch_(a_complex *ctx);
893#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
894A_INTERN void a_complex_csch(a_complex *ctx, a_complex z)
895{
896 a_complex_csch_(&z);
897 *ctx = z;
898}
899#endif /* A_HAVE_INLINE */
900
906#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
907A_EXTERN void a_complex_coth(a_complex *ctx, a_complex z);
908#endif /* A_HAVE_INLINE */
909A_EXTERN void a_complex_coth_(a_complex *ctx);
910#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
911A_INTERN void a_complex_coth(a_complex *ctx, a_complex z)
912{
913 a_complex_coth_(&z);
914 *ctx = z;
915}
916#endif /* A_HAVE_INLINE */
917
918/* Inverse Complex Hyperbolic Functions */
919
925#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
926A_EXTERN void a_complex_asinh(a_complex *ctx, a_complex z);
927#endif /* A_HAVE_INLINE */
928A_EXTERN void a_complex_asinh_(a_complex *ctx);
929#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
930A_INTERN void a_complex_asinh(a_complex *ctx, a_complex z)
931{
932 a_complex_asinh_(&z);
933 *ctx = z;
934}
935#endif /* A_HAVE_INLINE */
936
942#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
943A_EXTERN void a_complex_acosh(a_complex *ctx, a_complex z);
944#endif /* A_HAVE_INLINE */
945A_EXTERN void a_complex_acosh_(a_complex *ctx);
946A_EXTERN void a_complex_acosh_real(a_complex *ctx, a_float x);
947#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
948A_INTERN void a_complex_acosh(a_complex *ctx, a_complex z)
949{
950 a_complex_acosh_(&z);
951 *ctx = z;
952}
953#endif /* A_HAVE_INLINE */
954
960#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
961A_EXTERN void a_complex_atanh(a_complex *ctx, a_complex z);
962#endif /* A_HAVE_INLINE */
963A_EXTERN void a_complex_atanh_(a_complex *ctx);
964A_EXTERN void a_complex_atanh_real(a_complex *ctx, a_float x);
965#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
966A_INTERN void a_complex_atanh(a_complex *ctx, a_complex z)
967{
968 a_complex_atanh_(&z);
969 *ctx = z;
970}
971#endif /* A_HAVE_INLINE */
972
978#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
979A_EXTERN void a_complex_asech(a_complex *ctx, a_complex z);
980#endif /* A_HAVE_INLINE */
981A_EXTERN void a_complex_asech_(a_complex *ctx);
982#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
983A_INTERN void a_complex_asech(a_complex *ctx, a_complex z)
984{
985 a_complex_asech_(&z);
986 *ctx = z;
987}
988#endif /* A_HAVE_INLINE */
989
995#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
996A_EXTERN void a_complex_acsch(a_complex *ctx, a_complex z);
997#endif /* A_HAVE_INLINE */
998A_EXTERN void a_complex_acsch_(a_complex *ctx);
999#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
1000A_INTERN void a_complex_acsch(a_complex *ctx, a_complex z)
1001{
1002 a_complex_acsch_(&z);
1003 *ctx = z;
1004}
1005#endif /* A_HAVE_INLINE */
1006
1012#if !defined A_HAVE_INLINE || defined(LIBA_COMPLEX_C)
1013A_EXTERN void a_complex_acoth(a_complex *ctx, a_complex z);
1014#endif /* A_HAVE_INLINE */
1015A_EXTERN void a_complex_acoth_(a_complex *ctx);
1016#if defined(A_HAVE_INLINE) || defined(LIBA_COMPLEX_C)
1017A_INTERN void a_complex_acoth(a_complex *ctx, a_complex z)
1018{
1019 a_complex_acoth_(&z);
1020 *ctx = z;
1021}
1022#endif /* A_HAVE_INLINE */
1023
1024#if defined(LIBA_COMPLEX_C)
1025#undef A_INTERN
1026#define A_INTERN static A_INLINE
1027#endif /* LIBA_COMPLEX_C */
1028#if defined(__cplusplus)
1029} /* extern "C" */
1030#endif /* __cplusplus */
1031
1034#endif /* a/complex.h */
algorithm library
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
double a_complex_abs(a_complex z)
computes the magnitude of a complex number
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
struct a_complex a_complex
instance structure for 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
bool a_complex_eq(a_complex x, a_complex y)
complex number x is equal to complex number y
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
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
double a_complex_logabs(a_complex z)
computes the natural logarithm of magnitude of a complex number
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_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
void a_complex_tan(a_complex *ctx, a_complex z)
computes the complex tangent
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
static void a_complex_rect(a_complex *ctx, double real, double imag)
constructs a complex number from real and imaginary parts
Definition complex.h:57
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_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
bool a_complex_ne(a_complex x, a_complex y)
complex number x is not equal to complex number y
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_pow_real(a_complex *ctx, a_complex z, double a)
complex number z raised to real power a
double a_complex_abs2(a_complex z)
computes the squared magnitude of a complex number
double a_complex_arg(a_complex z)
computes the phase angle of a complex number
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
void a_complex_polar(a_complex *ctx, double rho, double theta)
constructs a complex number from polar form
#define a_float
Definition a.h:785
#define a_bool
Definition a.h:302
instance structure for complex number
Definition complex.h:38
double imag
imaginary part of complex number
Definition complex.h:40
double real
real part of complex number
Definition complex.h:39