fmatvec  0.0.0
fmatvec::SquareMatrix< Ref, AT > Class Template Reference

This is a matrix class of general quadratic matrices. More...

#include <square_matrix.h>

Inheritance diagram for fmatvec::SquareMatrix< Ref, AT >:
[legend]

Public Types

using value_type = AT
 
using shape_type = Square
 
- Public Types inherited from fmatvec::Matrix< General, Ref, Ref, AT >
using value_type = AT
 
using shape_type = General
 
using iterator = Iterator< false >
 
using const_iterator = Iterator< true >
 

Public Member Functions

 SquareMatrix ()
 Standard constructor. More...
 
 SquareMatrix (int m, Noinit ini)
 
 SquareMatrix (int m, Init ini=INIT, const AT &a=AT())
 
 SquareMatrix (int m, Eye ini, const AT &a=1)
 
 SquareMatrix (const SquareMatrix< Ref, AT > &A)
 Copy Constructor. More...
 
template<class Row >
 SquareMatrix (const SquareMatrix< Row, AT > &A)
 Copy Constructor. More...
 
template<class Type , class Row , class Col >
 SquareMatrix (const Matrix< Type, Row, Col, AT > &A)
 Copy Constructor. More...
 
 SquareMatrix (int m, AT *ele)
 Regular Constructor. More...
 
 SquareMatrix (const char *str)
 
SquareMatrix< Ref, AT > & resize (int m, Noinit)
 
SquareMatrix< Ref, AT > & resize (int m, Init ini=INIT, const AT &a=AT())
 
SquareMatrix< Ref, AT > & resize (int m, Eye ini, const AT &a=1)
 
void resize (int m, int n)
 
SquareMatrix< Ref, AT > & operator= (const SquareMatrix< Ref, AT > &A)
 Assignment operator. More...
 
template<class Type , class Row , class Col >
SquareMatrix< Ref, AT > & operator= (const Matrix< Type, Row, Col, AT > &A)
 Assignment operator. More...
 
SquareMatrix< Ref, AT > & operator&= (SquareMatrix< Ref, AT > &A)
 Reference operator. More...
 
SquareMatrix< Ref, AT > & operator&= (Matrix< General, Ref, Ref, AT > &A)
 
template<class Type , class Row , class Col >
SquareMatrix< Ref, AT > & operator<<= (const Matrix< Type, Row, Col, AT > &A)
 Matrix assignment. More...
 
int size () const
 Size. More...
 
int rows () const
 
int cols () const
 
 operator std::vector< std::vector< AT > > () const
 Cast to std::vector<std::vector<AT>>. More...
 
 SquareMatrix (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...
 
const SquareMatrix< Ref, AT > T () const
 
- Public Member Functions inherited from fmatvec::Matrix< General, Ref, Ref, AT >
 Matrix ()
 Standard constructor. More...
 
 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< General, Ref, Ref, AT > &A)
 Copy Constructor. More...
 
template<class Row , class Col >
 Matrix (const Matrix< General, Row, Col, 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 m_, int n_, AT *ele_)
 Regular Constructor. More...
 
 Matrix (const std::string &strs)
 String Constructor. More...
 
 Matrix (const char *strs)
 
 ~Matrix ()=default
 Destructor.
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
Matrix< General, Ref, Ref, AT > & resize (int m_, int n_, Noinit)
 
Matrix< General, Ref, Ref, AT > & resize (int m, int n, Init ini=INIT, const AT &a=AT())
 
Matrix< General, Ref, Ref, AT > & resize (int m, int n, Eye ini, const AT &a=1)
 
Matrix< General, Ref, Ref, AT > & operator= (const Matrix< General, Ref, Ref, AT > &A)
 Assignment operator. More...
 
template<class Type , class Row , class Col >
Matrix< General, Ref, Ref, AT > & operator= (const Matrix< Type, Row, Col, AT > &A)
 Assignment operator. More...
 
Matrix< General, Ref, Ref, AT > & operator&= (Matrix< General, Ref, Ref, AT > &A)
 Reference operator. More...
 
