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

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

#include <diagonal_matrix.h>

Public Types

using value_type = AT
 
using shape_type = Diagonal
 

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 (const Matrix< Diagonal, Ref, Ref, AT > &A)
 Copy Constructor. More...
 
template<class Type , class Row , class Col >
 Matrix (const Matrix< Type, Row, Col, AT > &A)
 Copy Constructor. More...
 
 ~Matrix ()=default
 Destructor.
 
Matrix< Diagonal, Ref, Ref, AT > & resize (int n_, Noinit)
 
Matrix< Diagonal, Ref, Ref, AT > & resize (int n, Init ini=INIT, const AT &a=AT())
 
Matrix< Diagonal, Ref, Ref, AT > & resize (int n, Eye ini, const AT &a=1)
 
Matrix< Diagonal, Ref, Ref, AT > & operator= (const Matrix< Diagonal, Ref, Ref, AT > &A)
 Assignment operator. More...
 
template<class Type , class Row , class Col >
Matrix< Diagonal, Ref, Ref, AT > & operator= (const Matrix< Type, Row, Col, AT > &A)
 Assignment operator. More...
 
Matrix< Diagonal, Ref, Ref, AT > & operator&= (Matrix< Diagonal, Ref, Ref, AT > &A)
 Reference operator. More...
 
template<class Type , class Row , class Col >
Matrix< Diagonal, Ref, Ref, AT > & operator<<= (const Matrix< Type, Row, Col, AT > &A)
 Matrix assignment. More...
 
const AT & operator() (int i, int j) const
 Element operator. More...
 
const AT & operator() (int i) const
 Element operator. More...
 
AT & operator() (int i)
 Element operator. More...
 
const AT & e (int i, int j) const
 
const AT & e (int i) const
 
AT & e (int i)
 
const AT * operator() () const
 Pointer operator. More...
 
AT * operator() ()
 Pointer operator. More...
 
int rows () const
 Number of rows. More...
 
int cols () const
 Number of columns. More...
 
int size () const
 Number of rows and columns. More...
 
CBLAS_ORDER blasOrder () const
 Storage convention. More...
 
Matrix< Diagonal, Ref, Ref, AT > & init (const AT &val=AT())
 Initialization. More...
 
Matrix< Diagonal, Ref, Ref, AT > & init (Init, const AT &a=AT())
 
Matrix< Diagonal, Ref, Ref, AT > & init (Eye, const AT &a=1)
 
Matrix< Diagonal, Ref, Ref, AT > & init (Noinit, const AT &a=AT())
 
 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 row. More...
 

Static Public Attributes

static constexpr bool isVector {false}
 

Detailed Description

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

This is a matrix class for diagonal matrices.

Template class Matrix of shape type Diagonal. 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/4]

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

Standard constructor.

Construckts a matrix with no size.

◆ Matrix() [2/4]

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

Copy Constructor.

Constructs a copy of the diagonal matrix A.

Parameters
AThe matrix that will be copied.

◆ Matrix() [3/4]

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

Copy Constructor.

Constructs a copy of the diagonal matrix A.

Parameters
AThe matrix that will be copied.

◆ Matrix() [4/4]

template<class AT >
fmatvec::Matrix< Diagonal, 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 row.

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

Member Function Documentation

◆ blasOrder()

template<class AT >
CBLAS_ORDER fmatvec::Matrix< Diagonal, 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.

◆ cols()

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

Number of columns.

Returns
The number of columns of the matrix

◆ init()

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

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.

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

template<class AT >
fmatvec::Matrix< Diagonal, Ref, Ref, AT >::operator std::vector< std::vector< AT > >
explicit

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

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

◆ operator&=()

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

Reference operator.

References the diagoanl matrix given by A.

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

◆ operator()() [1/5]

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

Pointer operator.

Returns the pointer to the first element.

Returns
The pointer to the first element.

◆ operator()() [2/5]

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

Pointer operator.

See operator()()

◆ operator()() [3/5]

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

Element operator.

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

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

◆ operator()() [4/5]

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

Element operator.

See operator()(int)

◆ operator()() [5/5]

template<class AT >
const AT & fmatvec::Matrix< Diagonal, Ref, Ref, AT >::operator() ( int  i,
int  j 
) const
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<<=()

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

Matrix assignment.

Copies the diagonal matrix given by A.

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

◆ operator=() [1/2]

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

Assignment operator.

Copies the diagonal 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< Diagonal, Ref, Ref, AT > & fmatvec::Matrix< Diagonal, Ref, Ref, AT >::operator= ( const Matrix< Type, Row, Col, AT > &  A)
inline

Assignment operator.

Copies the diagonal matrix given by A.

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

◆ rows()

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

Number of rows.

Returns
The number of rows of the matrix

◆ size()

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

Number of rows and columns.

Returns
The number of rows and columns of the matrix

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