fmatvec  0.0.0
fmatvec::Matrix< Symmetric, Ref, Ref, AT > Class Template Reference

This is a matrix class for symmetric matrices. More...

#include <symmetric_matrix.h>

Public Types

using value_type = AT
 
using shape_type = Symmetric
 

Public Member Functions

 Matrix ()
 Standard constructor. More...
 
 Matrix (int n_, Noinit)
 
 Matrix (int n_, Init ini=INIT, const AT &a=AT())
 
 Matrix (int n_, Eye ini, const AT &a=1)
 
 Matrix (int m_, int n_, Noinit)
 
 Matrix (int m_, int n_, Init ini=INIT, const AT &a=AT())
 
 Matrix (int m_, int n_, Eye ini, const AT &a=1)
 
 Matrix (const Matrix< Symmetric, Ref, Ref, AT > &A)
 Copy Constructor. More...
 
template<class Row >
 Matrix (const Matrix< Symmetric, Row, Row, AT > &A)
 Copy Constructor. More...
 
template<class Type , class Row , class Col >
 Matrix (const Matrix< Type, Row, Col, AT > &A)
 Copy Constructor. More...
 
 Matrix (int n_, AT *ele_)
 Regular Constructor. More...
 
 ~Matrix ()=default
 Destructor.
 
Matrix< Symmetric, Ref, Ref, AT > & resize (int n_, Noinit)
 
Matrix< Symmetric, Ref, Ref, AT > & resize (int n, Init ini=INIT, const AT &a=AT())
 
Matrix< Symmetric, Ref, Ref, AT > & resize (int n, Eye ini, const AT &a=1)
 
void resize (int n, int m)
 
Matrix< Symmetric, Ref, Ref, AT > & operator= (const Matrix< Symmetric, Ref, Ref, AT > &A)
 Assignment operator. More...
 
template<class Type , class Row , class Col >
Matrix< Symmetric, Ref, Ref, AT > & operator= (const Matrix< Type, Row, Col, AT > &A)
 Assignment operator. More...
 
Matrix< Symmetric, Ref, Ref, AT > & operator&= (Matrix< Symmetric, Ref, Ref, AT > &A)
 Reference operator. More...
 
template<class Type , class Row , class Col >
Matrix< Symmetric, Ref, Ref, AT > & operator<<= (const Matrix< Type, Row, Col, AT > &A)
 Matrix assignment. More...
 
AT & operator() (int i, int j)
 Element operator. More...
 
const AT & operator() (int i, int j) const
 Element operator. More...
 
AT & ei (int i, int j)
 
const AT & ei (int i, int j) const
 
AT & ej (int i, int j)
 
const AT & ej (int i, int j) const
 
AT & e (int i, int j)
 
const AT & e (int i, int j) const
 
AT * operator() ()
 Pointer operator. More...
 
const AT * operator() () const
 Pointer operator. More...
 
int size () const
 Size. More...
 
int rows () const
 Number of rows. More...
 
int cols () const
 Number of columns. More...
 
int ldim () const
 Leading dimension. More...
 
const CBLAS_ORDER blasOrder () const
 Storage convention. More...
 
const CBLAS_UPLO blasUplo () const
 Symmetry convention. More...
 
Matrix< Symmetric, Ref, Ref, AT > & init (const AT &val)
 Initialization. More...
 
Matrix< Symmetric, Ref, Ref, AT > & init (Init, const AT &a=AT())
 
Matrix< Symmetric, Ref, Ref, AT > & init (Eye, const AT &val=1)
 
Matrix< Symmetric, Ref, Ref, AT > & init (Noinit, const AT &a=AT())
 
const Matrix< General, Ref, Ref, AT > operator() (const Range< Var, Var > &I, const Range< Var, Var > &J) const
 Submatrix operator.
 
const Matrix< Symmetric, Ref, Ref, AT > operator() (const Range< Var, Var > &I) const
 Submatrix operator.
 
template<class Type , class Row , class Col >
void set (const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)
 
template<class Type , class Row , class Col >
void add (const fmatvec::Range< Var, Var > &I, const fmatvec::Range< Var, Var > &J, const Matrix< Type, Row, Col, AT > &A)
 