template<class Type , class Row , class Col >
Matrix< General, Ref, Ref, AT > & operator<<= (const Matrix< Type, Row, Col, AT > &A)
 Matrix assignment. More...
 
template<class AT2 >
 operator Matrix< General, Ref, Ref, AT2 > () const
 
AT & operator() (int i, int j)
 Element operator. More...
 
const AT & operator() (int i, int j) const
 Element operator. More...
 
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 rows () const
 Number of rows. More...
 
int cols () const
 Number of columns. More...
 
int ldim () const
 Leading dimension. More...
 
CBLAS_TRANSPOSE blasTrans () const
 Transposed status. More...
 
CBLAS_ORDER blasOrder () const
 Storage convention. More...
 
const Matrix< General, Ref, Ref, AT > operator() (const Range< Var, Var > &I, const Range< Var, Var > &J) const
 Submatrix operator. More...
 
const SquareMatrix< Ref, AT > operator() (const Range< Var, Var > &I) const
 Submatrix operator.
 
const RowVector< Ref, AT > row (int i) const
 Row operator.
 
const Vector< Ref, AT > col (int j) const
 Column operator.
 
Matrix< General, Ref, Ref, AT > & init (const AT &val=AT())
 Initialization. More...
 
Matrix< General, Ref, Ref, AT > & init (Init, const AT &a=AT())
 
Matrix< General, Ref, Ref, AT > & init (Eye, const AT &val=1)
 
Matrix< General, Ref, Ref, AT > & init (Noinit, const AT &a=AT())
 
Matrix< General, Ref, Ref, AT > & init0 (const AT &val=AT())
 
Matrix< General, Ref, Ref, AT > & init0 (Init, 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...
 
int nonZeroElements () const
 Cast to AT. More...
 

Static Public Attributes

static constexpr bool isVector {false}
 
- Static Public Attributes inherited from fmatvec::Matrix< General, Ref, Ref, AT >
static constexpr bool isVector {false}
 

Detailed Description

template<class AT>
class fmatvec::SquareMatrix< Ref, AT >

This is a matrix class of general quadratic matrices.

Template class SquareMatrix with shape type General and atomic type AT. The storage form is dense. The template parameter AT defines the atomic type of the vector. Valid types are int, float, double, complex<float> and complex<double>

Constructor & Destructor Documentation

◆ SquareMatrix() [1/6]

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

Standard constructor.

Constructs a squarematrix with no size.

◆ SquareMatrix() [2/6]

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

Copy Constructor.

Constructs a copy of the matrix A.

Parameters
AThe matrix that will copied.

◆ SquareMatrix() [3/6]

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

Copy Constructor.

Constructs a copy of the matrix A.

Parameters
AThe matrix that will copied.

◆ SquareMatrix() [4/6]

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

Copy Constructor.

Constructs a copy of the matrix A.

Parameters
AThe matrix that will copied.

◆ SquareMatrix() [5/6]

template<class AT >
fmatvec::SquareMatrix< Ref, AT >::SquareMatrix ( int  m,
AT *  ele 
)
inlineexplicit

Regular Constructor.

Constructs a matrix of size m x m with the pyhsical memory given by ele_;

Parameters
mThe number of rows and columns.
eleThe physical memory the matrix will point to.

◆ SquareMatrix() [6/6]

template<class AT >
fmatvec::SquareMatrix< Ref, AT >::SquareMatrix ( const std::vector< std::vector< AT > > &  m)
inlineexplicit

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

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

template<class AT >
fmatvec::SquareMatrix< Ref, AT >::operator std::vector< std::vector< AT > >
inlineexplicit

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

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

◆ operator&=()

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

Reference operator.

References the matrix given by A.

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

◆ operator<<=()

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

Matrix assignment.

Copies the matrix given by A.

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

◆ operator=() [1/2]

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

Assignment operator.

Copies the matrix given by A.

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

◆ operator=() [2/2]

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

Assignment operator.

Copies the matrix given by A.

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

◆ resize()

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

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

◆ size()

template<class AT >
int fmatvec::SquareMatrix< 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: