MCL
A C++ library mirroring some of the most common Matlab functions.
|
Classes | |
class | DigitalFilter |
class | FilterBank |
class | FirFilter |
class | GainFilter |
class | IdenticalFilter |
class | IirFilter |
class | IirFilterBank |
class | Matrix |
struct | EigOutput |
class | MaxGradientFilter |
class | RuntimeArchInfo |
class | Logger |
class | Triplet |
struct | AxAng |
class | Quaternion |
class | RandomGenerator |
Typedefs | |
typedef double | Real |
typedef std::complex< Real > | Complex |
typedef unsigned long | UInt |
typedef long | Int |
typedef Triplet | Point |
Enumerations | |
enum | Handedness { kRightHanded, kLeftHanded } |
enum | WallType { kCarpetPile, kCarpetCotton, kWallBricks, kCeilingTile, kRigid } |
enum | EulerOrder { zxz, xyx, yzy, zyz, xzx, yxy, xyz, yzx, zxy, xzy, zyx, yxz } |
Functions | |
IirFilter | Butter (const Int order, const Real w_low, const Real w_high) |
IirFilter | OctaveFilter (const Int order, const Real center_frequency, const Real sampling_frequency) |
IirFilterBank | OctaveFilterBank (const Int order, const Int num_bands, const Real starting_frequency, const Real sampling_frequency) |
std::vector< double > | ComputeLP (int FilterOrder) |
std::vector< double > | ComputeHP (int FilterOrder) |
std::vector< double > | TrinomialMultiply (int FilterOrder, std::vector< double > b, std::vector< double > c) |
std::vector< double > | ComputeNumCoeffs (int FilterOrder, double Lcutoff, double Ucutoff, std::vector< double > DenC) |
std::vector< double > | ComputeDenCoeffs (int FilterOrder, double Lcutoff, double Ucutoff) |
template<class T > | |
Int | MinIndex (const std::vector< T > &input) noexcept |
template<class T > | |
T | Min (const std::vector< T > &input) |
template<class T > | |
Int | MaxIndex (const std::vector< T > &input) noexcept |
template<> | |
Int | MaxIndex< UInt > (const std::vector< UInt > &input) noexcept |
template<class T > | |
T | Max (const std::vector< T > &input) noexcept |
std::vector< UInt > | FindPeaksIndexes (const std::vector< Real > &vector, const Real min_peak_height=std::numeric_limits< Real >::min()) |
std::vector< Real > | FindPeaks (const std::vector< Real > &vector, const Real min_peak_height=std::numeric_limits< Real >::min()) |
bool | BasicOpTest () |
bool | IsEqual (Real num_a, Real num_b, Real precision=VERY_SMALL) |
bool | IsEqual (Complex num_a, Complex num_b, Real precision=VERY_SMALL) |
bool | IsSmallerOrEqual (const Real num_a, const Real num_b, const Real precision=VERY_SMALL) |
bool | IsLargerOrEqual (const Real num_a, const Real num_b, const Real precision=VERY_SMALL) |
bool | AreAllSmallerOrEqual (const std::vector< Real > &vector_a, const std::vector< Real > &vector_b) |
template<class T > | |
bool | IsEqual (const std::vector< T > &vector_a, const std::vector< T > &vector_b, Real precision=VERY_SMALL) noexcept |
bool | IsEqual (const std::vector< Int > &vector_a, const std::vector< Int > &vector_b) |
bool | IsEqual (const Quaternion &quaternion_a, const Quaternion &quaternion_b) |
bool | IsEqual (const Point &point_a, const Point &point_b, const Real precision=VERY_SMALL) |
bool | IsEqual (std::vector< Point > points_a, std::vector< Point > points_b) |
bool | IsEqual (const Real *input_data_a, const Real *input_data_b, const Int num_samples, Real precision=VERY_SMALL) |
bool | IsEqual (const Real *input_data_a, const std::vector< Real > input_data_b, Real precision=VERY_SMALL) |
bool | IsEqual (const std::vector< Real > input_data_b, const Real *input_data_a, Real precision=VERY_SMALL) |
bool | IsNan (Real num) |
std::vector< bool > | IsNan (std::vector< Real > input) |
std::vector< bool > | Not (std::vector< bool > input) |
bool | All (std::vector< bool > input) |
bool | Any (std::vector< bool > input) |
bool | None (std::vector< bool > input) |
bool | IsInf (Real num) |
std::vector< bool > | IsInf (std::vector< Real > input) |
bool | ComparisonOpTest () |
void | Save (const std::vector< Real > &vector, const std::string &file_name, const mcl::Int precision=5) |
template<class T > | |
T | Max (const T &scalar_a, const T &scalar_b) noexcept |
template<class T > | |
T | Min (const T &scalar_a, const T &scalar_b) noexcept |
Real | Rem (const Real &scalar_a, const Real &scalar_b) |
Real | Mod (const Real &scalar_a, const Real &scalar_b) |
Int | Mod (const Int &scalar_a, const Int &scalar_b) |
Int | Fix (const Real scalar) |
Real | Abs (Real input) |
Real | Abs (Complex input) |
Real | Pow (Real input, Real exponent) |
Real | Sqrt (Real input) |
Int | RoundToInt (Real input) |
Int | Sign (const Real scalar) |
Complex | Conj (Complex scalar) |
Real | RealPart (Complex scalar) |
Real | ImagPart (Complex scalar) |
Int | NextPow2 (Real input) |
Int | Next2 (Int input) |
double | StringToDouble (const std::string &s) |
Int | Factorial (const Int input) |
Real | LinearInterpolation (Real x1, Real y1, Real x2, Real y2, Real x) |
bool | IsReal (const std::vector< Complex > &input) |
Real | Entropy (std::vector< Real > pdf, Real base) |
bool | ElementaryOpTest () |
IirFilter | IdenticalFilter () |
IirFilter | GainFilter (const Real gain) |
IirFilter | WallFilter (WallType wall_type, Real sampling_frequency) |
IirFilter | PinkifierFilter () |
std::vector< std::string > | Split (const std::string &string, char delim) noexcept |
template<class T > | |
void | Print (const Matrix< T > &matrix) noexcept |
template<class T > | |
Matrix< T > | Transpose (const Matrix< T > &matrix) noexcept |
template<class T > | |
Matrix< T > | Multiply (const Matrix< T > &matrix, T value) noexcept |
template<class T > | |
Matrix< T > | Multiply (const Matrix< T > &matrix_a, const Matrix< T > &matrix_b) noexcept |
template<class T > | |
std::vector< T > | Multiply (const Matrix< T > &matrix_a, const std::vector< T > &vector) noexcept |
template<class T > | |
T | Max (const Matrix< T > &matrix) noexcept |
EigOutput | Eig (const Matrix< Real > &matrix) noexcept |
Matrix< Real > | RealPart (const Matrix< Complex > &input) noexcept |
template<class T > | |
bool | IsEqual (const Matrix< T > &matrix_a, const Matrix< T > &matrix_b) noexcept |
bool | MatrixOpTest () |
Point | RotateAboutX (const Point &, Real) noexcept |
Point | RotateAboutY (const Point &, Real) noexcept |
Point | RotateAboutZ (const Point &, Real) noexcept |
Point | Rotate (const Point &, Real phi, Real theta, Real psi) noexcept |
Real | DotProduct (Point, Point) noexcept |
Real | Distance (Point, Point) noexcept |
Real | Theta (Point, Point) noexcept |
Real | Phi (Point, Point) noexcept |
Real | AngleBetweenDirections (Real theta_a, Real phi_a, Real theta_b, Real phi_b) noexcept |
Real | AngleBetweenPoints (Point, Point) noexcept |
Point | PointOnLine (const Point point_a, const Point point_b, const Real distance) noexcept |
Point | Sum (const Point point_a, const Point point_b) noexcept |
Point | Subtract (const Point point_a, const Point point_b) noexcept |
Point | Multiply (const Point point, const Real constant) noexcept |
Point | PointSpherical (Real r, Real theta, Real phi) noexcept |
Point | Projection (const Point &vector, const Point &plane_normal_vector) noexcept |
Point | Normalized (Point point) noexcept |
Point | IntersectionPlaneLine (const Point &line_point, const Point &line_direction, const Point &plane_point, const Point &plane_normal) noexcept |
bool | IntersectionPlaneLineExists (const Point &line_point, const Point &line_direction, const Point &plane_point, const Point &plane_normal) noexcept |
bool | PointTest () |
template<class T > | |
std::vector< T > | Add (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
void | Add (const Real *input_data_a, const Real *input_data_b, Int num_samples, Real *output_data) noexcept |
template<> | |
std::vector< Real > | Add (const std::vector< Real > &vector_a, const std::vector< Real > &vector_b) noexcept |
template<class T > | |
std::vector< T > | Opposite (const std::vector< T > &vector) noexcept |
std::vector< Real > | Inverse (const std::vector< Real > &vector) noexcept |
template<class T > | |
std::vector< T > | Subtract (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
template<class T > | |
std::vector< T > | Multiply (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
void | Multiply (const Real *input_data_a, const Real *input_data_b, Int num_samples, Real *output_data) noexcept |
template<> | |
std::vector< Real > | Multiply (const std::vector< Real > &vector_a, const std::vector< Real > &vector_b) noexcept |
template<class T > | |
std::vector< T > | Divide (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
template<class T > | |
std::vector< T > | Exp (const std::vector< T > &vector) noexcept |
std::vector< Complex > | Conj (const std::vector< Complex > &vector) noexcept |
std::vector< Complex > | ComplexVector (const std::vector< Real > &input) noexcept |
std::vector< Real > | RealPart (const std::vector< Complex > &input) noexcept |
std::vector< Real > | Imag (const std::vector< Complex > &input) noexcept |
std::vector< Real > | Pow (const std::vector< Real > &vector, Real exponent) noexcept |
std::vector< Real > | Abs (const std::vector< Real > &input) noexcept |
std::vector< Real > | Abs (const std::vector< Complex > &input) noexcept |
std::vector< Real > | HalfWave (const std::vector< Real > &vector) noexcept |
std::vector< Real > | Cos (const std::vector< Real > &vector) noexcept |
std::vector< Real > | Sin (const std::vector< Real > &vector) noexcept |
std::vector< Real > | Log (const std::vector< Real > &vector) noexcept |
std::vector< Real > | Log10 (const std::vector< Real > &vector) noexcept |
std::vector< Int > | ConvertToInt (const std::vector< UInt > &vector) noexcept |
bool | PointWiseOpTest () |
Quaternion | AxAng2Quat (const Real x, const Real y, const Real z, const Real angle) noexcept |
AxAng | Quat2AxAng (const Quaternion &q) noexcept |
Quaternion | QuatConj (const Quaternion &q) noexcept |
Real | Norm (const Quaternion &q) noexcept |
Point | QuatRotate (const Quaternion &q, const Point &r, const Handedness handedness=kRightHanded) noexcept |
Quaternion | QuatMultiply (const Quaternion &q, const Quaternion &r) noexcept |
Quaternion | Eul2Quat (const Real angle_1, const Real angle_2, const Real angle_3, const EulerOrder order=zyx) noexcept |
Real | Quat2EulX (const Quaternion q, const EulerOrder order=zyx) noexcept |
Real | Quat2EulY (const Quaternion q, const EulerOrder order=zyx) noexcept |
Real | Quat2EulZ (const Quaternion q, const EulerOrder order=zyx) noexcept |
Quaternion | QuatInverse (const Quaternion q) noexcept |
Real | Corr (const std::vector< Real > &vector_a, const std::vector< Real > &vector_b) |
bool | StatisticsOpTest () |
std::vector< Complex > | Fft (const std::vector< Complex > &input, Int n_point) noexcept |
std::vector< Complex > | Rfft (const std::vector< Real > &input, Int n_point) noexcept |
std::vector< std::vector < Complex > > | Rfft (const std::vector< std::vector< Real > > &input, Int n_point) noexcept |
std::vector< Real > | Irfft (const std::vector< Complex > &input, Int n_point) noexcept |
std::vector< std::vector< Real > > | Irfft (const std::vector< std::vector< Complex > > &input, Int n_point) noexcept |
std::vector< Complex > | Ifft (const std::vector< Complex > &input, Int n_point) noexcept |
std::vector< Complex > | Hilbert (const std::vector< Real > &input) noexcept |
std::vector< Real > | RCeps (const std::vector< Real > &vector) noexcept |
std::vector< Real > | MinPhase (const std::vector< Real > &vector) noexcept |
std::vector< Real > | XCorr (const std::vector< Real > &vector_a, const std::vector< Real > &vector_b) |
bool | TransformOpTest () |
template<class T > | |
Int | Length (const std::vector< T > &input) noexcept |
template<class T > | |
std::vector< T > | Zeros (Int length) noexcept |
template<class T > | |
std::vector< T > | EmptyVector () noexcept |
template<class T > | |
std::vector< T > | ZeroPad (const std::vector< T > &input, const Int total_length) noexcept |
template<class T > | |
std::vector< T > | Multiply (const std::vector< T > &vector, const T gain) noexcept |
void | Multiply (const Real *input_data, const Int num_samples, const Real gain, Real *output_data) noexcept |
template<> | |
std::vector< Real > | Multiply (const std::vector< Real > &input, const Real gain) noexcept |
void | MultiplyAdd (const Real *input_data_mult, const Real gain, const Real *input_data_add, const Int num_samples, Real *output_data) noexcept |
template<class T > | |
std::vector< T > | Add (const std::vector< T > &vector_a, const T scalar) noexcept |
Real | Add (const Real *input_data, const Int num_samples) noexcept |
template<class T > | |
std::vector< T > | Subset (const std::vector< T > &vector, const Int from_index, const Int to_index) noexcept |
template<class T > | |
std::vector< T > | Concatenate (std::vector< T > vector_a, const std::vector< T > &vector_b) noexcept |
template<class T > | |
std::vector< T > | UnaryVector (const T &element) noexcept |
template<class T > | |
std::vector< T > | BinaryVector (const T &element_a, const T &element_b) noexcept |
template<class T > | |
std::vector< T > | Flip (std::vector< T > vector) noexcept |
template<class T > | |
std::vector< T > | CircShift (const std::vector< T > &vector, Int num_positions) noexcept |
template<class T > | |
std::vector< T > | Conv (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
template<class T > | |
std::vector< T > | AddVectors (const std::vector< std::vector< T > > &vectors) noexcept |
template<class T > | |
std::vector< T > | AddVectors (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
template<class T > | |
std::vector< T > | Interleave (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
template<class T > | |
std::vector< T > | Downsample (const std::vector< T > &vector, const Int downsampling_factor) noexcept |
template<class T > | |
std::vector< T > | ColonOperator (const Int from, const Int to) noexcept |
std::vector< Real > | ColonOperator (const Real from, const Real step, const Real to) noexcept |
template<class T > | |
std::vector< T > | Elements (const std::vector< T > &vector, const Int from_id, const Int to_id) noexcept |
template<class T > | |
std::vector< T > | GetSegment (const std::vector< T > &vector, const Int subset_id, const Int subset_length, bool zeropad_if_shorter=false) noexcept |
template<class T > | |
T | Prod (const std::vector< T > &vector) noexcept |
template<class T > | |
T | Dot (const std::vector< T > &vector_a, const std::vector< T > &vector_b) noexcept |
Real | Norm (const std::vector< Real > &vector, Real l_norm=2.0) noexcept |
template<class T > | |
void | Print (const T *vector, const Int num_elements) noexcept |
template<class T > | |
void | Print (const std::vector< T > &vector) noexcept |
std::vector< Real > | Ones (Int length) noexcept |
std::vector< Real > | Hann (const Int length) noexcept |
std::vector< Real > | Hamming (const Int length) noexcept |
std::vector< Real > | TukeyWin (const Int length, const Real ratio) noexcept |
std::vector< Real > | LinSpace (Real min, Real max, Int num_elements) noexcept |
Real | Sum (const std::vector< Real > &input) noexcept |
Real | Mean (const std::vector< Real > &input) noexcept |
Real | Geomean (const std::vector< Real > &input) noexcept |
Real | Mean (const std::vector< Real > &input, const std::vector< Real > &weigths) noexcept |
Real | Std (const std::vector< Real > &input) noexcept |
Real | Var (const std::vector< Real > &input) noexcept |
Real | Var (const std::vector< Real > &input, const std::vector< Real > &weights) noexcept |
std::vector< Complex > | Poly (const std::vector< Complex > roots) noexcept |
std::vector< Complex > | Poly (const std::vector< Real > roots) noexcept |
bool | IsNonNegative (const std::vector< Real > &input) noexcept |
bool | VectorOpTest () |
Matrix< Real > | Cov (const std::vector< Real > &x, const std::vector< Real > &y) noexcept |
Matrix< Real > | Cov (const std::vector< std::vector< Real > > &input) noexcept |
Real | CovElement (const std::vector< Real > &x, const std::vector< Real > &y) noexcept |
std::vector< Real > | CumSum (const std::vector< Real > &input) noexcept |
std::vector< std::vector< Real > > | Enframe (const std::vector< Real > &input, const std::vector< Real > &window, const Int frame_increment) noexcept |
std::vector< Real > | OverlapAdd (const std::vector< std::vector< Real > > &frames, const std::vector< Real > &window, const Int frame_increment) noexcept |
std::vector< Complex > | ConvertToComplex (std::vector< Real > input) noexcept |
BENCHMARK (FirFilterSequentialBenchmark) -> RangeMultiplier(8) ->Ranges( | |
BENCHMARK (FirFilterBenchmark) -> RangeMultiplier(8) ->Ranges( | |
BENCHMARK (IirFilterBenchmark) -> RangeMultiplier(64) ->Range(1, 1<< 10) | |
typedef std::complex<Real> mcl::Complex |
Complex type
typedef long mcl::Int |
Int type
typedef Triplet mcl::Point |
typedef double mcl::Real |
Real type
typedef unsigned long mcl::UInt |
Unisgned int type
enum mcl::EulerOrder |
enum mcl::Handedness |
enum mcl::WallType |
This enum is related to the frequencye absorption characteristics of the different walls.
Real mcl::Abs | ( | Real | input | ) |
Equivalent to Matlab's abs(scalar)
Real mcl::Abs | ( | Complex | input | ) |
Equivalent to Matlab's abs(scalar)
|
noexcept |
Equivalent to Matlab's abs(vector)
|
noexcept |
Equivalent to Matlab's abs(vector)
|
noexcept |
Returns the point by point addition of the two vectors. Equivalent to Matlab's vector_a+vector_b.
|
noexcept |
|
inlinenoexcept |
|
noexcept |
Returns the point by point addition of the two vectors. Equivalent to Matlab's vector_a+vector_b.
|
noexcept |
|
noexcept |
Adds all the vectors and zero-pads short vectors if they have different lengths.
|
noexcept |
Adds two vectors and zero-pads the shorter one if they have different lengths.
bool mcl::All | ( | std::vector< bool > | input | ) |
Returns true if all bools are true
|
noexcept |
|
noexcept |
bool mcl::Any | ( | std::vector< bool > | input | ) |
Returns true if any one of the bools is true
bool mcl::AreAllSmallerOrEqual | ( | const std::vector< Real > & | vector_a, |
const std::vector< Real > & | vector_b | ||
) |
|
noexcept |
Returns a Quaternion using a given axis-angle representation
bool mcl::BasicOpTest | ( | ) |
mcl::BENCHMARK | ( | FirFilterSequentialBenchmark | ) | -> RangeMultiplier(8)->Ranges( |
mcl::BENCHMARK | ( | FirFilterBenchmark | ) | -> RangeMultiplier(8)->Ranges( |
mcl::BENCHMARK | ( | IirFilterBenchmark | ) | -> RangeMultiplier(64) ->Range(1, 1<< 10) |
|
noexcept |
Returns a vector with two elements.
IirFilter mcl::Butter | ( | const Int | order, |
const Real | w_low, | ||
const Real | w_high | ||
) |
Construncts a bandpass butterworth filter. Equivalent to Matlab's butter(order, [w_low, w_high])
|
noexcept |
Equivalent to Matlab's circshift(vector, num_positions). A positive num_positions corresponds to a forward shift.
|
noexcept |
This is equivalent to Matlab's from:to. E.g. 3:5 outputs a vector [3,4,5]. TODO: Implement fractional input.
|
noexcept |
This is equivalent to Matlab's from:step:to. E.g. 3:2:6 outputs a vector [3,4,6].
bool mcl::ComparisonOpTest | ( | ) |
|
noexcept |
Transform real vector into complex vector with null imaginary part
std::vector< double > mcl::ComputeDenCoeffs | ( | int | FilterOrder, |
double | Lcutoff, | ||
double | Ucutoff | ||
) |
std::vector< double > mcl::ComputeHP | ( | int | FilterOrder | ) |
std::vector< double > mcl::ComputeLP | ( | int | FilterOrder | ) |
std::vector< double > mcl::ComputeNumCoeffs | ( | int | FilterOrder, |
double | Lcutoff, | ||
double | Ucutoff, | ||
std::vector< double > | DenC | ||
) |
|
noexcept |
Returns the concatenation of vector_a and vector_b. Equivalent to Matlab's [vector_a; vector_b].
Complex mcl::Conj | ( | Complex | scalar | ) |
Returns the conjugate of the element. Equivalent to Matlab's conj(scalar).
|
noexcept |
Returns the vector with conjugate entries. Equivalent to Matlab's conj(vector).
|
noexcept |
Equivalent to Matlab's conv(vector_a, vector_b).
|
noexcept |
|
noexcept |
Real mcl::Corr | ( | const std::vector< Real > & | vector_a, |
const std::vector< Real > & | vector_b | ||
) |
Returns the Pearson linear correlation between vector_a
and vector_b
|
noexcept |
Equivalent to Matlab's cos(vector)
|
noexcept |
|
noexcept |
Returns a vector containing the cumulative sum of the elements of X. Equivalent to Matlab's cumsum(input)
|
noexcept |
|
noexcept |
Returns the point by point multiplication of the two vectors. Equivalent to Matlab's vector_a.*vector_b.
|
noexcept |
Dot product between two vectors. Equivalent to Matlab's dot(a,b)
|
noexcept |
|
noexcept |
Decreases the sampling frequency of the input vector by keeping the first sample and then every downsampling_factor
-th sample after the first.
|
noexcept |
bool mcl::ElementaryOpTest | ( | ) |
|
noexcept |
Returns elements of vector vector
from from_id to to_id (including extremes).
|
noexcept |
|
noexcept |
Splits signal up into (overlapping) frames
Real mcl::Entropy | ( | std::vector< Real > | pdf, |
Real | base | ||
) |
Calculates the entropy of a discreate random variable with given `pdf'. It normalises the pdf if its sum is not 1. Note: this function is identical to Matlab's only for uint8 values.
|
noexcept |
Converts Euler angles with a given convention to a Quaternion. Each input angle corresponds to the associated ordering. E.g. for zyx convention (which is the default), the first angle is for a rotation around the z axis, second for y, etc.
|
noexcept |
Equivalent to Matlab's exp(vector).
Int mcl::Factorial | ( | const Int | input | ) |
Equivalent to Matlab's factorial(input)
|
noexcept |
Performs the fft of the input signal. Equivalent to Matlab's fft(input, n_point)
std::vector< Real > mcl::FindPeaks | ( | const std::vector< Real > & | vector, |
const Real | min_peak_height = std::numeric_limits<Real>::min() |
||
) |
Returns the values local peaks in the vector. Equivalent to Matlab's findpeaks.
std::vector< UInt > mcl::FindPeaksIndexes | ( | const std::vector< Real > & | vector, |
const Real | min_peak_height = std::numeric_limits<Real>::min() |
||
) |
Returns the indexes of the local peaks in the vector. Equivalent to Matlab's findpeaks.
Int mcl::Fix | ( | const Real | scalar | ) |
Equivalent to Matlab's fix(scalar)
|
noexcept |
Flips the vector. Equivalent to matlab's flipud or fliplr (which for vectors are equivalent).
IirFilter mcl::GainFilter | ( | const Real | gain | ) |
Constructs a filter for which output==gain*input always.
|
noexcept |
Returns the geometric mean of the input vector. Equivalent to Matlab's geomean(input)
|
noexcept |
|
noexcept |
Equivalent to Matlab's vector.*(vector>0)
|
noexcept |
Returns a Hamming window of length `length'
|
noexcept |
|
noexcept |
Performs the equivalent of Matlab's Hilbert (i.e. computes the so-called discrete-time analytic signal).
Implements a first-order IIR low-pass filter with a given decay constant.
[in] | ramp_samples | number of samples after which the value is to 1/e away from target value. Implements a first-order IIR low-pass filter with a given decay constant. |
[in] | ramp_samples | number of samples after which the value is to 1/e away from target value. Constructs a filter for which output==input always. |
|
noexcept |
Performs the ifft of the input signal. Equivalent to Matlab's ifft(input, n_point)
|
noexcept |
Equivalent to Matlab's imag(input).
Real mcl::ImagPart | ( | Complex | scalar | ) |
Returns the imaginary part of a complex scalar. Equivalent to Matlab's imag(scalar). I am calling it `ImagPart' for consistency with `RealPart'
|
noexcept |
Interleaves two vectors, with the first element of vector_a
going first.
|
noexcept |
Returns the intersection point between a plane and a line. The line is identified by a point on a line, line_point, and the direction of the line, line_direction (every point on the line can be expressed as p=d line_point+line_direction, with d any scalar). The plane is identified as any point on the plane, plane_point, and the normal to the plane, plane_normal (every point on the plane can be expressed as (p-plane_point, plane_normal)=0 where (x,y) is scalar product). If the line is contained in the plane, the function returns line_point. If there is no intersection, then the function returns a point of NANs. The user should first check whether an intersection exists using IntersectionPlaneLineExists.
|
noexcept |
Returns whther or not an intersection between a plane and a line exists. The line is identified by a point on a line, line_point, and the direction of the line, line_direction (every point on the line can be expressed as p=d line_point+line_direction, with d any scalar). The plane is identified as any point on the plane, plane_point, and the normal to the plane, plane_normal (every point on the plane can be expressed as (p-plane_point, plane_normal)=0 where (x,y) is scalar product).
|
noexcept |
Returns the inverse vector.Equivalent to Matlab's 1./vector.
|
noexcept |
Performs the inverse fft of conjugate symmetric spectrum. Equivalent to Voice Box's rfft(input, n_point)
|
noexcept |
Performs the inverse fft of conjugate symmetric spectra. Equivalent to Voice Box's rfft(input, n_point)
bool mcl::IsEqual | ( | Real | num_a, |
Real | num_b, | ||
Real | precision = VERY_SMALL |
||
) |
bool mcl::IsEqual | ( | Complex | num_a, |
Complex | num_b, | ||
Real | precision = VERY_SMALL |
||
) |
|
noexcept |
bool mcl::IsEqual | ( | const std::vector< Int > & | vector_a, |
const std::vector< Int > & | vector_b | ||
) |
bool mcl::IsEqual | ( | const Quaternion & | quaternion_a, |
const Quaternion & | quaternion_b | ||
) |
bool mcl::IsEqual | ( | const Point & | point_a, |
const Point & | point_b, | ||
const Real | precision = VERY_SMALL |
||
) |
bool mcl::IsEqual | ( | std::vector< Point > | points_a, |
std::vector< Point > | points_b | ||
) |
bool mcl::IsEqual | ( | const Real * | input_data_a, |
const Real * | input_data_b, | ||
const Int | num_samples, | ||
Real | precision = VERY_SMALL |
||
) |
bool mcl::IsEqual | ( | const Real * | input_data_a, |
const std::vector< Real > | input_data_b, | ||
Real | precision = VERY_SMALL |
||
) |
bool mcl::IsEqual | ( | const std::vector< Real > | input_data_b, |
const Real * | input_data_a, | ||
Real | precision = VERY_SMALL |
||
) |
|
noexcept |
bool mcl::IsInf | ( | Real | num | ) |
Returns true if num is +inf or -inf
std::vector< bool > mcl::IsInf | ( | std::vector< Real > | input | ) |
Returns true if num is +inf or -inf
bool mcl::IsLargerOrEqual | ( | const Real | num_a, |
const Real | num_b, | ||
const Real | precision = VERY_SMALL |
||
) |
bool mcl::IsNan | ( | Real | num | ) |
Returns true if num is nan
std::vector< bool > mcl::IsNan | ( | std::vector< Real > | input | ) |
Returns true if num is nan
|
noexcept |
Returns true if all elements are non negative
bool mcl::IsReal | ( | const std::vector< Complex > & | input | ) |
Returns true if the imaginary part is approximately zero. The precision used is VERY_SMALL in equality operations, hence use only for testing.
bool mcl::IsSmallerOrEqual | ( | const Real | num_a, |
const Real | num_b, | ||
const Real | precision = VERY_SMALL |
||
) |
|
noexcept |
Equivalent to Matlab's length(input).
Real mcl::LinearInterpolation | ( | Real | x1, |
Real | y1, | ||
Real | x2, | ||
Real | y2, | ||
Real | x | ||
) |
Linear interpolation between two values
|
noexcept |
Equivalent to Matlab's linspace(min, max, num_elements);
|
noexcept |
Returns the natural logarithm of the elements of vector. Equivalent to Matlab's log(vector).
|
noexcept |
Returns the 10-base logarithm of the elements of vector. Equivalent to Matlab's log10(vector).
bool mcl::MatrixOpTest | ( | ) |
|
noexcept |
|
noexcept |
Returns the maximum value of the vector.
|
noexcept |
Extract the maximum value of the matrix. Equivalent to Matlab's max(max(matrix))
|
noexcept |
Returns the index associated to the maximum value in the vector. The index counts starting from 0. If there are two maxima, the index of the first one is returned.
|
noexcept |
|
noexcept |
Equivalent to Matlab's mean(input)
|
noexcept |
Weighted mean. Not implemented in Matlab (but should be). The weights are normalised inside the function. Hence Mean(input, ones(N)) gives the same result as Mean(input, ones(N)/N).
|
noexcept |
T mcl::Min | ( | const std::vector< T > & | input | ) |
Returns the maximum value of the vector.
|
noexcept |
Returns the index associated to the maximum value in the vector. The index counts starting from 0. If there are two maxima, the index of the first one is returned.
|
noexcept |
Returns the (unique) minimum-phase sequence that has the same real cepstrum as vector. Equivalent to Matlab's [~, out] = rceps(vector).
Real mcl::Mod | ( | const Real & | scalar_a, |
const Real & | scalar_b | ||
) |
Equivalent to Matlab's mod(scalar_a,scalar_b)
Int mcl::Mod | ( | const Int & | scalar_a, |
const Int & | scalar_b | ||
) |
Equivalent to Matlab's mod(scalar_a,scalar_b)
|
noexcept |
Returns the point by point multiplication of the vector with the gain. Equivalent to Matlab's vector_a.*gain.
|
noexcept |
|
inlinenoexcept |
|
noexcept |
Returns the point by point multiplication of the two vectors. Equivalent to Matlab's vector_a.*vector_b.
|
noexcept |
|
inlinenoexcept |
|
noexcept |
Multiplies all coordinates by given constant. Has the effect of changing of changing the length of the vector.
|
noexcept |
Multiplies all the elements of matrix
by value
. Equivalent to Matlabs' matrix.*value
|
noexcept |
Matrix multiplication. Equivalent to Matlabs' matrix_a*matrix_b
|
noexcept |
|
noexcept |
This calculates the multiplication of a vector (input_data_mult
) by a constant (gain
), and then adds the resulting vector to another vector (`input_data_add').
Int mcl::Next2 | ( | Int | input | ) |
This returns the next power of 2. For instance 5=>8, 12=>16, 16=>16.
Int mcl::NextPow2 | ( | Real | input | ) |
Equivalent to Matlab's nextpow2(input)
bool mcl::None | ( | std::vector< bool > | input | ) |
Opposite of All: returns true if none of the inputs are true
|
noexcept |
Returns the norm of a quaternion (defined the same as the Eucledian norm in R^4)
|
noexcept |
|
noexcept |
Returns a new point that is a normalized (norm == 1) version of point
.
std::vector< bool > mcl::Not | ( | std::vector< bool > | input | ) |
Returns opposite bool as input
IirFilter mcl::OctaveFilter | ( | const Int | order, |
const Real | center_frequency, | ||
const Real | sampling_frequency | ||
) |
Constructs a digital octave filter with given center frequency and sampling frequency.
IirFilterBank mcl::OctaveFilterBank | ( | const Int | order, |
const Int | num_bands, | ||
const Real | starting_frequency, | ||
const Real | sampling_frequency | ||
) |
|
noexcept |
Returns a real vector of length
ones.
|
noexcept |
Returns the opposite vector.Equivalent to Matlab's -vector.
|
noexcept |
|
noexcept |
IirFilter mcl::PinkifierFilter | ( | ) |
Returns a pinkifier filter
|
noexcept |
This returns the point on the line between point_a
and point_b
which has a distance of distance
from point_a
|
noexcept |
Contructs a point from spherical coordinates, with (r, 0, 0) corresponding to the z-axis, and (r, pi/2, 0) corresponding to x-axis. Right-hand rule.
bool mcl::PointTest | ( | ) |
bool mcl::PointWiseOpTest | ( | ) |
|
noexcept |
Converts roots to polynomial. Equivalent to Matlab's poly(roots)
|
noexcept |
Real mcl::Pow | ( | Real | input, |
Real | exponent | ||
) |
Power function. Equivalent to Matlab's input^exponent.
|
noexcept |
Returns the point-wise poser to exponent. Equivalent to Matlab's vector.^exponent
|
noexcept |
|
noexcept |
|
noexcept |
|
noexcept |
Multiplies all the elements in the vector. Equivalent to Matlab's prod(vector).
|
noexcept |
Constructs a vector that is the the projection of the input vector
on the plane (passing through the origin) identified by the vector normal to the plane plane_normal_vector
.
|
noexcept |
|
noexcept |
Returns the Euler angle around the x-axis associated to a given quaternion and for a given Euler rotation convention
|
noexcept |
Returns the Euler angle around the y-axis associated to a given quaternion and for a given Euler rotation convention
|
noexcept |
Returns the Euler angle around the z-axis associated to a given quaternion and for a given Euler rotation convention
|
noexcept |
|
noexcept |
|
noexcept |
Implements the (Hamilton) quaternion multiplication
|
noexcept |
|
noexcept |
Returns the real cepstrum of the real sequence X. Equivalent to Matlab's rceps(vector)
Real mcl::RealPart | ( | Complex | scalar | ) |
Returns the real part of a complex scalar. Equivalent to Matlab's real(scalar). I am calling it `RealPart' since `Real' denotes the number type
|
noexcept |
Equivalent to Matlab's real(input).
Real mcl::Rem | ( | const Real & | scalar_a, |
const Real & | scalar_b | ||
) |
Equivalent to Matlab's rem(scalar_a,scalar_b)
|
noexcept |
Performs the fft of the real input signal. Equivalent to Voice Box's rfft(input, n_point)
|
noexcept |
Performs the fft of real vectors. Equivalent to Voice Box's rfft(input, n_point)
|
noexcept |
Rotates the reference system with euler angles. Convention is ZYX with angles phi, theta and psi, respectively.
|
noexcept |
Rotates the reference system about the x-axis with the right-hand rule. e.g. RotateAboutX(Point(0.0,1.0,0.0), pi/2) == Point(0.0,0.0,1.0)
|
noexcept |
Rotates the reference system about the y-axis with the right-hand rule. e.g. RotateAboutY(Point(1.0,0.0,0.0), pi/2) == Point(0.0,0.0,-1.0)
|
noexcept |
Rotates the reference system about the z-axis with the right-hand rule. e.g. RotateAboutZ(Point(0.0,1.0,0.0), pi/2) == Point(-1.0,0.0,0.0)
|
inline |
Equivalent to Matlab's round(input). This is faster than the standard C++ round function, especially on Windows. Returns an integer.
void mcl::Save | ( | const std::vector< Real > & | vector, |
const std::string & | file_name, | ||
const mcl::Int | precision = 5 |
||
) |
Writes the vector to a file. The separator is endline.
Int mcl::Sign | ( | const Real | scalar | ) |
Equivalent to Matlab's sign. Returns 1 if the element is greater than zero, 0 if it equals zero and -1 if it is less than zero.
|
noexcept |
Equivalent to Matlab's sin(vector)
|
noexcept |
Splits a string using a delimiter.
Real mcl::Sqrt | ( | Real | input | ) |
Square root function. Equivalent to Matlab's sqrt(input)
bool mcl::StatisticsOpTest | ( | ) |
|
noexcept |
Returns the standard deviation of the input
vector. Equivalent to Matlab's std(input). This includes the correction for having an unbiased estimator.
double mcl::StringToDouble | ( | const std::string & | s | ) |
Converts a string to a double
|
noexcept |
Returns the subset of elements with indexes from_index and to_index. Equivalent to Matlab's vector(from_index:to_index). (Careful about the different indexes convention between here and Matlab.
|
noexcept |
Returns the point by point subtraction of the two vectors. Equivalent to Matlab's vector_a-vector_b.
|
noexcept |
Subtracts the coordinates of point_a
from point_b
(point_a-point_b)
|
noexcept |
Sums the coordinates of point_a
and point_b
|
noexcept |
|
noexcept |
bool mcl::TransformOpTest | ( | ) |
|
noexcept |
Transposes the matrix. Equivalent to Matlab's matrix'
std::vector< double > mcl::TrinomialMultiply | ( | int | FilterOrder, |
std::vector< double > | b, | ||
std::vector< double > | c | ||
) |
|
noexcept |
|
noexcept |
Returns a vector with only one element.
|
noexcept |
Var (unbiased estimator)
|
noexcept |
Weighted var (biased estimator)
bool mcl::VectorOpTest | ( | ) |
Test function for the functions in this file
IirFilter mcl::WallFilter | ( | WallType | wall_type, |
Real | sampling_frequency | ||
) |
Get wall filters of type wall_type and for FS given by sampling_frequency
std::vector< Real > mcl::XCorr | ( | const std::vector< Real > & | vector_a, |
const std::vector< Real > & | vector_b | ||
) |
Equivalent to Matlab's xcorr(vect_a, vect_b)
|
noexcept |
Adds zero until the output vector has a length of total_length. If the length of input is smaller than total_length, than it returns the vector with the first total_length elements.
|
noexcept |
Returns a vector of zeros