BRL-CAD
Collaboration diagram for Complex Numbers:

Data Structures

struct  bn_complex
 Complex numbers. More...
 

Macros

#define bn_cx_copy(ap, bp)   {*(ap) = *(bp);}
 
#define bn_cx_neg(cp)   { (cp)->re = -((cp)->re);(cp)->im = -((cp)->im);}
 
#define bn_cx_real(cp)   (cp)->re
 
#define bn_cx_imag(cp)   (cp)->im
 
#define bn_cx_add(ap, bp)   { (ap)->re += (bp)->re; (ap)->im += (bp)->im;}
 
#define bn_cx_ampl(cp)   hypot((cp)->re, (cp)->im)
 
#define bn_cx_amplsq(cp)   ((cp)->re * (cp)->re + (cp)->im * (cp)->im)
 
#define bn_cx_conj(cp)   { (cp)->im = -(cp)->im; }
 
#define bn_cx_cons(cp, r, i)   { (cp)->re = r; (cp)->im = i; }
 
#define bn_cx_phas(cp)   atan2((cp)->im, (cp)->re)
 
#define bn_cx_scal(cp, s)   { (cp)->re *= (s); (cp)->im *= (s); }
 
#define bn_cx_sub(ap, bp)   { (ap)->re -= (bp)->re; (ap)->im -= (bp)->im;}
 
#define bn_cx_mul(ap, bp)
 
#define bn_cx_mul2(ap, bp, cp)
 

Typedefs

typedef struct bn_complex bn_complex_t
 Complex numbers. More...
 

Functions

void bn_cx_div (bn_complex_t *ap, const bn_complex_t *bp)
 Divide one complex by another. More...
 
void bn_cx_sqrt (bn_complex_t *op, const bn_complex_t *ip)
 Compute square root of complex number. More...
 

Detailed Description

Macro Definition Documentation

#define bn_cx_copy (   ap,
  bp 
)    {*(ap) = *(bp);}

Definition at line 46 of file complex.h.

#define bn_cx_neg (   cp)    { (cp)->re = -((cp)->re);(cp)->im = -((cp)->im);}

Definition at line 47 of file complex.h.

#define bn_cx_real (   cp)    (cp)->re

Definition at line 48 of file complex.h.

Referenced by rt_poly_checkroots().

#define bn_cx_imag (   cp)    (cp)->im

Definition at line 49 of file complex.h.

Referenced by rt_poly_checkroots().

#define bn_cx_add (   ap,
  bp 
)    { (ap)->re += (bp)->re; (ap)->im += (bp)->im;}

Definition at line 51 of file complex.h.

Referenced by rt_poly_eval_w_2derivatives(), and rt_poly_findroot().

#define bn_cx_ampl (   cp)    hypot((cp)->re, (cp)->im)

Definition at line 52 of file complex.h.

Referenced by bn_cx_sqrt().

#define bn_cx_amplsq (   cp)    ((cp)->re * (cp)->re + (cp)->im * (cp)->im)

Definition at line 53 of file complex.h.

Referenced by rt_poly_deflate(), and rt_poly_findroot().

#define bn_cx_conj (   cp)    { (cp)->im = -(cp)->im; }

Definition at line 54 of file complex.h.

Referenced by rt_poly_roots().

#define bn_cx_cons (   cp,
  r,
 
)    { (cp)->re = r; (cp)->im = i; }

Definition at line 55 of file complex.h.

Referenced by rt_poly_eval_w_2derivatives(), and rt_poly_roots().

#define bn_cx_phas (   cp)    atan2((cp)->im, (cp)->re)

Definition at line 56 of file complex.h.

#define bn_cx_scal (   cp,
  s 
)    { (cp)->re *= (s); (cp)->im *= (s); }

Definition at line 57 of file complex.h.

Referenced by rt_poly_findroot().

#define bn_cx_sub (   ap,
  bp 
)    { (ap)->re -= (bp)->re; (ap)->im -= (bp)->im;}

Definition at line 58 of file complex.h.

Referenced by rt_poly_findroot().

#define bn_cx_mul (   ap,
  bp 
)
Value:
{ register fastf_t a__re, b__re; \
(ap)->re = ((a__re=(ap)->re)*(b__re=(bp)->re)) - (ap)->im*(bp)->im; \
(ap)->im = a__re*(bp)->im + (ap)->im*b__re; }
unsigned char * bp
Definition: rot.c:56
double fastf_t
Definition: defines.h:300

Definition at line 60 of file complex.h.

Referenced by rt_poly_eval_w_2derivatives().

#define bn_cx_mul2 (   ap,
  bp,
  cp 
)
Value:
{ \
(ap)->re = (cp)->re * (bp)->re - (cp)->im * (bp)->im; \
(ap)->im = (cp)->re * (bp)->im + (cp)->im * (bp)->re; }
unsigned char * bp
Definition: rot.c:56

Definition at line 66 of file complex.h.

Referenced by rt_poly_findroot().

Typedef Documentation

typedef struct bn_complex bn_complex_t

Complex numbers.

Function Documentation

void bn_cx_div ( bn_complex_t ap,
const bn_complex_t bp 
)

Divide one complex by another.

bn_cx_div(&a, &b). divides a by b. Zero divisor fails. a and b may coincide. Result stored in a.

Referenced by rt_poly_findroot().

void bn_cx_sqrt ( bn_complex_t op,
const bn_complex_t ip 
)

Compute square root of complex number.

bn_cx_sqrt(&out, &c) replaces out by sqrt(c)

Note: This is a double-valued function; the result of bn_cx_sqrt() always has nonnegative imaginary part.

Definition at line 66 of file complex.c.

References bn_cx_ampl, bn_complex::im, bn_complex::re, and ZERO.

Referenced by rt_poly_findroot().