casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Macros | Functions
MatrixMath.h File Reference
#include <casa/aips.h>
#include <casa/BasicSL/Complex.h>

Go to the source code of this file.

Classes

class  LUdecomp< T >
 On suns, at least, this needs to link with: lapack.a blas.a Since this links fortran libraries, check also whether "underscores" are needed for FORTRAN on your machine, and whether a FORTRAN MAIN is needed to initialize the fortran libraries (as it is on suns). More...
 

Macros

#define AIPS_ARRAY_INDEX_CHECK
 

Functions

template<class T >
innerProduct (const casacore::Vector< T > &x, const casacore::Vector< T > &y)
 
template<class T >
norm (const casacore::Vector< T > &x)
 The magnitude/norm of a vector. More...
 
template<class T >
casacore::Matrix< T > Rot3D (casacore::Int axis, T angle)
 Create a 3D rotation matrix (3x3). More...
 
template<class T >
casacore::Vector< T > crossProduct (const casacore::Vector< T > &x, const casacore::Vector< T > &y)
 The vector/cross product of two 3-space vectors. More...
 
template<class T >
casacore::Matrix< T > product (const casacore::Vector< T > &x, const casacore::Matrix< T > &yT)
 The matrix/outer product of a vector and a transposed vector. More...
 
template<class T >
casacore::Matrix< T > outerProduct (const casacore::Vector< T > &x, const casacore::Matrix< T > &yT)
 
template<class T >
casacore::Vector< T > product (const casacore::Matrix< T > &A, const casacore::Vector< T > &x)
 The vector/outer product of an MxN matrix and an N-length vector. More...
 
template<class T >
casacore::Vector< T > outerProduct (const casacore::Matrix< T > &A, const casacore::Vector< T > &x)
 
template<class T >
casacore::Matrix< T > product (const casacore::Matrix< T > &A, const casacore::Matrix< T > &B)
 The matrix multiplication or cayley product of an MxN matrix and an NxP matrix. More...
 
template<class T >
casacore::Matrix< T > cayleyProduct (const casacore::Matrix< T > &A, const casacore::Matrix< T > &B)
 
template<class T >
casacore::Matrix< T > transpose (const casacore::Matrix< T > &A)
 The NxM transpose of an MxN matrix. More...
 
Matrix< casacore::Complex > conjugate (const casacore::Matrix< casacore::Complex > &A)
 
complex space function specifications
More...
 
Matrix< casacore::DComplex > conjugate (const casacore::Matrix< casacore::DComplex > &A)
 The complex conjugate of the double precision complex matrix A. More...
 
Matrix< casacore::Complex > adjoint (const casacore::Matrix< casacore::Complex > &A)
 The conjugate/transpose or adjoint of the complex matrix A. More...
 
Matrix< casacore::DComplex > adjoint (const casacore::Matrix< casacore::DComplex > &A)
 The conjugate/transpose or adjoint of the double precision complex matrix A. More...
 
template<class T >
casacore::Matrix< T > inverse (const casacore::Matrix< T > &A)
 
template<class T >
casacore::Matrix< T > inverse (const LUdecomp< T > &LU)
 The inverse of an LUdecomp which is the Lower/upper decomposition of a matrix A. More...
 
template<class T >
determinant (const casacore::Matrix< T > &A)
 The determinant of a matrix;
Note: The LU decomposition of the matrix is a hidden calculation;
More...
 
template<class T >
determinant (const LUdecomp< T > &LU)
 the determinant (A) of an LUdecomp which is the lower/upper decomposition of a matrix A. More...
 
template<class T >
casacore::Vector< T > solve (const casacore::Matrix< T > &A, const casacore::Vector< T > &y, double &ferr, double &berr)
 Given a matrix "A", and given some vector "y" which is the right hand side of the equation "Ax=y", then "solve(A, y, error1, error2)" returns the computed vector "x". More...
 
template<class T >
casacore::Vector< T > solve (const LUdecomp< T > &myLU, const casacore::Vector< T > &y, double &ferr, double &berr)
 Given an LUdecomp "myLU" which is the LU decomposition of some matrix "A", and given some vector "y" which is the right hand side of the equation "Ax=y", then "solve(myLU, y, error1, error2)" returns the computed vector "x". More...
 
template<class T >
casacore::Matrix< T > solve (const casacore::Matrix< T > &A, const casacore::Matrix< T > &B, casacore::Vector< double > &Ferr, casacore::Vector< double > &Berr)
 Given a matrix "A", and given a matrix "B" whose columns are the stored set of vectors "y1", "y2",..."yN" which are independent right hand sides to the equation "Ax", e.g. More...
 
template<class T >
casacore::Matrix< T > solve (const LUdecomp< T > &myLU, const casacore::Matrix< T > &B, casacore::Vector< double > &Ferr, casacore::Vector< double > &Berr)
 Given an LUdecomp "myLU" which is the LU decomposition of some matrix "A", and given a matrix "B" whose columns are the stored set of vectors "y1", "y2",..."yN" which are independent right hand sides to the equation "Ax", e.g. More...
 

Macro Definition Documentation

#define AIPS_ARRAY_INDEX_CHECK

Definition at line 33 of file MatrixMath.h.

Function Documentation

Matrix<casacore::Complex> adjoint ( const casacore::Matrix< casacore::Complex > &  A)

The conjugate/transpose or adjoint of the complex matrix A.

Matrix<casacore::DComplex> adjoint ( const casacore::Matrix< casacore::DComplex > &  A)

The conjugate/transpose or adjoint of the double precision complex matrix A.

/div>

Requires linking of the LAPACK libraries. The LAPACK libraries can be attained by FTPing to the netlib directory at Research.ATT.com or by contacting the Numerical Algorithms Group.

The inverse of a matrix;
Note: The LU decomposition of the matrix is a hidden calculation;

template<class T >
casacore::Matrix<T> cayleyProduct ( const casacore::Matrix< T > &  A,
const casacore::Matrix< T > &  B 
)
Matrix<casacore::Complex> conjugate ( const casacore::Matrix< casacore::Complex > &  A)

complex space function specifications

The complex conjugate of the complex matrix A.

Matrix<casacore::DComplex> conjugate ( const casacore::Matrix< casacore::DComplex > &  A)

The complex conjugate of the double precision complex matrix A.

template<class T >
casacore::Vector<T> crossProduct ( const casacore::Vector< T > &  x,
const casacore::Vector< T > &  y 
)

The vector/cross product of two 3-space vectors.

template<class T >
T determinant ( const casacore::Matrix< T > &  A)

The determinant of a matrix;
Note: The LU decomposition of the matrix is a hidden calculation;

template<class T >
T determinant ( const LUdecomp< T > &  LU)

the determinant (A) of an LUdecomp which is the lower/upper decomposition of a matrix A.

template<class T >
T innerProduct ( const casacore::Vector< T > &  x,
const casacore::Vector< T > &  y 
)

Thrown Exceptions

ArrayError BlasError

<title> The AIPS++ Linear Algebra Functions </title>
The scalar/dot/inner product of two equal length vectors.

Referenced by casa::StokesUtil_global_functions_StokesVector_ancillary_Functions::abs().

template<class T >
casacore::Matrix<T> inverse ( const casacore::Matrix< T > &  A)
template<class T >
casacore::Matrix<T> inverse ( const LUdecomp< T > &  LU)

The inverse of an LUdecomp which is the Lower/upper decomposition of a matrix A.

template<class T >
T norm ( const casacore::Vector< T > &  x)

The magnitude/norm of a vector.

Referenced by casa::VisMapper::norm().

template<class T >
casacore::Matrix<T> outerProduct ( const casacore::Vector< T > &  x,
const casacore::Matrix< T > &  yT 
)
template<class T >
casacore::Vector<T> outerProduct ( const casacore::Matrix< T > &  A,
const casacore::Vector< T > &  x 
)
template<class T >
casacore::Matrix<T> product ( const casacore::Vector< T > &  x,
const casacore::Matrix< T > &  yT 
)

The matrix/outer product of a vector and a transposed vector.


Note: The function's second argument is actually a transposed vector stored as the only row in a 1xN matrix;

Referenced by casa::Scantable2MSReader::getRowImplTemplate().

template<class T >
casacore::Vector<T> product ( const casacore::Matrix< T > &  A,
const casacore::Vector< T > &  x 
)

The vector/outer product of an MxN matrix and an N-length vector.

template<class T >
casacore::Matrix<T> product ( const casacore::Matrix< T > &  A,
const casacore::Matrix< T > &  B 
)

The matrix multiplication or cayley product of an MxN matrix and an NxP matrix.

template<class T >
casacore::Matrix<T> Rot3D ( casacore::Int  axis,
angle 
)

Create a 3D rotation matrix (3x3).

Axis is 0,1,2 for x,y,z; angle is in radians.

template<class T >
casacore::Vector<T> solve ( const casacore::Matrix< T > &  A,
const casacore::Vector< T > &  y,
double &  ferr,
double &  berr 
)

Given a matrix "A", and given some vector "y" which is the right hand side of the equation "Ax=y", then "solve(A, y, error1, error2)" returns the computed vector "x".

(for further details, see the LAPACK man page for "sgesvx".)

solve(LUdecomp<T>, casacore::Vector<T>,...) arguments are (in order): 1) casacore::Matrix<T> - (input) the matrix "A" that is being modeled by the equation "Ax=y". 2) casacore::Vector<T> - (input) the vector "y" that is being modeled by the equation "Ax=y". 3) double - (output) the error bound "forwardError" on the returned vector x, i.e |max(x - xtrue)| forwardError > -------------— |max(x)|

4) double - (output) the error bound "backwardError" on the input vector "y". i.e. backwardError > |Ax-y|


Note: The LU decomposition of the matrix is a hidden calculation;

template<class T >
casacore::Vector<T> solve ( const LUdecomp< T > &  myLU,
const casacore::Vector< T > &  y,
double &  ferr,
double &  berr 
)

Given an LUdecomp "myLU" which is the LU decomposition of some matrix "A", and given some vector "y" which is the right hand side of the equation "Ax=y", then "solve(myLU, y, error1, error2)" returns the computed vector "x".

(for further details, see the LAPACK man page for "sgesvx".)

solve(LUdecomp<T>, casacore::Vector<T>,...) arguments are (in order): 1) LUdecomp<T> - (input) the LU decomposition of the matrix "A" that is being modeled by the equation "Ax=y". 2) casacore::Vector<T> - (input) the vector "y" that is being modeled by the equation "Ax=y". 3) double - (output) the error bound "forwardError" on the returned vector x, i.e |max(x - xtrue)| forwardError > -------------— |max(x)|

4) double - (output) the error bound "backwardError" on the input vector "y". i.e. backwardError > |Ax-y|

template<class T >
casacore::Matrix<T> solve ( const casacore::Matrix< T > &  A,
const casacore::Matrix< T > &  B,
casacore::Vector< double > &  Ferr,
casacore::Vector< double > &  Berr 
)

Given a matrix "A", and given a matrix "B" whose columns are the stored set of vectors "y1", "y2",..."yN" which are independent right hand sides to the equation "Ax", e.g.

"Ax=y", then "solve(A, B, Error1, Error2)" returns the computed matrix "X", whose columns are the stored set of vectors "x1", "x2",..."xN" which satisfy the equation "Ax=y" for each respective "y". (for further details, see the LAPACK man page for "sgesvx".)

solve(LUdecomp<T>, casacore::Matrix<T>,...) arguments are (in order): 1) casacore::Matrix<T> - (input) the matrix "A" that is being modeled by the equation "Ax=y". 2) casacore::Matrix<T> - (input) MxN matrix "B" of N possible M-length vectors "y1", "y2",..."yN" stored as columns in a single matrix "B" where "A*x1=y1, A*x2=y2,..."A*xN=yN" => "AX=B". 3) casacore::Vector<double> - (output) an N-length vector "Ferr" with error bounds for returned matrix X, i.e. max(X.column(i)-Xtrue.column(i)) Ferr(i) > -----------------------------— max(X.column(i))

4) casacore::Vector<double> - (output) an N-length vector "Berr" with error bounds for input matrix "B", i.e Berr(i) > |max(A*X.column(i)-B.column(i))|


Note: The LU decomposition of the matrix is a hidden calculation;

template<class T >
casacore::Matrix<T> solve ( const LUdecomp< T > &  myLU,
const casacore::Matrix< T > &  B,
casacore::Vector< double > &  Ferr,
casacore::Vector< double > &  Berr 
)

Given an LUdecomp "myLU" which is the LU decomposition of some matrix "A", and given a matrix "B" whose columns are the stored set of vectors "y1", "y2",..."yN" which are independent right hand sides to the equation "Ax", e.g.

"Ax=y", then "solve(myLU, B, Error1, Error2)" returns the computed matrix "X", whose columns are the stored set of vectors "x1", "x2",..."xN" which satisfy the equation "Ax=y" for each respective "y". (for further details, see the LAPACK man page for "sgesvx".)

solve(LUdecomp<T>, casacore::Matrix<T>,...) arguments are (in order): 1) LUdecomp<T> - (input) the LU decomposition of the matrix "A" that is being modeled by the equation "Ax=y". 2) casacore::Matrix<T> - (input) MxN matrix "B" of N possible M-length vectors "y1", "y2",..."yN" stored as columns in a single matrix "B" where "A*x1=y1, A*x2=y2,..."A*xN=yN" => "AX=B". 3) casacore::Vector<double> - (output) an N-length vector "Ferr" with error bounds for returned matrix X, i.e. max(X.column(i)-Xtrue.column(i)) Ferr(i) > -----------------------------— max(X.column(i))

4) casacore::Vector<double> - (output) an N-length vector "Berr" with error bounds for input matrix "B", i.e Berr(i) > |max(A*X.column(i)-B.column(i))|

template<class T >
casacore::Matrix<T> transpose ( const casacore::Matrix< T > &  A)

The NxM transpose of an MxN matrix.