Functions on Matrices
[Base Module]

Functions on vectors and matrices. More...


Functions

template<class T >
int itpp::length (const Vec< T > &v)
 Length of vector.
template<class T >
int itpp::size (const Vec< T > &v)
 Length of vector.
template<class T >
itpp::sum (const Vec< T > &v)
 Sum of all elements in the vector.
template<class T >
Vec< T > itpp::sum (const Mat< T > &m, int dim=1)
 Sum of elements in the matrix m, either along columns or rows.
template<class T >
itpp::sumsum (const Mat< T > &X)
 Sum of all elements in the given matrix. Fast version of sum(sum(X)).
template<class T >
itpp::sum_sqr (const Vec< T > &v)
 Sum of square of the elements in a vector.
template<class T >
Vec< T > itpp::sum_sqr (const Mat< T > &m, int dim=1)
 Sum of the square of elements in the matrix m.
template<class T >
Vec< T > itpp::cumsum (const Vec< T > &v)
 Cumulative sum of all elements in the vector.
template<class T >
Mat< T > itpp::cumsum (const Mat< T > &m, int dim=1)
 Cumulative sum of elements in the matrix m.
template<class T >
itpp::prod (const Vec< T > &v)
 The product of all elements in the vector.
template<class T >
Vec< T > itpp::prod (const Mat< T > &m, int dim=1)
 Product of elements in the matrix m.
template<class T >
Vec< T > itpp::cross (const Vec< T > &v1, const Vec< T > &v2)
 Vector cross product. Vectors need to be of size 3.
template<class T >
Vec< T > itpp::zero_pad (const Vec< T > &v, int n)
 Zero-pad a vector to size n.
template<class T >
Vec< T > itpp::zero_pad (const Vec< T > &v)
 Zero-pad a vector to the nearest greater power of two.
template<class T >
Mat< T > itpp::zero_pad (const Mat< T > &m, int rows, int cols)
 Zero-pad a matrix to size rows x cols.
template<class T >
itpp::index_zero_pad (const Vec< T > &v, const int index)
template<class T >
void itpp::transpose (const Mat< T > &m, Mat< T > &out)
 Transposition of the matrix m returning the transposed matrix in out.
template<class T >
Mat< T > itpp::transpose (const Mat< T > &m)
 Transposition of the matrix m.
template<class T >
void itpp::hermitian_transpose (const Mat< T > &m, Mat< T > &out)
template<class T >
Mat< T > itpp::hermitian_transpose (const Mat< T > &m)
 Hermitian transpose (complex conjugate transpose) of the matrix m.
template<class Num_T >
bool itpp::is_hermitian (const Mat< Num_T > &X)
 Returns true if matrix X is hermitian, false otherwise.
template<class Num_T >
bool itpp::is_unitary (const Mat< Num_T > &X)
 Returns true if matrix X is unitary, false otherwise.
template<class Num_T >
Mat< Num_T > itpp::kron (const Mat< Num_T > &X, const Mat< Num_T > &Y)
 Computes the Kronecker product of two matrices.
cmat itpp::sqrtm (const cmat &A)
 Square root of the complex square matrix A.
cmat itpp::sqrtm (const mat &A)
 Square root of the real square matrix A.
template<class T >
int itpp::rank (const Mat< T > &m, double tol=-1.0)
 Calculate the rank of matrix m.
template<>
int itpp::rank (const imat &m, double tol)
 Specialisation of rank() function.
template<>
int itpp::rank (const smat &m, double tol)
 Specialisation of rank() function.
template<>
int itpp::rank (const bmat &, double)
 Specialisation of rank() function.
template<class T >
Vec< T > itpp::Vec::repmat (const Vec< T > &v, int n)
 Creates a vector with n copies of the vector v.
template<class T >
Mat< T > itpp::Mat::repmat (const Mat< T > &data, int m, int n)
 Creates a matrix with m by n copies of the matrix data.
template<class T >
Mat< T > itpp::Mat::repmat (const Vec< T > &v, int m, int n, bool transpose=false)
 Returns a matrix with m by n copies of the vector data.


Detailed Description

Functions on vectors and matrices.

Function Documentation

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

Cumulative sum of elements in the matrix m.

cumsum(m) = cumsum(m, 1) returns a matrix where the elements are sums over each column, whereas cumsum(m, 2) returns a matrix where the elements are sums over each row

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

Referenced by itpp::Histogram< Num_T >::get_cdf(), bdm::eEmp::resample(), bdm::egiwmix::sample(), and bdm::emix::sample().

template<class T >
void itpp::hermitian_transpose ( const Mat< T > &  m,
Mat< T > &  out 
) [inline]

Hermitian transpose (complex conjugate transpose) of the matrix m returning the transposed matrix in out

References itpp::Mat< Num_T >::H().

template<class T >
T itpp::index_zero_pad ( const Vec< T > &  v,
const int  index 
) [inline]

Return zero if indexing outside the vector v otherwise return the element index

References itpp::Vec< Num_T >::size().

Referenced by itpp::xcorr_old().

template<class Num_T >
bool itpp::is_hermitian ( const Mat< Num_T > &  X  )  [inline]

Returns true if matrix X is hermitian, false otherwise.

Author:
M. Szalay
A square matrix $\mathbf{X}$ is hermitian if

\[ \mathbf{X} = \mathbf{X}^H \]

References itpp::Mat< Num_T >::H().

template<class Num_T >
bool itpp::is_unitary ( const Mat< Num_T > &  X  )  [inline]

Returns true if matrix X is unitary, false otherwise.

Author:
M. Szalay
A square matrix $\mathbf{X}$ is unitary if

\[ \mathbf{X}^H = \mathbf{X}^{-1} \]

References itpp::Mat< Num_T >::H(), and itpp::inv().

