Mathematical functionsΒΆ
-
CTMM_EXPORT ctmm_complex ctmm_complex_set(double re, double im)
returns ctmm_complex number re + im*I.
The exact definition of this function varies depending on if a C99 compliant compiler is available.
- Parameters
re
: real part of complex number re + im*Iim
: imaginary part of complex number re + im*I
-
CTMM_EXPORT ctmm_complex ctmm_complex_mul_real(ctmm_complex z, double x)
multiplies ctmm_complex by real number
- Return
ctmm_complex z*x
- Parameters
z
: complex numberx
: real number
-
CTMM_EXPORT ctmm_complex ctmm_complex_add_real(ctmm_complex z, double x)
add ctmm_complex to real number
- Return
ctmm_complex z + x
- Parameters
z
: complex numberx
: real number
-
CTMM_EXPORT ctmm_complex ctmm_complex_mul(ctmm_complex z1, ctmm_complex z2)
multiplies two ctmm_complex numbers
- Return
ctmm_complex z1*z2
- Parameters
z1
: complex numberz2
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_sub(ctmm_complex z1, ctmm_complex z2)
subtracts one ctmm_complex from another
- Return
ctmm_complex z1 - z2
- Parameters
z1
: complex numberz2
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_add(ctmm_complex z1, ctmm_complex z2)
adds one ctmm_complex to another
- Return
ctmm_complex z1 + z2
- Parameters
z1
: complex numberz2
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_div(ctmm_complex z1, ctmm_complex z2)
divides one ctmm_complex by another
- Return
ctmm_complex z1/z2
- Parameters
z1
: complex numberz2
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_sqrt(ctmm_complex z)
calculates square root of ctmm_complex
- Return
ctmm_complex sqrt(z)
- Parameters
z
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_exp(ctmm_complex z)
calculates e to the power ctmm_complex
- Return
ctmm_complex e^z
- Parameters
z
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_conj(ctmm_complex z)
calculates complex conjugate of ctmm_complex
- Return
ctmm_complex conj(z)
- Parameters
z
: complex number
-
CTMM_EXPORT ctmm_complex ctmm_complex_inv(ctmm_complex z)
calculates inverse of ctmm_complex
- Return
ctmm_complex 1/z
- Parameters
z
: complex number
-
CTMM_EXPORT double ctmm_complex_abs2(ctmm_complex z)
calculates absolute value squared of ctmm_complex
- Return
ctmm_complex |z|^2
- Parameters
z
: complex number
-
CTMM_EXPORT double ctmm_complex_arg(ctmm_complex z)
calculates argument of ctmm_complex
- Return
ctmm_complex atan2(Im(z), Re(z))
- Parameters
z
: complex number
-
CTMM_EXPORT void ctmm_matrix_set(ctmm_matrix * mat, unsigned int row, unsigned int col, ctmm_complex val)
sets matrix value mat[row][col] to val
- Parameters
mat
: pointer to matrixrow
: rowcol
: columnval
: complex value of mat[row][col]
-
CTMM_EXPORT ctmm_complex ctmm_matrix_get(ctmm_matrix * mat, unsigned int row, unsigned int col)
gets matrix value mat[row][col]
- Return
ctmm_complex value of mat[row][col]
- Parameters
mat
: pointer to matrixrow
: rowcol
: column
-
CTMM_EXPORT void ctmm_matrix_mul(ctmm_matrix * mat1, ctmm_matrix * mat2, ctmm_matrix * res)
multiplies two ctmm matrices and sets result res = mat1*mat2
- Parameters
mat1
: pointer to matrix1mat1
: pointer to matrix2res
: pointer to result matrix