 libdspl-2.0 Digital Signal Processing Algorithm Library
Basic math functions of the real and complex arguments.

## Functions

int DSPL_API log_cmplx (complex_t *x, int n, complex_t *y)
The logarithm function the complex vector argument x. More...

int DSPL_API sinc (double *x, int n, double a, double *y)
Function for the real vector x. More...

int DSPL_API sqrt_cmplx (complex_t *x, int n, complex_t *y)
Square root of the complex vector argguument x. More...

## ◆ log_cmplx()

 int log_cmplx ( complex_t * x, int n, complex_t * y )

The logarithm function the complex vector argument x.

Function calculates the logarithm function as: here - the complex number phase.

Parameters
 [in] x Pointer to the argument vector x. Vector size is [n x 1]. [in] n Input vector x and the logarithm vector y size. [out] y Pointer to the output complex vector y, corresponds to the input vector x. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function calculated successfully.
Else code error.
Example:
complex_t x = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
complex_t y;
int k;
log_cmplx(x, 3, y);
for(k = 0; k < 3; k++)
printf("log_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));

Output is:
log_cmplx(1.0+2.0j) = 0.805+1.107j
log_cmplx(3.0+4.0j) = 1.609+0.927j
log_cmplx(5.0+6.0j) = 2.055+0.876j


Definition at line 718 of file math.c.

Referenced by asin_cmplx().

## ◆ sinc()

 int sinc ( double * x, int n, double a, double * y )

Function for the real vector x.

Parameters
 [in] x Pointer to the input vector . Vector size is [n x 1]. [in] n Input and output vectors size. [in] a Function parameter . [out] y Pointer to the sinc function output vector. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function calculated successfully.
Else code error.

Definition at line 936 of file math.c.

## ◆ sqrt_cmplx()

 int sqrt_cmplx ( complex_t * x, int n, complex_t * y )

Square root of the complex vector argguument x.

Function calculates square root value of vector x length n: Parameters
 [in] x Pointer to the input complex vector x. Vector size is [n x 1]. [in] n Size of input and output vectors x and y. [out] y Pointer to the square root vector y. Vector size is [n x 1]. Memory must be allocated.
Returns
RES_OK if function is calculated successfully.
Else code error.
Example
complex_t x = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}};
int k;
sqrt_cmplx(x, 3, y);
for(k = 0; k < 3; k++)
printf("sqrt_cmplx(%.1f%+.1fj) = %.3f%+.3fj\n",
RE(x[k]), IM(x[k]), RE(y[k]), IM(y[k]));

Result:
sqrt_cmplx(1.0+2.0j) = 1.272+0.786j
sqrt_cmplx(3.0+4.0j) = 2.000+1.000j
sqrt_cmplx(5.0+6.0j) = 2.531+1.185j


Definition at line 1307 of file math.c.

Referenced by asin_cmplx(), ellip_acd_cmplx(), and ellip_asn_cmplx().

#define RE(x)
Macro sets real part of the complex number.
Definition: dspl.h:359
int DSPL_API log_cmplx(complex_t *x, int n, complex_t *y)
The logarithm function the complex vector argument x.
Definition: math.c:718
double complex_t
Complex data type.
Definition: dspl.h:86
int DSPL_API sqrt_cmplx(complex_t *x, int n, complex_t *y)
Square root of the complex vector argguument x.
Definition: math.c:1307
#define IM(x)
Macro sets imaginary part of the complex number.
Definition: dspl.h:417