template<class Row >
void set (const fmatvec::Range< Var, Var > &I, const Matrix< Symmetric, Row, Row, AT > &A)
 
template<class Row >
void add (const fmatvec::Range< Var, Var > &I, const Matrix< Symmetric, Row, Row, AT > &A)
 
const Matrix< General, Ref, Ref, AT > operator() (const Indices &I, const Indices &J) const
 
const Matrix< Symmetric, Ref, Ref, AT > operator() (const Indices &I) const
 
void ref (Matrix< Symmetric, Ref, Ref, AT > &A, const fmatvec::Range< Var, Var > &I)
 
 operator std::vector< std::vector< AT >> () const
 Cast to std::vector<std::vector<AT>>. More...
 
 Matrix (const std::vector< std::vector< AT >> &m)
 std::vector<std::vector<AT>> Constructor. Constructs and initializes a matrix with a std::vector<std::vector<AT>> object. An FMATVEC_ASSERT checks for constant length of each ro, UseExceptions<AT>::EXw. More...
 
int nonZeroElements () const
 Cast to AT. More...
 

Static Public Attributes

static constexpr bool isVector {false}
 

Detailed Description

template<class AT>
class fmatvec::Matrix< Symmetric, Ref, Ref, AT >

This is a matrix class for symmetric matrices.

Template class Matrix of shape type Symmetric. The template parameter AT defines the atomic type of the matrix. Valid types are int, float, double, complex<float> and complex<double>

Constructor & Destructor Documentation

◆ Matrix() [1/6]

template<class AT >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::Matrix ( )
inlineexplicit

Standard constructor.

Constructs a matrix with no size.

◆ Matrix() [2/6]

template<class AT >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::Matrix ( const Matrix< Symmetric, Ref, Ref, AT > &  A)
inline

Copy Constructor.

Constructs a copy of the matrix A.

Parameters
AThe matrix that will be copied.

◆ Matrix() [3/6]

template<class AT >
template<class Row >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::Matrix ( const Matrix< Symmetric, Row, Row, AT > &  A)
inline

Copy Constructor.

Constructs a copy of the matrix A.

Parameters
AThe matrix that will be copied.

◆ Matrix() [4/6]

template<class AT >
template<class Type , class Row , class Col >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::Matrix ( const Matrix< Type, Row, Col, AT > &  A)
inlineexplicit

Copy Constructor.

Constructs a copy of the matrix A.

Parameters
AThe matrix that will be copied.

◆ Matrix() [5/6]

template<class AT >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::Matrix ( int  n_,
AT *  ele_ 
)
inlineexplicit

Regular Constructor.

Constructs a symmetric matrix of size n x n with the pyhsical memory given by ele_.

Parameters
n_The number of rows and columns.
ele_The physical memory the matrix will point to.

◆ Matrix() [6/6]

template<class AT >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::Matrix ( const std::vector< std::vector< AT >> &  m)
explicit

std::vector<std::vector<AT>> Constructor. Constructs and initializes a matrix with a std::vector<std::vector<AT>> object. An FMATVEC_ASSERT checks for constant length of each ro, UseExceptions<AT>::EXw.

Parameters
mThe std::vector<std::vector<AT>> the matrix will be initialized with.

Member Function Documentation

◆ blasOrder()

template<class AT >
const CBLAS_ORDER fmatvec::Matrix< Symmetric, Ref, Ref, AT >::blasOrder ( ) const
inline

Storage convention.

Returns the blas-conform storage convention. The elements are stored in columnmajor form, i.e. the elements are stored columnwise.

Returns
CblasColMajor.

◆ blasUplo()

template<class AT >
const CBLAS_UPLO fmatvec::Matrix< Symmetric, Ref, Ref, AT >::blasUplo ( ) const
inline

Symmetry convention.

Returns the blas-conform symmetry convention. The elements are stored in the lower triangular part of the array,

Returns
CblasLower.

◆ cols()

template<class AT >
int fmatvec::Matrix< Symmetric, Ref, Ref, AT >::cols ( ) const
inline

Number of columns.

Returns
The number of columns of the matrix

◆ init()

