IT++ Logo

Miscellaneous Functions
[Basic and Miscellaneous Math Functions]


Functions

template<typename T>
Vec< T > itpp::apply_function (T(*f)(T), const Vec< T > &v)
 Help function to call for a function: Vec<T> function(Vec<T>).
template<typename T>
Vec< T > itpp::apply_function (T(*f)(const T &), const Vec< T > &v)
 Help function to call for a function: Vec<T> function(const Vec<T>&).
template<typename T>
Mat< T > itpp::apply_function (T(*f)(T), const Mat< T > &m)
 Help function to call for a function: Mat<T> function(Mat<T>&).
template<typename T>
Mat< T > itpp::apply_function (T(*f)(const T &), const Mat< T > &m)
 Help function to call for a function: Mat<T> function(const Mat<T>&).
template<typename T>
Vec< T > itpp::apply_function (T(*f)(T, T), const T &x, const Vec< T > &v)
 Help function to call for a function: Vec<T> function(T, Vec<T>).
template<typename T>
Vec< T > itpp::apply_function (T(*f)(const T &, const T &), const T &x, const Vec< T > &v)
 Help function to call for a function: Vec<T> function(const T&, const Vec<T>&).
template<typename T>
Mat< T > itpp::apply_function (T(*f)(T, T), const T &x, const Mat< T > &m)
 Help function to call for a function: Mat<T> function(T, Mat<T>).
template<typename T>
Mat< T > itpp::apply_function (T(*f)(const T &, const T &), const T &x, const Mat< T > &m)
 Help function to call for a function: Mat<T> function(const T&, const Mat<T>&).
template<typename T>
Vec< T > itpp::apply_function (T(*f)(T, T), const Vec< T > &v, const T &x)
 Help function to call for a function: Vec<T> function(Vec<T>, T).
template<typename T>
Vec< T > itpp::apply_function (T(*f)(const T &, const T &), const Vec< T > &v, const T &x)
 Help function to call for a function: Vec<T> function(const Vec<T>&, const T&).
template<typename T>
Mat< T > itpp::apply_function (T(*f)(T, T), const Mat< T > &m, const T &x)
 Help function to call for a function: Mat<T> function(Mat<T>, T).
template<typename T>
Mat< T > itpp::apply_function (T(*f)(const T &, const T &), const Mat< T > &m, const T &x)
 Help function to call for a function: Mat<T> function(const Mat<T>&, const T&).
ivec itpp::find (const bvec &invector)
 Return a integer vector with indicies where bvec == 1.
mat itpp::rotation_matrix (int dim, int plane1, int plane2, double angle)
 Create a rotation matrix that rotates the given plane angle radians. Note that the order of the planes are important!
void itpp::house (const vec &x, vec &v, double &beta)
 Calcualte the Householder vector.
void itpp::givens (double a, double b, double &c, double &s)
 Calculate the Givens rotation values.
void itpp::givens (double a, double b, mat &m)
 Calculate the Givens rotation matrix.
mat itpp::givens (double a, double b)
 Calculate the Givens rotation matrix.
void itpp::givens_t (double a, double b, mat &m)
 Calculate the transposed Givens rotation matrix.
mat itpp::givens_t (double a, double b)
 Calculate the transposed Givens rotation matrix.
double tgamma (double x)
 True gamma function.
double lgamma (double x)
 Lograrithm of an absolute gamma function.
double cbrt (double x)
 Cubic root.
double itpp::sqr (double x)
 Square of x.
double itpp::sqr (const std::complex< double > &x)
 Square of complex-valued x, ||x||^2.
vec itpp::sqr (const vec &x)
 Square of elements.
mat itpp::sqr (const mat &x)
 Square of elements.
vec itpp::sqr (const cvec &x)
 Square of elements.
mat itpp::sqr (const cmat &x)
 Square of elements.
vec itpp::abs (const vec &x)
 Absolute value.
mat itpp::abs (const mat &x)
 Absolute value.
ivec itpp::abs (const ivec &x)
 Absolute value.
imat itpp::abs (const imat &x)
 Absolute value.
vec itpp::abs (const cvec &x)
 Absolute value.
mat itpp::abs (const cmat &x)
 Absolute value.
double itpp::sign (double x)
 Signum function.
