IT++ Logo Newcom Logo

matfunc.h File Reference

Definitions of functions on vectors and matrices. More...

#include <itpp/base/vec.h>
#include <itpp/base/mat.h>

Go to the source code of this file.

Namespaces

namespace  itpp

Functions

template<class T>
int length (const Vec< T > &v)
 Length of vector.
template<class T>
int size (const Vec< T > &v)
 Length of vector.
template<class T>
sum (const Vec< T > &v)
 Sum of all elements in the vector.
template<class T>
Vec< T > sum (const Mat< T > &m, int dim=1)
 Sum of elements in the matrix m.
template<class T>
sum_sqr (const Vec< T > &v)
 Sum of square of the elements in a vector.
template<class T>
Vec< T > sum_sqr (const Mat< T > &m, int dim=1)
 Sum of the square of elements in the matrix m.
template<class T>
Vec< T > cumsum (const Vec< T > &v)
 Cumulative sum of all elements in the vector.
template<class T>
Mat< T > cumsum (const Mat< T > &m, int dim=1)
 Cumulative sum of elements in the matrix m.
template<class T>
prod (const Vec< T > &v)
 The product of all elements in the vector.
template<class T>
Vec< T > prod (const Mat< T > &m, int dim=1)
 Product of elements in the matrix m.
template<class T>
Vec< T > cross (const Vec< T > &v1, const Vec< T > &v2)
 Vector cross product. Vectors need to be of size 3.
template<class T, class fT>
Vec< T > apply_function (fT(*f)(fT), const Vec< T > &data)
 Apply arbitrary function to a vector.
template<class T, class fT>
Mat< T > apply_function (fT(*f)(fT), const Mat< T > &data)
 Apply arbitrary functions to a matrix.
template<class T>
Vec< T > zero_pad (const Vec< T > &v, int n)
 Zero-pad a vector to size n.
template<class T>
Vec< T > zero_pad (const Vec< T > &v)
 Zero-pad a vector to the nearest greater power of two.
template<class T>
Mat< T > zero_pad (const Mat< T > &m, int rows, int cols)
 Zero-pad a matrix to size rows x cols.
template<class T>
index_zero_pad (const Vec< T > &v, const int index)
template<class T>
void transpose (const Mat< T > &m, Mat< T > &out)
 Transposition of the matrix m returning the transposed matrix in out.
template<class T>
Mat< T > transpose (const Mat< T > &m)
 Transposition of the matrix m.
template<class T>
void hermitian_transpose (const Mat< T > &m, Mat< T > &out)
template<class T>
Mat< T > hermitian_transpose (const Mat< T > &m)
 Hermitian transpose (complex conjugate transpose) of the matrix m.
template<class Num_T>
bool is_hermitian (const Mat< Num_T > &X)
 Returns true if matrix X is hermitian, false otherwise.
template<class Num_T>
bool is_unitary (const Mat< Num_T > &X)
 Returns true if matrix X is unitary, false otherwise.
template<class Num_T>
Mat< Num_T > kron (const Mat< Num_T > &X, const Mat< Num_T > &Y)
 Computes the Kronecker product of two matrices.
template<class T>
Mat< T > diag (const Vec< T > &v, const int K=0)
 Returns a diagonal matrix whith the elements of the vector v on the diagonal and zeros elsewhere.
template<class T>
void diag (const Vec< T > &v, Mat< T > &m)
 Returns in the output wariable m a diagonal matrix whith the elements of the vector v on the diagonal and zeros elsewhere.
template<class T>
Vec< T > diag (const Mat< T > &m)
 Returns the diagonal elements of the input matrix m.
template<class T>
Mat< T > bidiag (const Vec< T > &main, const Vec< T > &sup)
 Returns a matrix with the elements of the input vector main on the diagonal and the elements of the input vector sup on the diagonal row above.
template<class T>
void bidiag (const Vec< T > &main, const Vec< T > &sup, Mat< T > &m)
 Returns in the output variable m a matrix with the elements of the input vector main on the diagonal and the elements of the input vector sup on the diagonal row above.
template<class T>
void bidiag (const Mat< T > &m, Vec< T > &main, Vec< T > &sup)
 Returns the main diagonal and the diagonal row above in the two output vectors main and sup.
template<class T>
Mat< T > tridiag (const Vec< T > &main, const Vec< T > &sup, const Vec< T > &sub)
 Returns a matrix with the elements of main on the diagonal, the elements of sup on the diagonal row above, and the elements of sub on the diagonal row below.
template<class T>
void tridiag (const Vec< T > &main, const Vec< T > &sup, const Vec< T > &sub, Mat< T > &m)
 Returns in the output matrix m a matrix with the elements of main on the diagonal, the elements of sup on the diagonal row above, and the elements of sub on the diagonal row below.
template<class T>
void tridiag (const Mat< T > &m, Vec< T > &main, Vec< T > &sup, Vec< T > &sub)
 Returns the main diagonal, the diagonal row above, and the diagonal row below in the output vectors main, sup, and sub.
template<class T>
trace (const Mat< T > &m)
 The trace of the matrix m, i.e. the sum of the diagonal elements.
template<class T>
Vec< T > reverse (const Vec< T > &in)
 Reverse the input vector.
template<class T>
Vec< T > rvectorize (const Mat< T > &m)
 Row vectorize the matrix [(0,0) (0,1) ... (N-1,N-2) (N-1,N-1)].
template<class T>
Vec< T > cvectorize (const Mat< T > &m)
 Column vectorize the matrix [(0,0) (1,0) ... (N-2,N-1) (N-1,N-1)].
template<class T>
Mat< T > reshape (const Mat< T > &m, int rows, int cols)
 Reshape the matrix into an rows*cols matrix.
template<class T>
Mat< T > reshape (const Vec< T > &v, int rows, int cols)
 Reshape the vector into an rows*cols matrix.
template<class T>
Vec< T > repeat (const Vec< T > &v, int norepeats)
 Repeat each element in the vector norepeats times in sequence.
template<class T>
Mat< T > repeat (const Mat< T > &m, int norepeats)
 Repeats each column norepeats times in sequence.
template<class T>
void upsample (const Vec< T > &v, int usf, Vec< T > &u)
 Upsample a vector by inserting (usf-1) zeros after each sample.
template<class T>
Vec< T > upsample (const Vec< T > &v, int usf)
 Upsample a vector by inserting (usf-1) zeros after each sample.
template<class T>
void upsample (const Mat< T > &v, int usf, Mat< T > &u)
 Upsample each column by inserting (usf-1) zeros after each column.
template<class T>
Mat< T > upsample (const Mat< T > &v, int usf)
 Upsample each column by inserting (usf-1) zeros after each column.
template<class T>
void lininterp (const Mat< T > &m, int usf, Mat< T > &u)
 Upsample each column by a factor of (usf-1) by linear interpolation.
template<class T>
Mat< T > lininterp (const Mat< T > &m, const double f_base, const double f_ups, const int nrof_samples, const double t_start=0)
 Upsample each column of matrix m to achieve f_ups frequency using linear interpolation.
template<class T>
Mat< T > lininterp (const Mat< T > &m, int usf)
 Upsample each column by a factor of (usf-1) by linear interpolation.
template<class T>
void lininterp (const Vec< T > &v, int usf, Vec< T > &u)
 Upsample by a factor of (usf-1) by linear interpolation.
template<class T>
Vec< T > lininterp (const Vec< T > &v, int usf)
 Upsample by a factor of (usf-1) by linear interpolation.
template<class T>
Vec< T > lininterp (const Vec< T > &v, const double f_base, const double f_ups, const int nrof_samples, const double t_start=0)
 Upsample each sample of vector v to achieve f_ups frequency using linear interpolation.
template bool is_hermitian (const mat &X)
 Extern Template instantiation of is_hermitian.
template bool is_hermitian (const cmat &X)
 Extern Template instantiation of is_hermitian.
template bool is_unitary (const mat &X)
 Extern Template instantiation of is_unitary.
template bool is_unitary (const cmat &X)
 Extern Template instantiation of is_unitary.


Detailed Description

Definitions of functions on vectors and matrices.

Author:
Tony Ottosson and Adam Piatyszek
Date
2007-06-29 14:02:44 +0200 (Fri, 29 Jun 2007)
Revision
1079

-------------------------------------------------------------------------

IT++ - C++ library of mathematical, signal processing, speech processing, and communications classes and functions

Copyright (C) 1995-2007 (see AUTHORS file for a list of contributors)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

-------------------------------------------------------------------------

Definition in file matfunc.h.


Function Documentation

template bool is_hermitian const mat &  X  ) 
 

Extern Template instantiation of is_hermitian.

template bool is_hermitian const cmat &  X  ) 
 

Extern Template instantiation of is_hermitian.

template bool is_unitary const mat &  X  ) 
 

Extern Template instantiation of is_unitary.

template bool is_unitary const cmat &  X  ) 
 

Extern Template instantiation of is_unitary.

SourceForge Logo

Generated on Fri Jan 11 08:51:39 2008 for IT++ by Doxygen 1.3.9.1