template<class Num_T >
Mat<Num_T> itpp::kron ( const Mat< Num_T > &  X,
const Mat< Num_T > &  Y 
) [inline]

Computes the Kronecker product of two matrices.

K = kron(X, Y) returns the Kronecker tensor product of X and Y. The result is a large array formed by taking all possible products between the elements of X and those of Y. If X is (m x n) and Y is (p x q), then kron(X, Y) is (m*p x n*q).

Author:
Adam Piatyszek

References itpp::Mat< Num_T >::cols(), and itpp::Mat< Num_T >::rows().

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

Product of elements in the matrix m.

prod(m) = prod(m, 1) returns a vector where the elements are products over each column, whereas prod(m, 2) returns a vector where the elements are products over each row

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

Referenced by itpp::fact(), and itpp::geometric_mean().

template<class T >
int itpp::rank ( const Mat< T > &  m,
double  tol = -1.0 
) [inline]

Calculate the rank of matrix m.

Author:
Martin Senst
Parameters:
m Input matrix
tol Tolerance used for comparing the singular values with zero. If negative, it is automatically determined.

References itpp::Mat< Num_T >::cols(), itpp::Mat< Num_T >::rows(), and itpp::svd().

template<class T >
Mat< T > repmat ( const Vec< T > &  v,
int  m,
int  n,
bool  transpose = false 
) [related, inherited]

Returns a matrix with m by n copies of the vector data.

Author:
Adam Piatyszek
Parameters:
v Vector to be repeated
m Number of times to repeat data vertically
n Number of times to repeat data horizontally
transpose Specifies the input vector orientation (column vector by default)

References itpp::Vec< Num_T >::T(), and itpp::transpose().

template<class T >
Mat< T > repmat ( const Mat< T > &  data,
int  m,
int  n 
) [related, inherited]

Creates a matrix with m by n copies of the matrix data.

Author:
Mark Dobossy
Parameters:
data Matrix to be repeated
m Number of times to repeat data vertically
n Number of times to repeat data horizontally

References itpp::Mat< Num_T >::cols(), it_assert, itpp::Mat< Num_T >::rows(), and itpp::Mat< Num_T >::set_submatrix().

template<class T >
Vec< T > repmat ( const Vec< T > &  v,
int  n 
) [related, inherited]

Creates a vector with n copies of the vector v.

Author:
Martin Senst
Parameters:
v Vector to be repeated
n Number of times to repeat v

References it_assert, itpp::Vec< Num_T >::length(), and itpp::Vec< Num_T >::set_subvector().

cmat itpp::sqrtm ( const mat A  ) 

Square root of the real square matrix A.

This function computes the matrix square root of the real square matrix A. Please note that the returned matrix is complex. The implementation is based on the Matlab/Octave sqrtm() function.

Ref: N. J. Higham, "Numerical Analysis Report No. 336", Manchester Centre for Computational Mathematics, Manchester, England, January 1999

Author:
Adam Piatyszek

cmat itpp::sqrtm ( const cmat A  ) 

Square root of the complex square matrix A.

This function computes the matrix square root of the complex square matrix A. The implementation is based on the Matlab/Octave sqrtm() function.

Ref: N. J. Higham, "Numerical Analysis Report No. 336", Manchester Centre for Computational Mathematics, Manchester, England, January 1999

Author:
Adam Piatyszek

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

Sum of elements in the matrix m, either along columns or rows.

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

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

Referenced by bdm::egiwmix::approx(), bdm::PF::bayes(), bdm::MultiModel::bayes(), itpp::Channel_Specification::calc_mean_excess_delay(), itpp::Channel_Specification::calc_rms_delay_spread(), itpp::LDPC_Parity_Unstructured::compute_CR(), itpp::Modulator_NCD::demodulate_soft_bits(), itpp::Modulator_NRD::demodulate_soft_bits(), itpp::LDPC_Parity::display_stats(), itpp::BERC::estimate_delay(), bdm::emix::evallog(), itpp::fir1(), bdm::multiBM::flatten(), itpp::LDPC_Parity_Regular::generate(), itpp::Rice_Fading_Generator::generate(), itpp::LDPC_Parity_Unstructured::generate_random_H(), itpp::house(), ldmat::ldform(), itpp::MOG_generic::lhood_internal(), itpp::MOG_diag::lhood_internal(), itpp::MOG_generic::log_lhood_internal(), itpp::MOG_diag::log_lhood_internal(), bdm::eDirich::lognc(), bdm::egiw::lognc(), bdm::merger::lognorm_merge(), itpp::mean(), bdm::eDirich::mean(), bdm::merger::merge(), itpp::MOG_diag_EM_sup::ml_update_params(), itpp::Modulator_NCD::modulate_bits(), itpp::Modulator_NRD::modulate_bits(), itpp::norm(), ldmat::qform(), itpp::quad(), bdm::egiwmix::set_parameters(), bdm::emix::set_parameters(), bdm::eEmp::set_samples(), bdm::eEmp::set_statistics(), itpp::MOG_generic::setup_weights(), itpp::ND_UPAM::sphere_decoding(), itpp::Sparse_Vec< T >::sqr(), ldmat::to_mat(), itpp::trace(), itpp::variance(), bdm::eDirich::variance(), and itpp::xcorr().

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

Sum of the square of elements in the matrix m.

sum(m) = sum(m, 1) returns a vector where the elements are sum squared over each column, whereas sum(m, 2) returns a vector where the elements are sum squared over each row

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

Referenced by itpp::TDL_Channel::calc_mean_excess_delay(), itpp::TDL_Channel::calc_rms_delay_spread(), and bdm::merger::merge().


Generated on Tue Jun 2 10:02:14 2009 for mixpp by  doxygen 1.5.8