codeare  1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Lapack.hpp File Reference
#include "Matrix.hpp"
#include "Algos.hpp"
#include "Creators.hpp"
#include "LapackTraits.hpp"
#include "CX.hpp"
#include <boost/tuple/tuple.hpp>
+ Include dependency graph for Lapack.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T , class S >
boost::tuple< Matrix< T >
, Matrix< S >, Matrix< T > > 
eig2 (const Matrix< T > &m, char jobvl= 'N', char jobvr= 'N')
 Eigenvalue decomposition. More...
 
Matrix< cxfleig (const Matrix< float > &m)
 
Matrix< cxdbeig (const Matrix< double > &m)
 
Matrix< cxfleig (const Matrix< cxfl > &m)
 
Matrix< cxdbeig (const Matrix< cxdb > &m)
 
template<class T , class S >
boost::tuple< Matrix< T >
, Matrix< S >, Matrix< T > > 
svd2 (const Matrix< T > &M, char jobz= 'N')
 Singular value decomposition. More...
 
Matrix< float > svd (const Matrix< float > &A)
 
Matrix< double > svd (const Matrix< double > &A)
 
Matrix< float > svd (const Matrix< cxfl > &A)
 
Matrix< double > svd (const Matrix< cxdb > &A)
 
template<class T >
Matrix< T > inv (const Matrix< T > &m)
 Invert quadratic well conditioned matrix. More...
 
template<class T >
Matrix< T > pinv (const Matrix< T > &m, char trans= 'N')
 Moore penrose pseudo-invert. More...
 
template<class T >
Matrix< T > chol (const Matrix< T > &A, char uplo= 'U')
 Cholesky decomposition of positive definite quadratic matrix. More...
 
template<class T >
Matrix< T > gemm (const Matrix< T > &A, const Matrix< T > &B, char transa= 'N', char transb= 'N')
 Matrix matrix multiplication. More...
 
template<class T >
Matrix< T > gemv (const Matrix< T > &A, const Matrix< T > &x, char trans= 'N')
 Matrix vector product A*x. More...
 
template<class T >
LapackTraits< T >::RType norm (const Matrix< T > &M, const char what= 'E')
 Frobenius norm. More...
 
