CPP Linear Algebra ToolBox  0.1.0
SquareMatrix Class Reference

#include <squareMatrix.h>

Inheritance diagram for SquareMatrix:
Collaboration diagram for SquareMatrix:

Public Member Functions

 SquareMatrix ()
 
 SquareMatrix (uint16_t)
 
 SquareMatrix (const SquareMatrix &)
 
 ~SquareMatrix ()
 
SquareMatrixoperator= (const SquareMatrix &)
 
SquareMatrix operator- () const
 
SquareMatrix transpose () const
 
- Public Member Functions inherited from Matrix
 Matrix ()
 Construct a Matrix object. Default constructor. Set number of rows and number of columns to 0. Set data pointer to NULL. More...
 
 Matrix (uint16_t, uint16_t)
 Construct a Matrix object. Construct a matrix of size n rows times m columns. More...
 
 Matrix (const Matrix &)
 Construct a Matrix object. Copy contructor. More...
 
virtual ~Matrix ()
 Destroy the Matrix object. More...
 
uint16_t get_n_rows () const
 Accessor to the number of rows. More...
 
uint16_t get_n_cols () const
 Accessor to the number of columns. More...
 
uint32_t get_n_elements () const
 Accessor to the number of elements. More...
 
bool is_square () const
 Test if a matrix has a square shape. More...
 
Vector row (uint16_t) const
 Extract row from Matrix. More...
 
Vector col (uint16_t) const
 Extract column from Matrix. More...
 
double norm1 () const
 Compute the norm-1 of a Matrix object. For a Matrix M of dimension \(n\times m\), its norm-1 is given by the maximum colum sum (in absolute value) More...
 
double normInf () const
 Compute the norm-Infinity of a Matrix object. For a Matrix M of dimension \(n\times m\), its norm-Infinity is given by the maximum row sum (in absolute value) More...
 
double normFrob () const
 Compute the Frobenius norm of a Matrix object. For a Matrix M of dimension \(n\times m\), its Frobenius norm is given by the sum of its coefficient squared. More...
 
Matrix transpose () const
 Compute the transpose Matrix of a Matrix object. More...
 
double & operator() (uint32_t) const
 Overload operator (i) More...
 
double & operator() (uint16_t, uint16_t) const
 Overload operator (i,j). More...
 
Matrixoperator= (const Matrix &)
 Overload assignement operator. More...
 
Matrixoperator+= (const Matrix &)
 Overload operator +=. More...
 
Matrixoperator-= (const Matrix &)
 Overload operator -=. More...
 
Matrix operator- () const
 Overload unary operator -. More...
 

Static Public Member Functions

static SquareMatrix eye (uint16_t)
 
static SquareMatrix diag (const Vector &)
 
static Vector diag (const SquareMatrix &)
 
static double tr (const SquareMatrix &)
 
static SquareMatrix zeros (uint16_t)
 
static SquareMatrix ones (uint16_t)
 
static SquareMatrix rand (uint16_t)
 
static SquareMatrix hilbert (uint16_t)
 
static SquareMatrix vandermonde (const Vector &)
 
static SquareMatrix outer (const Vector &, const Vector &)
 
static SquareMatrix matmul (const SquareMatrix &, MATRIX_TRANSPOSE, const SquareMatrix &, MATRIX_TRANSPOSE)
 
- Static Public Member Functions inherited from Matrix
static Matrix zeros (uint16_t, uint16_t)
 Construct a matrix object of dimension n times m filled with zeros. More...
 
static Matrix ones (uint16_t, uint16_t)
 Construct a matrix object of dimension n times m filled with ones. More...
 
static Matrix rand (uint16_t, uint16_t)
 Construct a matrix object of dimension n times m filled with random values sampled from 0. to 1. More...
 
static Matrix hilbert (uint16_t, uint16_t)
 Construct an Hilbert matrix. More...
 
static Matrix vandermonde (const Vector &, uint16_t)
 Construct a Vandermonde matrix. See https://en.wikipedia.org/wiki/Vandermonde_matrix. More...
 
static Matrix outer (const Vector &, const Vector &)
 Overload operator * between two vectors to compute their outer product. More...
 
static Matrix matmul (const Matrix &, MATRIX_TRANSPOSE, const Matrix &, MATRIX_TRANSPOSE)
 Compute the product of two matrices combined with their transposition. More...
 

Friends

SquareMatrix operator* (const SquareMatrix &, const SquareMatrix &)
 
SquareMatrix operator* (const double, const SquareMatrix &)
 
SquareMatrix operator* (const SquareMatrix &, const double)
 
SquareMatrix operator+ (const SquareMatrix &, const SquareMatrix &)
 
SquareMatrix operator+ (const double, const SquareMatrix &)
 
SquareMatrix operator+ (const SquareMatrix &, const double)
 
SquareMatrix operator- (const SquareMatrix &, const SquareMatrix &)
 
SquareMatrix operator- (const SquareMatrix &, const double)
 
SquareMatrix operator- (const double, const SquareMatrix &)
 
SquareMatrix operator/ (const SquareMatrix &, const double)
 

Additional Inherited Members

- Protected Member Functions inherited from Matrix
double & at (uint32_t) const
 Helper to access the n-th stored value of a Matrix object. More...
 
double & at (uint16_t, uint16_t) const
 Access given element of a matrix. More...
 
void show () const
 Helper to display a Matrix object to the standart output stream. More...
 
void default_data ()
 Fill the data array with zeros.
More...
 
- Protected Attributes inherited from Matrix
uint16_t n_rows
 
uint16_t n_cols
 
uint32_t n_elements
 
double * data
 

Constructor & Destructor Documentation

◆ SquareMatrix() [1/3]

SquareMatrix::SquareMatrix ( )

◆ SquareMatrix() [2/3]

SquareMatrix::SquareMatrix ( uint16_t  n)

◆ SquareMatrix() [3/3]

SquareMatrix::SquareMatrix ( const SquareMatrix in)

◆ ~SquareMatrix()

SquareMatrix::~SquareMatrix ( )

Member Function Documentation

◆ diag() [1/2]

Vector SquareMatrix::diag ( const SquareMatrix A)
static

◆ diag() [2/2]

SquareMatrix SquareMatrix::diag ( const Vector v)
static

◆ eye()

SquareMatrix SquareMatrix::eye ( uint16_t  n)
static

◆ hilbert()

SquareMatrix SquareMatrix::hilbert ( uint16_t  n)
static

◆ matmul()

SquareMatrix SquareMatrix::matmul ( const SquareMatrix A,
MATRIX_TRANSPOSE  TRANSA,
const SquareMatrix B,
MATRIX_TRANSPOSE  TRANSB 
)
static

◆ ones()

SquareMatrix SquareMatrix::ones ( uint16_t  n)
static

◆ operator-()

SquareMatrix SquareMatrix::operator- ( ) const

◆ operator=()

SquareMatrix & SquareMatrix::operator= ( const SquareMatrix A)

◆ outer()

SquareMatrix SquareMatrix::outer ( const Vector u,
const Vector v 
)
static

◆ rand()

SquareMatrix SquareMatrix::rand ( uint16_t  n)
static

◆ tr()

double SquareMatrix::tr ( const SquareMatrix A)
static

◆ transpose()

SquareMatrix SquareMatrix::transpose ( ) const

◆ vandermonde()

SquareMatrix SquareMatrix::vandermonde ( const Vector v)
static

◆ zeros()

SquareMatrix SquareMatrix::zeros ( uint16_t  n)
static

Friends And Related Function Documentation

◆ operator* [1/3]

SquareMatrix operator* ( const double  k,
const SquareMatrix B 
)
friend

◆ operator* [2/3]

SquareMatrix operator* ( const SquareMatrix B,
const double  k 
)
friend

◆ operator* [3/3]

SquareMatrix operator* ( const SquareMatrix lhs,
const SquareMatrix rhs 
)
friend

◆ operator+ [1/3]

SquareMatrix operator+ ( const double  k,
const SquareMatrix B 
)
friend

◆ operator+ [2/3]

SquareMatrix operator+ ( const SquareMatrix B,
const double  k 
)
friend

◆ operator+ [3/3]

SquareMatrix operator+ ( const SquareMatrix lhs,
const SquareMatrix rhs 
)
friend

◆ operator- [1/3]

SquareMatrix operator- ( const double  k,
const SquareMatrix B 
)
friend

◆ operator- [2/3]

SquareMatrix operator- ( const SquareMatrix B,
const double  k 
)
friend

◆ operator- [3/3]

SquareMatrix operator- ( const SquareMatrix lhs,
const SquareMatrix rhs 
)
friend

◆ operator/

SquareMatrix operator/ ( const SquareMatrix B,
const double  k 
)
friend

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