LASP 1.0
Library for Acoustic Signal Processing
Loading...
Searching...
No Matches
lasp_mathtypes.h
Go to the documentation of this file.
1#pragma once
2#include <armadillo>
3#include "lasp_types.h"
4#include <cmath>
5
6#if LASP_DOUBLE_PRECISION == 1
7#define c_real creal
8#define c_imag cimag
9#define d_abs fabs
10#define c_abs cabs
11#define c_conj conj
12#define d_atan2 atan2
13#define d_acos acos
14#define d_sqrt sqrt
15#define c_exp cexp
16#define d_exp exp
17#define d_sin sin
18#define d_cos cos
19#define d_pow pow
20#define d_log10 log10
21#define d_ln log
22#define d_epsilon (DBL_EPSILON)
23
24#else // LASP_DOUBLE_PRECISION not defined
25#define c_conj conjf
26#define c_real crealf
27#define c_imag cimagf
28#define d_abs fabsf
29#define c_abs cabsf
30#define d_atan2 atan2f
31#define d_acos acosf
32#define d_sqrt sqrtf
33#define c_exp cexpf
34#define d_exp expf
35#define d_sin sinf
36#define d_cos cosf
37#define d_pow powf
38#define d_log10 log10f
39#define d_ln logf
40#define d_epsilon (FLT_EPSILON)
41
42#endif // LASP_DOUBLE_PRECISION
43
44using vd = arma::Col<d>;
45using vrd = arma::Row<d>;
46using vc = arma::Col<c>;
47using vrc = arma::Row<c>;
48using dmat = arma::Mat<d>;
49using cmat = arma::Mat<c>;
50using ccube = arma::Cube<c>;
51using dcube = arma::Cube<d>;
52
53const d number_pi = arma::datum::pi;
arma::Row< d > vrd
arma::Row< c > vrc
arma::Col< d > vd
arma::Mat< d > dmat
arma::Col< c > vc
arma::Cube< d > dcube
arma::Cube< c > ccube
const d number_pi
arma::Mat< c > cmat