matfunc.h File Reference

Various functions on vectors and matrices - header file. More...

`#include <itpp/base/mat.h>`
`#include <itpp/base/math/log_exp.h>`
`#include <itpp/base/math/elem_math.h>`
`#include <itpp/base/algebra/inv.h>`
`#include <itpp/base/algebra/svd.h>`
`#include <itpp/itexports.h>`

Go to the source code of this file.

## Namespaces

namespace | itpp
| itpp namespace

## 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 >
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 >
T | itpp::sumsum (const Mat< T > &X)
| Sum of all elements in the given matrix. Fast version of sum(sum(X))
template<class T >
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 >
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 >
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.
ITPP_EXPORT cmat | itpp::sqrtm (const cmat &A)
| Square root of the complex square matrix `A`.
ITPP_EXPORT 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 >
Mat< T > | itpp::diag (const Vec< T > &v, const int K=0)
| Create a diagonal matrix using vector `v` as its diagonal.
template<class T >
void | itpp::diag (const Vec< T > &v, Mat< T > &m)
| Create a diagonal matrix using vector `v` as its diagonal.
template<class T >
Vec< T > | itpp::diag (const Mat< T > &m)
| Get the diagonal elements of the input matrix `m`.
template<class T >
Mat< T > | itpp::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 | itpp::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 | itpp::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 > | itpp::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 | itpp::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 | itpp::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 int the output vectors `main`, `sup`, and `sub`.
template<class T >
T | itpp::trace (const Mat< T > &m)
| The trace of the matrix `m`, i.e. the sum of the diagonal elements.
template<class T >
Vec< T > | itpp::reverse (const Vec< T > &in)
| Reverse the input vector.
template<class T >
Vec< T > | itpp::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 > | itpp::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 > | itpp::reshape (const Mat< T > &m, int rows, int cols)
| Reshape the matrix into an rows*cols matrix.
template<class T >
Mat< T > | itpp::reshape (const Vec< T > &v, int rows, int cols)
| Reshape the vector into an rows*cols matrix.
ITPP_EXPORT bool | itpp::all (const bvec &testvec)
| Returns true if all elements are ones and false otherwise.
ITPP_EXPORT bool | itpp::any (const bvec &testvec)
| Returns true if any element is one and false otherwise.

## Detailed Description

Various functions on vectors and matrices - header file.

Author
  Tony Ottosson, Adam Piatyszek, Conrad Sanderson, Mark Dobossy and Martin Senst

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

This file is part of IT++ - a C++ library of mathematical, signal processing, speech processing, and communications classes and functions.

IT++ 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 3 of the License, or (at your option) any later version.

IT++ 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 IT++. If not, see http://www.gnu.org/licenses/.

Definition in file matfunc.h.

Generated on Mon Jun 10 2024 11:49:26 for IT++ by Doxygen 1.9.8