template<class AT >
Matrix< Symmetric, Ref, Ref, AT > & fmatvec::Matrix< Symmetric, Ref, Ref, AT >::init ( const AT &  val)
inline

Initialization.

Initializes all elements of the calling matrix with the value given by a.

Parameters
aValue all elements will be initialized with.
Returns
A reference to the calling matrix.

◆ ldim()

template<class AT >
int fmatvec::Matrix< Symmetric, Ref, Ref, AT >::ldim ( ) const
inline

Leading dimension.

Returns
The leading dimension of the matrix

◆ nonZeroElements()

template<class AT >
int fmatvec::Matrix< Symmetric, Ref, Ref, AT >::nonZeroElements ( ) const
inline

Cast to AT.

Returns
The AT representation of the matrix

AT Constructor. Constructs and initializes a matrix with a AT object.

Parameters
xThe AT the matrix will be initialized with.

◆ operator std::vector< std::vector< AT >>()

template<class AT >
fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator std::vector< std::vector< AT >> ( ) const
inlineexplicit

Cast to std::vector<std::vector<AT>>.

Returns
The std::vector<std::vector<AT>> representation of the matrix

◆ operator&=()

template<class AT >
Matrix<Symmetric,Ref,Ref,AT>& fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator&= ( Matrix< Symmetric, Ref, Ref, AT > &  A)
inline

Reference operator.

References the symmetric matrix given by A.

Parameters
AThe matrix to be referenced.
Returns
A reference to the calling matrix.

◆ operator()() [1/4]

template<class AT >
AT& fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator() ( int  i,
int  j 
)
inline

Element operator.

Returns a reference to the element in the i-th row and the j-th column.

Parameters
iThe i-th row of the matrix
jThe j-th column of the matrix
Returns
A reference to the element A(i,j).
Remarks
The bounds are checked in debug mode.
See also
operator()(int,int) const

◆ operator()() [2/4]

template<class AT >
const AT& fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator() ( int  i,
int  j 
) const
inline

Element operator.

See operator()(int,int)

◆ operator()() [3/4]

template<class AT >
AT* fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator() ( )
inline

Pointer operator.

Returns the pointer to the first element.

Returns
The pointer to the first element.

◆ operator()() [4/4]

template<class AT >
const AT* fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator() ( ) const
inline

Pointer operator.

See operator()()

◆ operator<<=()

template<class AT >
template<class Type , class Row , class Col >
Matrix<Symmetric,Ref,Ref,AT>& fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator<<= ( const Matrix< Type, Row, Col, AT > &  A)
inline

Matrix assignment.

Copies the symmetric matrix given by A.

Parameters
AThe matrix to be copied.
Returns
A reference to the calling matrix.

◆ operator=() [1/2]

template<class AT >
Matrix<Symmetric,Ref,Ref,AT>& fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator= ( const Matrix< Symmetric, Ref, Ref, AT > &  A)
inline

Assignment operator.

Copies the symmetric matrix given by A.

Parameters
AThe matrix to be assigned.
Returns
A reference to the calling matrix.

◆ operator=() [2/2]

template<class AT >
template<class Type , class Row , class Col >
Matrix<Symmetric,Ref,Ref,AT>& fmatvec::Matrix< Symmetric, Ref, Ref, AT >::operator= ( const Matrix< Type, Row, Col, AT > &  A)
inline

Assignment operator.

Copies the symmetric matrix given by A.

Parameters
AThe matrix to be assigned.
Returns
A reference to the calling matrix.

◆ resize()

template<class AT >
void fmatvec::Matrix< Symmetric, Ref, Ref, AT >::resize ( int  n,
int  m 
)
inline

Resize a symmetric matrix Throw if the row and col dimension does not match or resize to this dimension.

◆ rows()

template<class AT >
int fmatvec::Matrix< Symmetric, Ref, Ref, AT >::rows ( ) const
inline

Number of rows.

Returns
The number of rows of the matrix

◆ size()

template<class AT >
int fmatvec::Matrix< Symmetric, Ref, Ref, AT >::size ( ) const
inline

Size.

Returns
The number of rows and columns of the matrix

The documentation for this class was generated from the following file: