Matrices
[Vectors and maticies]

Collaboration diagram for Matrices:


Detailed Description

This group contains matrix classes, and classes and functions to manipulate matrices.

The class matrix is the GSL-- representation of a matrix. It is implemented (as it is in GSL) as a dense matrix. That is, room for all elements is allocated.

A matrix has various a few properties

  • Number of rows (gslmm::matrix<T>::row_size())
  • Number of columns (gslmm::matrix<T>:columns_size())
  • $ M \times N$ elements, where $ M$ is the number of rows, and $ N$ is the number of columns.

Vadrious operations are defined on matrices, including sub-views, retrivial of the diagonal, and super- and sub-diagonals.

Normal matrix-matrix, matrix-vector, and matrix-scalar operations are defined as well. If the matrices $ A, A' \in S_{M\times N}$, $ B \in S_{N\times P}$, $ C \in S_{M\times P}$, and the vectors $ v\in S_{M}$, $ u\in S_{N}$, and the scalar $ a \in S$ for some set of numbers $ S = \mathbb{R}, \mathbb{C}, \mathbb{Z}$, then the following operations are defined

\begin{align*} A' &= A a \\ A' &= A + a \\ u &= A v \\ C &= A B \end{align*}

These operations are implemented via the corresponding global C++ operators ( operator*(const matrix<T>&,const double&), operator+(const matrix<T>&,const double&), operator*(const matrix<T>&,const vector<T>&), operator*(const matrix<T>&,const matrix<T>&)). For the matrix-vector and matrix-matrix product, the operators call the global functions matrix_vector_product and matrix_matrix_product respectively.

Note, that the global operators for $ A v$ and $ A B$ as well as their corresponding functions, do not return a new vector or matrix. Instead the return an object of a specialised class (_matrix_vector_mult for $ A v$, and _matrix_matrix_mult for $ A B$). This is to allow for defered evaluation of the potentially expensive operation of $ A v$ or $ A B$. (This follows the outline of section 22.4.7 of The C++ Programming Language (Special Edition) by Bjarne Stroustrup).

The special object simple contains references to the two operands of the operation. When a vector or matrix is assigned from this object, the operation is evaluated in-place - that is, without a temporary object. For example

    size_t m=3, n=2, p=4;           // 1: Dimension
    gslmm::matrix<double> A(m,n);   // 2: Left-hand operand
    gslmm::matrix<double> B(n,p);   // 3: Right-hand operand
    gslmm::matrix<double> C(m,p)    // 4: To be assigned A * B
    fill_matrix(A);                 // 5: Set elements of A
    fill_matrix(B);                 // 6: Set elements of B
    C = A * B;                      // 7: Assign A * B to C

If the * operator was defined to return a new matrix, then in line 7 we could have potentially 2 useless temporaries:

  • First, we would make a temporary $ T$ in the operator* function, and assign the elements $ T_{ij} = \sum_{k} A_{ik} B_{kj} $. This would be one un-wanted construction.
  • Since we could not return a reference to this object, as it goes out of scope when leaving the operator* function, we'd have to copy $ T$ onto the return stack as $ T'$. That is, we'd do a copy construction for the return object $ T'$, and we'd destruct $ T$.
  • Finally, we would assign to $ C$ the elements of $ T'$, and then destroy $ T'$

That is, we'd have one un-wanted construction, one un-wanted copy construction, and to un-wanted destructions.

However, in the implementation used here, we construct a small special object in the operator* function, and copy that back on the return stack. Since the special object is small (two references to the operands), this is not a large overhead, and never depends on the size of the matrices and vectors involved. When the assignment operator is envoked in line 7 above, it takes care of evaluating the operation, and assign directly to the elements of $ C$.

Note, that in the default definition of these operators, no tricks has been employed to speed up the calculation. To use better code for these operations, one should include the relevant Basic Linear Algebra Subprograms (BLAS) headers. This makes even more sense when manipulators are used to flag properties of a matrix.

Matrix manipulators are functions that flags a matrix as having a certain property. For example

    gslmm::matrix<double> A(3,3);  // Matrix
    assign_matrix(A);              // Make a symmetric matrix
    gslmm::symmetric(A);           // Say that A is symmetric 
This would tell the system, that $ A$ is a symmetric matrix,

\[ A = \left(\begin{array}{ccc} A_{00} & A_{01} & A_{02} \\ A_{01} & A_{11} & A_{12} \\ A_{02} & A_{12} & A_{22} \\ \end{array}\right) \]

and that we should only reference the upper-right triangle of the matrix (the lower-left is the same as the upper-right).

The matrix manipulator functions return an object of matrix_manip<T>. The various operators are also definied for matrix manipulators, so one can do

    matrix<double> A(...);
    matrix<double> B(...);
    matrix<double> C(...);
    C = gslmm::symmetrix(A) * B;
One can easily nest manipulators, if needed, like

Whenever optimised BLAS algorithms exists, and the user has included the relevant BLAS headers, they are used.

Note, that operators operator+=, operator-=, operator*=, and operator/= are element-wise operations. If you think about it, you will see why. For example, suppose $ A \in S_{M\times N}$, $ B \in S_{N\times P}$, $ C \in S_{M\times P}$, and $ N \neq P$, then if the operator*= function implemented $ A B$ the code

    A *= B;
would have to change the dimensions of $ A$ to $ N\times P$. Changing the dimension of a matrix or vector is now allowed in GSL-- (nor GSL) because it can have very bad and unexpected side-effects.


Classes

class  gslmm::matrix< char >
 Matrix char specialisation. More...
class  gslmm::matrix< complex< double > >
 Matrix complex<double> specialisation. More...
class  gslmm::matrix< double >
 Matrix double specialisation. More...
class  gslmm::matrix< float >
 Matrix float specialisation. More...
class  gslmm::matrix< int >
 Matrix int specialisation. More...
class  gslmm::matrix< long >
 Matrix long specialisation. More...
class  gslmm::matrix< long double >
 Matrix long double specialisation. More...
struct  gslmm::_matrix_mult< T >
 Class that represents a matrix-matrix product. More...
struct  gslmm::_matrix_manip_mult< T >
 Class that represents a matrix-matrix product. More...
struct  gslmm::_matrix_vector_mult< T >
 Class that represents a matrix-matrix product. More...
struct  gslmm::_matrix_manip_vector_mult< T >
 Class that represents a matrix-matrix product. More...
class  gslmm::matrix< short >
 Matrix short specialisation. More...
class  gslmm::matrix< unsigned char >
 Matrix unsigned char specialisation. More...
class  gslmm::matrix< unsigned int >
 Matrix unsigned int specialisation. More...
class  gslmm::matrix< unsigned long >
 Matrix unsigned long specialisation. More...
class  gslmm::matrix< unsigned short >
 Matrix unsigned short specialisation. More...
class  matrix
 Base template for matricies classes. More...
struct  gslmm::matrix_manip< T >
 Manipulator of matrixes. More...

Matrix manipulator - enumerations

enum  gslmm::type {
  gslmm::general_type, gslmm::triangular_type, gslmm::inverse_triangular_type, gslmm::symmetric_type,
  gslmm::hermitian_type
}
enum  gslmm::transform { gslmm::no_transform = CblasNoTrans, gslmm::transpose_transform = CblasTrans, gslmm::adjoint_transform = CblasConjTrans }
enum  gslmm::location { gslmm::upper_triangle = CblasUpper, gslmm::lower_triangle = CblasLower }
enum  gslmm::diagonal { gslmm::non_unit_diagonal = CblasNonUnit, gslmm::unit_diagonal = CblasUnit }
enum  gslmm::side { gslmm::left_side = CblasLeft, gslmm::right_side = CblasRight }
enum  gslmm::order { gslmm::row_major = CblasRowMajor, gslmm::column_major = CblasColMajor }

Matrix manipulator - triangular

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::triangular (Ref< T > r, location l=upper_triangle, diagonal d=non_unit_diagonal)
template<typename T>
matrix_manip< T > gslmm::triangular (matrix< T > &m, location l=upper_triangle, diagonal d=non_unit_diagonal)
template<typename T>
matrix_manip< T > & gslmm::triangular (matrix_manip< T > r, location l=upper_triangle, diagonal d=non_unit_diagonal)

Matrix manipulator - triangular, inverse

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::inverse_triangular (Ref< T > r, location l=upper_triangle, diagonal d=non_unit_diagonal)
template<typename T>
matrix_manip< T > gslmm::inverse_triangular (matrix< T > &m, location l=upper_triangle, diagonal d=non_unit_diagonal)
template<typename T>
matrix_manip< T > & gslmm::inverse_triangular (matrix_manip< T > r, location l=upper_triangle, diagonal d=non_unit_diagonal)

Matrix manipulator - symmetric

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::symmetric (Ref< T > r, location l=upper_triangle)
template<typename T>
matrix_manip< T > gslmm::symmetric (matrix< T > &m, location l=upper_triangle)
template<typename T>
matrix_manip< T > gslmm::symmetric (matrix_manip< T > r, location l=upper_triangle)

Matrix manipulator - Hermitian

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::hermitian (Ref< T > r, location l=upper_triangle)
template<typename T>
matrix_manip< T > gslmm::hermitian (matrix< T > r, location l=upper_triangle)
template<typename T>
matrix_manip< T > gslmm::hermitian (matrix_manip< T > r, location l=upper_triangle)

Matrix manipulator - transposition

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::transpose (Ref< T > r)
template<typename T>
matrix_manip< T > gslmm::transpose (matrix< T > &m)
template<typename T>
matrix_manip< T > gslmm::transpose (matrix_manip< T > r)

Matrix manipulator - adjoint

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::adjoint (Ref< T > r)
template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::adjoint (matrix< T > m)
template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::adjoint (matrix_manip< T > r)

Matrix manipulator - left-multiplication

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::left (Ref< T > r)
template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::left (matrix< T > m)
template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::left (matrix_manip< T > r)

Matrix manipulator - right-multiplication

template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::right (Ref< T > r)
template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::right (matrix< T > m)
template<typename T, template< class > class Ref>
matrix_manip< T > gslmm::right (matrix_manip< T > r)

Matrix-matrix products

template<typename Type>
void gslmm::matrix_matrix_product (const Type &alpha, const matrix< Type > &a, const matrix< Type > &b, const Type &beta, matrix< Type > &c)
template<typename Type>
void gslmm::matrix_matrix_product (const Type &alpha, const matrix_manip< Type > a, const matrix_manip< Type > b, const Type &beta, matrix< Type > &c)
template<typename Type>
void gslmm::matrix_matrix_product (const Type &alpha, const matrix_manip< Type > a, const matrix< Type > &b, const Type &beta, matrix< Type > &c)

Matrix-vector products

template<typename Type>
void gslmm::matrix_vector_product (const Type &alpha, const matrix< Type > &a, const vector< Type > &v, const Type &beta, vector< Type > &u)
template<typename Type>
void gslmm::matrix_vector_product (const Type &alpha, const matrix_manip< Type > a, const vector< Type > &v, const Type &beta, vector< Type > &u)

General operations on matricies

template<typename T>
matrix< T > gslmm::operator+ (const matrix< T > &lhs, const matrix< T > &rhs)
template<typename T>
matrix< T > gslmm::operator- (const matrix< T > &lhs, const matrix< T > &rhs)
template<typename T>
_matrix_mult< T > gslmm::operator * (const matrix< T > &lhs, const matrix< T > &rhs)
template<typename T>
matrix< T > gslmm::operator/ (const matrix< T > &lhs, const matrix< T > &rhs)

General operations on matrix-vector

template<typename T>
_matrix_vector_mult< T > gslmm::operator * (const matrix< T > &lhs, const vector< T > &rhs)

General operations on matrix-scaler

template<typename T>
matrix< T > gslmm::operator+ (const matrix< T > &m, const double &a)
template<typename T>
matrix< T > gslmm::operator- (const matrix< T > &m, const double &a)
template<typename T>
matrix< T > gslmm::operator * (const matrix< T > &m, const double &a)
template<typename T>
matrix< T > gslmm::operator/ (const matrix< T > &m, const double &a)

Operators on matrix manipulators

template<typename T>
_matrix_manip_mult< T > gslmm::operator * (const matrix_manip< T > lhs, const matrix_manip< T > rhs)
template<typename T>
_matrix_manip_mult< T > gslmm::operator * (const matrix_manip< T > lhs, const matrix< T > &rhs)
template<typename T>
_matrix_manip_vector_mult< T > gslmm::operator * (const matrix_manip< T > lhs, const vector< T > &rhs)

Functions

template<>
void gslmm::matrix_vector_product (const complex< double > &alpha, const matrix< complex< double > > &a, const vector< complex< double > > &v, const complex< double > &beta, vector< complex< double > > &u)
template<>
void gslmm::matrix_vector_product (const complex< double > &alpha, const matrix_manip< complex< double > > a, const vector< complex< double > > &v, const complex< double > &beta, vector< complex< double > > &u)
template<>
void gslmm::matrix_matrix_product (const complex< double > &alpha, const matrix< complex< double > > &a, const matrix< complex< double > > &b, const complex< double > &beta, matrix< complex< double > > &c)
template<>
void gslmm::matrix_matrix_product (const complex< double > &alpha, const matrix_manip< complex< double > > a, const matrix_manip< complex< double > > b, const complex< double > &beta, matrix< complex< double > > &c)
template<>
void gslmm::matrix_matrix_product (const complex< double > &alpha, const matrix_manip< complex< double > > a, const matrix< complex< double > > &b, const complex< double > &beta, matrix< complex< double > > &c)
template<>
void gslmm::matrix_vector_product (const double &alpha, const matrix< double > &a, const vector< double > &v, const double &beta, vector< double > &u)
template<>
void gslmm::matrix_vector_product (const double &alpha, const matrix_manip< double > a, const vector< double > &v, const double &beta, vector< double > &u)
template<>
void gslmm::matrix_matrix_product (const double &alpha, const matrix< double > &a, const matrix< double > &b, const double &beta, matrix< double > &c)
template<>
void gslmm::matrix_matrix_product (const double &alpha, const matrix_manip< double > a, const matrix_manip< double > b, const double &beta, matrix< double > &c)
template<>
void gslmm::matrix_matrix_product (const double &alpha, const matrix_manip< double > a, const matrix< double > &b, const double &beta, matrix< double > &c)
template<>
void gslmm::matrix_vector_product (const float &alpha, const matrix< float > &a, const vector< float > &v, const float &beta, vector< float > &u)
template<>
void gslmm::matrix_vector_product (const float &alpha, const matrix_manip< float > a, const vector< float > &v, const float &beta, vector< float > &u)
template<>
void gslmm::matrix_matrix_product (const float &alpha, const matrix< float > &a, const matrix< float > &b, const float &beta, matrix< float > &c)
template<>
void gslmm::matrix_matrix_product (const float &alpha, const matrix_manip< float > a, const matrix_manip< float > b, const float &beta, matrix< float > &c)
template<>
void gslmm::matrix_matrix_product (const float &alpha, const matrix_manip< float > a, const matrix< float > &b, const float &beta, matrix< float > &c)


Enumeration Type Documentation

enum gslmm::diagonal
 

Whether it is safe to assume that the diagnal is the unit matrix, or not.

That is, if unit is passed, then the matrix is assumed to be of the form

\[ \left(\begin{array}{ccc} 1 & & \\ & 1 & \\ & & \ddots \\ \end{array}\right) \]

Enumerator:
non_unit_diagonal  Do not assume diagonal is unit.
unit_diagonal  Assume diagonal is unit (1's).

enum gslmm::location
 

Storage of triangle matrix.

Chooses where the matrix is stored: in the upper or lower triangle of the matrix.

Enumerator:
upper_triangle  Reference the upper triangle of a matrix.
lower_triangle  Reference the lower triangle of a matrix.

enum gslmm::order
 

Order or matrices.

Enumerator:
row_major 
column_major 

enum gslmm::side
 

Order of the multiplication.

Enumerator:
left_side 
right_side 

enum gslmm::transform
 

Operations on matrix passed to the routines.

Enumerator:
no_transform  Do no operation.
transpose_transform  Transpose the matrix $ A = A^T$.
adjoint_transform  transpose conjugate the matrix $ A = A^H$

enum gslmm::type
 

Types of matrix.

Enumerator:
general_type  General matrix.
triangular_type  Triangular matrix, meaning it has the from

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

.

inverse_triangular_type  Triangular matrix, meaning it has the from

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

and we should use the inverse of that.

symmetric_type  Symmetric matrix, meaning that $ x_{ij} = x_{ji}$.
hermitian_type  Hermitian matrix, meaning that $ z_{ij} = \bar{z_{ji}}$.
Examples:
linear/linear-test.cc.


Function Documentation

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::adjoint matrix_manip< T >  r  ) 
 

Matrix manipulation that says we should make a conjugate transpose operation on the matrix.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::adjoint matrix< T >  m  ) 
 

Matrix manipulation that says we should make a conjugate transpose operation on the matrix.

Parameters:
m Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::adjoint Ref< T >  r  ) 
 

Matrix manipulation that says we should make a conjugate transpose operation on the matrix.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::hermitian matrix_manip< T >  r,
location  l = upper_triangle
 

Matrix manipulation that says the matrix is hermitian.

That is, $ m_{ij} = \bar{m_{ij}}$.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::hermitian matrix< T >  r,
location  l = upper_triangle
 

Matrix manipulation that says the matrix is hermitian.

That is, $ m_{ij} = \bar{m_{ij}}$.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::hermitian Ref< T >  r,
location  l = upper_triangle
 

Matrix manipulation that says the matrix is hermitian.

That is, $ m_{ij} = \bar{m_{ij}}$.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T>& gslmm::inverse_triangular matrix_manip< T >  r,
location  l = upper_triangle,
diagonal  d = non_unit_diagonal
[inline]
 

Matrix manipulation that says the matrix is trianular, and that we should use it's inverse.

That is, the matrix is of the form

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

and we should use the inverse of that.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
d Whether the diagonal can ba assumed to be unity or That is, of the form

\[ \left(\begin{array}{ccc} 1 & x & x \\ & 1 & x \\ & & 1 \\ \end{array}\right) \]

Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::inverse_triangular matrix< T > &  m,
location  l = upper_triangle,
diagonal  d = non_unit_diagonal
[inline]
 

Matrix manipulation that says the matrix is trianular, and that we should use it's inverse.

That is, the matrix is of the form

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

and we should use the inverse of that.

Parameters:
m Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
d Whether the diagonal can ba assumed to be unity or That is, of the form

\[ \left(\begin{array}{ccc} 1 & x & x \\ & 1 & x \\ & & 1 \\ \end{array}\right) \]

Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::inverse_triangular Ref< T >  r,
location  l = upper_triangle,
diagonal  d = non_unit_diagonal
 

Matrix manipulation that says the matrix is trianular, and that we should use it's inverse.

That is, the matrix is of the form

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

and we should use the inverse of that.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
d Whether the diagonal can ba assumed to be unity or That is, of the form

\[ \left(\begin{array}{ccc} 1 & x & x \\ & 1 & x \\ & & 1 \\ \end{array}\right) \]

Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::left matrix_manip< T >  r  ) 
 

Matrix manipulation that says we should do left hand side multiplication.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::left matrix< T >  m  ) 
 

Matrix manipulation that says we should do left hand side multiplication.

Parameters:
m Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::left Ref< T >  r  ) 
 

Matrix manipulation that says we should do left hand side multiplication.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename Type>
void gslmm::matrix_matrix_product const Type &  alpha,
const matrix_manip< Type >  a,
const matrix< Type > &  b,
const Type &  beta,
matrix< Type > &  c
[inline]
 

Compute the matrix-matrix product of manipulated matrices.

$ C = \alpha op_A(A) op_B(B) + \beta C$

Parameters:
alpha The constant $ \alpha $
a The manipulator of matrix $ op_A(A)$
b The manipulator of matrix $ op_B(B)$
beta The constant $ \beta $
c The matrix $ C$. On return, this is overwritten by the product

template<typename Type>
void gslmm::matrix_matrix_product const Type &  alpha,
const matrix_manip< Type >  a,
const matrix_manip< Type >  b,
const Type &  beta,
matrix< Type > &  c
[inline]
 

Compute the matrix-matrix product of manipulated matrices.

$ C = \alpha op_A(A) op_B(B) + \beta C$

Parameters:
alpha The constant $ \alpha $
a The manipulator of matrix $ op_A(A)$
b The manipulator of matrix $ op_B(B)$
beta The constant $ \beta $
c The matrix $ C$. On return, this is overwritten by the product

template<typename Type>
void gslmm::matrix_matrix_product const Type &  alpha,
const matrix< Type > &  a,
const matrix< Type > &  b,
const Type &  beta,
matrix< Type > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ a$
a The matrix $ A$
b The matrix $ B$
beta The constant $ b$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const float &  alpha,
const matrix_manip< float >  a,
const matrix< float > &  b,
const float &  beta,
matrix< float > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const float &  alpha,
const matrix_manip< float >  a,
const matrix_manip< float >  b,
const float &  beta,
matrix< float > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const float &  alpha,
const matrix< float > &  a,
const matrix< float > &  b,
const float &  beta,
matrix< float > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const double &  alpha,
const matrix_manip< double >  a,
const matrix< double > &  b,
const double &  beta,
matrix< double > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const double &  alpha,
const matrix_manip< double >  a,
const matrix_manip< double >  b,
const double &  beta,
matrix< double > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const double &  alpha,
const matrix< double > &  a,
const matrix< double > &  b,
const double &  beta,
matrix< double > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const complex< double > &  alpha,
const matrix_manip< complex< double > >  a,
const matrix< complex< double > > &  b,
const complex< double > &  beta,
matrix< complex< double > > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const complex< double > &  alpha,
const matrix_manip< complex< double > >  a,
const matrix_manip< complex< double > >  b,
const complex< double > &  beta,
matrix< complex< double > > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product

template<>
void gslmm::matrix_matrix_product const complex< double > &  alpha,
const matrix< complex< double > > &  a,
const matrix< complex< double > > &  b,
const complex< double > &  beta,
matrix< complex< double > > &  c
[inline]
 

Compute the matrix-matrix product.

$ C = \alpha A B + \beta C$

Parameters:
alpha The constant $ \alpha$
a The matrix $ A$
b The matrix $ B$
beta The constant $ \beta$
c The matrix $ C$. On return, this is overwritten by the product
Examples:
linear/linear-test.cc.

template<typename Type>
void gslmm::matrix_vector_product const Type &  alpha,
const matrix_manip< Type >  a,
const vector< Type > &  v,
const Type &  beta,
vector< Type > &  u
 

compute the matrix-vector product and sum $ u = \alpha op_A(A) v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The manipulated matrix $ op_A(A)$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<typename Type>
void gslmm::matrix_vector_product const Type &  alpha,
const matrix< Type > &  a,
const vector< Type > &  v,
const Type &  beta,
vector< Type > &  u
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<>
void gslmm::matrix_vector_product const float &  alpha,
const matrix_manip< float >  a,
const vector< float > &  v,
const float &  beta,
vector< float > &  u
[inline]
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<>
void gslmm::matrix_vector_product const float &  alpha,
const matrix< float > &  a,
const vector< float > &  v,
const float &  beta,
vector< float > &  u
[inline]
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<>
void gslmm::matrix_vector_product const double &  alpha,
const matrix_manip< double >  a,
const vector< double > &  v,
const double &  beta,
vector< double > &  u
[inline]
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<>
void gslmm::matrix_vector_product const double &  alpha,
const matrix< double > &  a,
const vector< double > &  v,
const double &  beta,
vector< double > &  u
[inline]
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<>
void gslmm::matrix_vector_product const complex< double > &  alpha,
const matrix_manip< complex< double > >  a,
const vector< complex< double > > &  v,
const complex< double > &  beta,
vector< complex< double > > &  u
[inline]
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.

template<>
void gslmm::matrix_vector_product const complex< double > &  alpha,
const matrix< complex< double > > &  a,
const vector< complex< double > > &  v,
const complex< double > &  beta,
vector< complex< double > > &  u
[inline]
 

compute the matrix-vector product and sum $ u = \alpha A v + \beta u$

Parameters:
alpha The matrix scalar $ \alpha$
a The matrix $ A$
v The vector $ v$
beta The vector scalar $ \beta$
u The vector $ u$, which is overwritten on output by the matrix-vector product.
Examples:
linear/linear-test.cc.

template<typename T>
_matrix_manip_vector_mult< T > gslmm::operator * const matrix_manip< T >  lhs,
const vector< T > &  rhs
[inline]
 

* operation between a manipulator of matrix and a vector This is implemented straight forwardly.

No hanky-panky here.

Parameters:
lhs The left hand operand, the matrix $ A $
rhs The right hand operand, the vector $ x $
Returns:
new vector, $ b_{i} = A_{ij} * x_{j} $

template<typename T>
_matrix_manip_mult< T > gslmm::operator * const matrix_manip< T >  lhs,
const matrix< T > &  rhs
[inline]
 

* operation between manipulators of matrices This is implemented straight forwardly.

No hanky-panky here.

Parameters:
lhs The left hand operand $ l $
rhs The right hand operand $ r $
Returns:
new matrix, $ m_{ij} = l_{ij} * r_{ij} $

template<typename T>
_matrix_manip_mult< T > gslmm::operator * const matrix_manip< T >  lhs,
const matrix_manip< T >  rhs
[inline]
 

* operation between manipulators of matrices This is implemented straight forwardly.

No hanky-panky here.

Todo:
Implement some more clever stuff based on the manipulator.
Parameters:
lhs The left hand operand $ l $
rhs The right hand operand $ r $
Returns:
new matrix, $ m_{ij} = l_{ij} * r_{ij} $

template<typename T>
matrix<T> gslmm::operator * const matrix< T > &  m,
const double &  a
[inline]
 

* operation between matrix and number (element by element)

Parameters:
a The number.
m The matrix.
Returns:
new matrix, $ r_{ij} = a * m_{ij} $

template<typename T>
_matrix_vector_mult< T > gslmm::operator * const matrix< T > &  lhs,
const vector< T > &  rhs
[inline]
 

* operation between a matrix and a vector This is implemented straight forwardly.

No hanky-panky here. If the BLAS headers are included, then the BLAS function gslmm::matrix_vector_product will be used for those types it's defined for (double, float, and complex<double>).

Parameters:
lhs The left hand operand, the matrix $ A $
rhs The right hand operand, the vector $ x $
Returns:
new vector, $ b_{i} = A_{ij} * x_{j} $

template<typename T>
_matrix_mult< T > gslmm::operator * const matrix< T > &  lhs,
const matrix< T > &  rhs
[inline]
 

* operation between matricies This is implemented straight forwardly.

No hanky-panky here. If the BLAS headers are included, then the BLAS function gslmm::matrix_matrix_product will be used for those types it's defined for (double, float, and complex<double>).

Parameters:
lhs The left hand operand $ l $
rhs The right hand operand $ r $
Returns:
new matrix, $ m_{ij} = l_{ij} * r_{ij} $

template<typename T>
matrix<T> gslmm::operator+ const matrix< T > &  m,
const double &  a
[inline]
 

+ operation between matrix and number (element by element)

Parameters:
a The number.
m The matrix.
Returns:
new matrix, $ r_{ij} = m_{ij} + a$

template<typename T>
matrix<T> gslmm::operator+ const matrix< T > &  lhs,
const matrix< T > &  rhs
[inline]
 

+ operation between matricies (element by element)

Parameters:
lhs The left hand operand $ l $
rhs The right hand operand $ r $
Returns:
new matrix, $ m_{ij} = l_{ij} + r_{ij} $

template<typename T>
matrix<T> gslmm::operator- const matrix< T > &  m,
const double &  a
[inline]
 

  • operation between matrix and number (element by element)

Parameters:
a The number.
m The matrix.
Returns:
new matrix, $ r_{ij} = m_{ij} - a $

template<typename T>
matrix<T> gslmm::operator- const matrix< T > &  lhs,
const matrix< T > &  rhs
[inline]
 

  • operation between matricies (element by element)

Parameters:
lhs The left hand operand $ l $
rhs The right hand operand $ r $
Returns:
new matrix, $ m_{ij} = l_{ij} - r_{ij} $

template<typename T>
matrix<T> gslmm::operator/ const matrix< T > &  m,
const double &  a
[inline]
 

/ operation between matrix and number (element by element)

Parameters:
a The number.
m The matrix.
Returns:
new matrix, $ r_{ij} = m_{ij} / a$

template<typename T>
matrix<T> gslmm::operator/ const matrix< T > &  lhs,
const matrix< T > &  rhs
[inline]
 

/ operation between matricies This is generally not defined.

It will simply return a copy of lhs (division by identity :-) If the linear algebra header (gslmm/linear/linear.hh) is included, then this is implemented using decompositions for a subset of the available types (all sorts of matrices of double, square matrices of complex<double>).

Parameters:
lhs The left hand operand $ l $
rhs The right hand operand $ r $
Returns:
new matrix, $ m_{ij} = l_{ij} / r_{ij} $

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::right matrix_manip< T >  r  ) 
 

Matrix manipulation that says we should do right hand side multiplication.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::right matrix< T >  m  ) 
 

Matrix manipulation that says we should do right hand side multiplication.

Parameters:
m Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::right Ref< T >  r  ) 
 

Matrix manipulation that says we should do right hand side multiplication.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::symmetric matrix_manip< T >  r,
location  l = upper_triangle
 

Matrix manipulation that says the matrix is symmetric.

That is, $ m_{ij} = m_{ji}$.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::symmetric matrix< T > &  m,
location  l = upper_triangle
 

Matrix manipulation that says the matrix is symmetric.

That is, $ m_{ij} = m_{ji}$.

Parameters:
m Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::symmetric Ref< T >  r,
location  l = upper_triangle
 

Matrix manipulation that says the matrix is symmetric.

That is, $ m_{ij} = m_{ji}$.

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::transpose matrix_manip< T >  r  ) 
 

Matrix manipulation that says we should make a transpose operation on the matrix.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::transpose matrix< T > &  m  ) 
 

Matrix manipulation that says we should make a transpose operation on the matrix.

Parameters:
m Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::transpose Ref< T >  r  ) 
 

Matrix manipulation that says we should make a transpose operation on the matrix.

Parameters:
r Reference or Matrix object.
Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T>& gslmm::triangular matrix_manip< T >  r,
location  l = upper_triangle,
diagonal  d = non_unit_diagonal
[inline]
 

Matrix manipulation that says the matrix is triangular.

That is, it is of the form

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
d Whether the diagonal can ba assumed to be unity or That is, of the form

\[ \left(\begin{array}{ccc} 1 & x & x \\ & 1 & x \\ & & 1 \\ \end{array}\right) \]

Returns:
A matrix_manip object.

template<typename T>
matrix_manip<T> gslmm::triangular matrix< T > &  m,
location  l = upper_triangle,
diagonal  d = non_unit_diagonal
[inline]
 

Matrix manipulation that says the matrix is triangular.

That is, it is of the form

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

Parameters:
m Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
d Whether the diagonal can ba assumed to be unity or That is, of the form

\[ \left(\begin{array}{ccc} 1 & x & x \\ & 1 & x \\ & & 1 \\ \end{array}\right) \]

Returns:
A matrix_manip object.

template<typename T, template< class > class Ref>
matrix_manip<T> gslmm::triangular Ref< T >  r,
location  l = upper_triangle,
diagonal  d = non_unit_diagonal
 

Matrix manipulation that says the matrix is trianular.

That is, it is of the form

\[ \left(\begin{array}{ccc} x & x & x \\ & x & x \\ & & x \\ \end{array}\right) \]

Parameters:
r Reference or Matrix object.
l Location parameter that says whether the matrix is stored in the upper or lower trangle of the object.
d Whether the diagonal can ba assumed to be unity or That is, of the form

\[ \left(\begin{array}{ccc} 1 & x & x \\ & 1 & x \\ & & 1 \\ \end{array}\right) \]

Returns:
A matrix_manip object.

Top of page Last update Tue May 9 10:11:29 2006
Christian Holm
Created by DoxyGen 1.4.6