vec itpp::sign (const vec &x)
 Signum function.
mat itpp::sign (const mat &x)
 Signum function.
double itpp::sgn (double x)
 Signum function.
vec itpp::sgn (const vec &x)
 Signum function.
mat itpp::sgn (const mat &x)
 Signum function.
int itpp::sign_i (int x)
 Signum function.
ivec itpp::sign_i (const ivec &x)
 Signum function.
imat itpp::sign_i (const imat &x)
 Signum function.
int itpp::sgn_i (int x)
 Signum function.
ivec itpp::sgn_i (const ivec &x)
 Signum function.
imat itpp::sgn_i (const imat &x)
 Signum function.
int itpp::sign_i (double x)
 Signum function.
vec itpp::sqrt (const vec &x)
 Square root of the elements.
mat itpp::sqrt (const mat &x)
 Square root of the elements.
double itpp::gamma (double x)
 Gamma function.
vec itpp::gamma (const vec &x)
 The gamma function.
mat itpp::gamma (const mat &x)
 The gamma function.
double itpp::rem (double x, double y)
 The reminder of the division x/y.
vec itpp::rem (const vec &x, double y)
 Elementwise reminder of the division x/y for vec and double.
vec itpp::rem (double x, const vec &y)
 Elementwise reminder of the division x/y for double and vec.
mat itpp::rem (const mat &x, double y)
 Elementwise reminder of the division x/y for mat and double.
mat itpp::rem (double x, const mat &y)
 Elementwise reminder of the division x/y for double and mat.
int itpp::mod (int k, int n)
 Calculates the modulus, i.e. the signed reminder after division.
double itpp::fact (int index)
 Calculates factorial coefficient for index <= 170.
double itpp::binom (int n, int k)
 Compute the binomial coefficient "n over k".
int itpp::binom_i (int n, int k)
 Compute the binomial coefficient "n over k".
double itpp::log_binom (int n, int k)
 Compute the base 10 logarithm of the binomial coefficient "n over k".
int itpp::gcd (int a, int b)
 Compute the greatest common divisor (GCD) g of the elements a and b.
vec itpp::real (const cvec &x)
 Real part of complex values.
mat itpp::real (const cmat &x)
 Real part of complex values.
vec itpp::imag (const cvec &x)
 Imaginary part of complex values.
mat itpp::imag (const cmat &x)
 Imaginary part of complex values.
vec itpp::arg (const cvec &x)
 Argument (angle).
mat itpp::arg (const cmat &x)
 Argument (angle).
vec itpp::angle (const cvec &x)
 Angle.
mat itpp::angle (const cmat &x)
 Angle.
cvec itpp::conj (const cvec &x)
 Conjugate of complex value.
cmat itpp::conj (const cmat &x)
 Conjugate of complex value.
template<class T>
itpp::max (const Vec< T > &v)
 Maximum value of vector.
template<class T>
itpp::max (const Vec< T > &v, int &index)
 Maximum value of vector, also returns the index position of max value.
template<class T>
Vec< T > itpp::max (const Mat< T > &m, int dim=1)
template<class T>
Vec< T > itpp::max (const Mat< T > &m, ivec &index, int dim=1)
template<class T>
itpp::min (const Vec< T > &in)
 Minimum value of vector.
template<class T>
itpp::min (const Vec< T > &in, int &index)
 Minimum value of vector, also returns the index position of min value.
template<class T>
Vec< T > itpp::min (const Mat< T > &m, int dim=1)
template<class T>
Vec< T > itpp::min (const Mat< T > &m, ivec &index, int dim=1)
template<class T>
int itpp::max_index (const Vec< T > &in)
 Return the postion of the maximum element in the vector.
template<class T>
void itpp::max_index (const Mat< T > &m, int &row, int &col)
 Return the postion of the maximum element in the matrix.
template<class T>
int itpp::min_index (const Vec< T > &in)
 Return the postion of the minimum element in the vector.
template<class T>
void itpp::min_index (const Mat< T > &m, int &row, int &col)
 Return the postion of the minimum element in the matrix.
bool itpp::is_int (double x)
 Return true if x is an integer.
bool itpp::is_even (int x)
 Return true if x is an even integer.
std::string itpp::itpp_version ()
 Returns IT++ library version number, e.g. "3.7.1".
bool itpp::check_big_endianness ()
 Returns machine endianness: big-endian = true; little-endian = false.
int isnan (double x)
 Check if x is NaN (Not a Number).
int isinf (double x)
 Check if x is either -Inf or +Inf.
int finite (double x)
 Check if x is a finite floating point number.
int isfinite (double x)
 Check if x is a finite floating point number.

Variables

int signgam
 Global variable needed by lgamma function.


Function Documentation

int itpp::gcd ( int  a,
int  b 
)

Compute the greatest common divisor (GCD) g of the elements a and b.

a and b must be non-negative integers. gdc(0, 0) is 0 by convention; all other GCDs are positive integers.

Definition at line 169 of file elem_math.cpp.

References it_assert.

Referenced by itpp::Turbo_Codec::wcdma_turbo_interleaver_sequence().

template<class T>
Vec<T> itpp::max ( const Mat< T > &  m,
int  dim = 1 
) [inline]

Maximum values over each row/column in the matrix m

max(m) = max(m, 1) returns a vector where the elements are maximum over each column, whereas max(m, 2) returns a vector where the elements are maximum over each row.

Definition at line 76 of file min_max.h.

References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::get_col(), itpp::Mat< Num_T >::get_row(), it_assert, itpp::max(), itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::set_size().

template<class T>
Vec<T> itpp::max ( const Mat< T > &  m,
ivec index,
int  dim = 1 
) [inline]

Maximum values over each row/column in the matrix m

max(m) = max(m, 1) returns a vector where the elements are maximum over each column, whereas max(m, 2) returns a vector where the elements are maximum over each row.

Also returns a vector of indices with positions of maximum value within a column/row.

Definition at line 104 of file min_max.h.

References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::get_col(), itpp::Mat< Num_T >::get_row(), it_assert, itpp::max(), itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::set_size().

template<class T>
Vec<T> itpp::min ( const Mat< T > &  m,
int  dim = 1 
) [inline]

Minimum values over each row/column in the matrix m

min(m) = min(m, 1) returns a vector where the elements are minimum over each column, whereas min(m, 2) returns a vector where the elements are minimum over each row.

Definition at line 157 of file min_max.h.

References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::get_col(), itpp::Mat< Num_T >::get_row(), it_assert, itpp::min(), itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::set_size().

template<class T>
Vec<T> itpp::min ( const Mat< T > &  m,
ivec index,
int  dim = 1 
) [inline]

Minimum values over each row/column in the matrix m

min(m) = min(m, 1) returns a vector where the elements are minimum over each column, whereas min(m, 2) returns a vector where the elements are minimum over each row.

Also returns a vector of indices with positions of minimum value within a column/row.

Definition at line 186 of file min_max.h.

References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::get_col(), itpp::Mat< Num_T >::get_row(), it_assert, itpp::min(), itpp::Mat< Num_T >::rows(), and itpp::Vec< Num_T >::set_size().

int isnan ( double  x  )  [inline]

Check if x is NaN (Not a Number).

Note:
Emulation of a C99 function via the IEEE 754 standard

Definition at line 143 of file misc.h.

Referenced by finite().

int isinf ( double  x  )  [inline]

Check if x is either -Inf or +Inf.

Returns -1 if x is -Inf or +1 if x is +Inf. Otherwise returns 0.

Note:
Emulation of a C99 function via the IEEE 754 standard

Definition at line 158 of file misc.h.

Referenced by finite().

int finite ( double  x  )  [inline]

Check if x is a finite floating point number.

Note:
Emulation of a C99 function via the IEEE 754 standard

Definition at line 171 of file misc.h.

References isinf(), and isnan().

Referenced by isfinite(), itpp::MOG_generic::set_diag_covs_internal(), itpp::MOG_generic::set_full_covs_internal(), itpp::MOG_generic::set_means_internal(), and itpp::MOG_generic::set_weights_internal().

int isfinite ( double  x  )  [inline]

Check if x is a finite floating point number.

Note:
Emulation of a C99 function via the IEEE 754 standard

Definition at line 183 of file misc.h.

References finite().

SourceForge Logo

Generated on Sun Sep 14 18:54:58 2008 for IT++ by Doxygen 1.5.6