template<class T >
dotc (const Matrix< T > &A, const Matrix< T > &B)
 Complex dot product (A'*B) on data vector. More...
 
template<class T >
DOTC (const Matrix< T > &A, const Matrix< T > &B)
 
template<class T >
dot (const Matrix< T > &A, const Matrix< T > &B)
 Dot product (A*B) on data vector. More...
 
template<class T >
DOT (const Matrix< T > &A, const Matrix< T > &B)
 

Function Documentation

template<class T >
Matrix<T> chol ( const Matrix< T > &  A,
char  uplo = 'U' 
)
inline

Cholesky decomposition of positive definite quadratic matrix.

Usage:

Matrix<cxfl> m = rand<cxfl> (20,10);
m = m.prodt(m); // m*m' Must be positive definite
m = chol (m);
See Also
LAPACK driver xPOTRF
Parameters
AIncoming matrix
uploUse upper/lower triangle for decomposition ('U': default/'L')
Returns
Cholesky decomposition

Definition at line 382 of file Lapack.hpp.

References A, Matrix< T, P, b >::Height(), info, is2d(), n, and Matrix< T, P, b >::Ptr().

+ Here is the call graph for this function:

template<class T >
T dot ( const Matrix< T > &  A,
const Matrix< T > &  B 
)
inline

Dot product (A*B) on data vector.

Usage:

Matrix<float> a = rand<float> (20,1);
Matrix<float> b = rand<float> (20,1);
float dotpr = dot (a, b);
Parameters
ALeft factor
BRight factor
Returns
A*B

Definition at line 598 of file Lapack.hpp.

References n, numel(), and Matrix< T, P, b >::Ptr().

Referenced by DOT().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
T DOT ( const Matrix< T > &  A,
const Matrix< T > &  B 
)
inline

Definition at line 615 of file Lapack.hpp.

References dot().

Referenced by Matrix< T, P, b >::dot().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
T dotc ( const Matrix< T > &  A,
const Matrix< T > &  B 
)
inline

Complex dot product (A'*B) on data vector.

Usage:

Matrix<cxdb> a = rand<cxdb> (20,1);
Matrix<cxdb> b = rand<cxdb> (20,1);
cxdb dotpr = dotc (a, b);
Parameters
ALeft factor (is conjugated)
BRight factor
Returns
A'*B

Definition at line 563 of file Lapack.hpp.

References n, numel(), and Matrix< T, P, b >::Ptr().

Referenced by DOTC().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
T DOTC ( const Matrix< T > &  A,
const Matrix< T > &  B 
)
inline

Definition at line 578 of file Lapack.hpp.

References dotc().

Referenced by Matrix< T, P, b >::dotc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Matrix<cxfl> eig ( const Matrix< float > &  m)
inline

Definition at line 115 of file Lapack.hpp.

References m.

Matrix<cxdb> eig ( const Matrix< double > &  m)
inline

Definition at line 118 of file Lapack.hpp.

References m.

Matrix<cxfl> eig ( const Matrix< cxfl > &  m)
inline

Definition at line 121 of file Lapack.hpp.

References m.

Matrix<cxdb> eig ( const Matrix< cxdb > &  m)
inline

Definition at line 124 of file Lapack.hpp.

References m.

template<class T , class S >
boost::tuple< Matrix<T>, Matrix<S>, Matrix<T> > eig2 ( const Matrix< T > &  m,
char  jobvl = 'N',
char  jobvr = 'N' 
)
inline

Eigenvalue decomposition.

Usage:

Matrix<cxfl> m = rand<cxfl> (10,10), ev;
boost::tuple<Matrix<float>,Matrix<cxfl>,Matrix<float>> ler
ler = eig2 (m);
lv = boost::get<0>(ler)
ev = boost::get<1>(ler);
rv = boost::get<2>(ler)

where m is the complex decomposed matrix, lv and rv are the left hand and right hand side eigen vectors and ev is the eigenvalue vector.

See Also
LAPACK driver xGEEV
Parameters
mMatrix for decomposition
jobvlCompute left vectors ('N'/'V')
jobvrCompute right vectors ('N'/'V')
Returns
Eigenvectors and values

Definition at line 56 of file Lapack.hpp.

References a, info, is_complex(), issquare(), lda, ldvl, ldvr, lwork, m, Vector< T, P >::ptr(), Matrix< T, P, b >::Ptr(), Vector< T, P >::resize(), rwork, size(), and work.

+ Here is the call graph for this function:

template<class T >
Matrix<T> gemm ( const Matrix< T > &  A,
const Matrix< T > &  B,
char  transa = 'N',
char  transb = 'N' 
)
inline

Matrix matrix multiplication.

Usage:

Matrix<cxfl> m = rand<cxfl> (20,10);
Matrix<cxfl> x = rand<cxfl> (10, 6);
m = gemm (m, b, 'N', 'C');
See Also
BLAS routine xGEMM
Parameters
ALeft factor
BRight factor
transa(N: A*... | T: A.'*... | C: A'*...) transpose left factor
transb(N: ...*B | T: ...*B.' | C: ...*B') transpose right factor
Returns
Product

Definition at line 426 of file Lapack.hpp.

References alpha, beta, is2d(), isvec(), k, m, n, Matrix< T, P, b >::Ptr(), size(), and transb.

Referenced by CSENSE< T >::Adjoint(), CGRAPPA< T >::CalcCalibMatrix(), cov(), MCGLS(), Matrix< T, P, b >::operator->*(), Matrix< T, P, b >::prod(), Matrix< T, P, b >::prodt(), and CGRAPPA< T >::Solve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
Matrix<T> gemv ( const Matrix< T > &  A,
const Matrix< T > &  x,
char  trans = 'N' 
)
inline

Matrix vector product A*x.

Usage:

Matrix<cxdb> A = rand<cxdb> (20,5);
Matrix<cxdb> x = rand<cxdb> (20,1);
double prod = gemv (A, x, 'C');
Parameters
AMatrix A
xVector x
transTranspose A?
Returns
A*x

Definition at line 493 of file Lapack.hpp.

References alpha, beta, is2d(), isvec(), m, n, Matrix< T, P, b >::Ptr(), size(), and y.

+ Here is the call graph for this function:

template<class T >
Matrix<T> inv ( const Matrix< T > &  m)
inline

Invert quadratic well conditioned matrix.

Usage:

Matrix<cxfl> m = rand<cxfl> (10,10);
m = inv (m);
See Also
Lapack xGETRF/xGETRI
Parameters
mMatrix
Returns
Inverse

Definition at line 259 of file Lapack.hpp.

References info, ipiv, issquare(), lwork, m, Vector< T, P >::ptr(), Matrix< T, P, b >::Ptr(), Vector< T, P >::resize(), size(), and work.

Referenced by CSENSE< T >::Adjoint(), and CGRAPPA< T >::Solve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
LapackTraits<T>::RType norm ( const Matrix< T > &  M,
const char  what = 'E' 
)
inline

Frobenius norm.

Usage:

Matrix<cxfl> m = rand<cxfl> (20,10);
float nm = norm (m); // Lapack driver below produces complex variable with real value
Parameters
MInput
whatWhich norm (E, F, 0, 1)
Returns
Eclidean norm ('E', default) 0, Frobenius, 1 ('0', 'F', '1')

Definition at line 538 of file Lapack.hpp.

References Matrix< T, P, b >::Container(), Matrix< T, P, b >::Ptr(), size(), and Matrix< T, P, b >::Size().

Referenced by MCGLS(), nrmse(), and CGRAPPA< T >::Solve().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class T >
Matrix<T> pinv ( const Matrix< T > &  m,
char  trans = 'N' 
)
inline

Moore penrose pseudo-invert.

Usage:

Matrix<cxfl> m = rand<cxfl> (10,6);
m = pinv (m);
See Also
Lapack xGELS
Parameters
mMatrix
transTranspose m before pinv?
Returns
Pseudo-inverse

Definition at line 320 of file Lapack.hpp.

References b, info, is2d(), lda, ldb, lwork, MAX, nrhs, Vector< T, P >::resize(), resize(), size(), and work.

Referenced by CSENSE< T >::Adjoint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Matrix<float> svd ( const Matrix< float > &  A)
inline

Definition at line 230 of file Lapack.hpp.

References A.

Matrix<double> svd ( const Matrix< double > &  A)
inline

Definition at line 233 of file Lapack.hpp.

References A.

Matrix<float> svd ( const Matrix< cxfl > &  A)
inline

Definition at line 236 of file Lapack.hpp.

References A.

Matrix<double> svd ( const Matrix< cxdb > &  A)
inline

Definition at line 239 of file Lapack.hpp.

References A.

template<class T , class S >
boost::tuple<Matrix<T>,Matrix<S>,Matrix<T> > svd2 ( const Matrix< T > &  M,
char  jobz = 'N' 
)
inline

Singular value decomposition.

Usage:

Matrix<cxfl> m = rand<cxfl> (20,10), u, v;
boost::tuple<Matrix<cxfl>, Matrix<float>, Matrix<cxfl>> usv;
usv = svd2 (m);
u = boost::get<0>(usv);
s = boost::get<1>(usv);
v = boost::get<2>(usv);

where m is the complex decomposed matrix, u and v are the left hand and right hand side singular vectors and s is the vector of real singular values.

See Also
LAPACK driver xGESDD
Parameters
mIncoming matrix
jobzComputation mode
'A': all m columns of U and all n rows of VT are returned in the arrays u and vt
'S', the first min(m, n) columns of U and the first min(m, n) rows of VT are returned in the arrays u and vt;
'O', then
    if m >= n, the first n columns of U are overwritten in the array a and all rows of VT are returned in the array vt;
    if m < n, all columns of U are returned in the array u and the first m rows of VT are overwritten in the array a;
'N', no columns of U or rows of VT are computed (default).
Returns
Signular vectors and values

Definition at line 162 of file Lapack.hpp.

References A, conj(), Matrix< T, P, b >::Height(), info, is2d(), iwork, lda, ldu, ldvt, lwork, m, MIN, n, Vector< T, P >::ptr(), Matrix< T, P, b >::Ptr(), Vector< T, P >::resize(), rwork, s, U, Matrix< T, P, b >::Width(), and work.

+ Here is the call graph for this function: