OFELI's Logo

An Object Oriented Finite Element Library

Vector and Matrix

Vector and matrix classes. More...

Classes

class  BMatrix< T_ >
 To handle band matrices. More...
 
class  DMatrix< T_ >
 To handle dense matrices. More...
 
class  DSMatrix< T_ >
 To handle symmetric dense matrices. More...
 
class  LocalMatrix< T_, NR_, NC_ >
 Handles small size matrices like element matrices, with a priori known size. More...
 
class  LocalVect< T_, N_ >
 Handles small size vectors like element vectors. More...
 
class  SkMatrix< T_ >
 To handle square matrices in skyline storage format. More...
 
class  SkSMatrix< T_ >
 To handle symmetric matrices in skyline storage format. More...
 
class  SpMatrix< T_ >
 To handle matrices in sparse storage format. More...
 
class  TrMatrix< T_ >
 To handle tridiagonal matrices. More...
 
class  Vect< T_ >
 To handle general purpose vectors. More...
 

Functions

template<class T_ , size_t N_, class E_ >
void element_assembly (const E_ &e, const LocalMatrix< T_, N_, N_ > &ae, Vect< T_ > &b)
 Assemble diagonal local vector into global vector. More...
 
template<class T_ , size_t N_, class E_ >
void element_assembly (const E_ &e, const LocalMatrix< T_, N_, N_ > &ae, Matrix< T_ > *A)
 Assemble local matrix into global matrix. More...
 
template<class T_ , size_t N_, class E_ >
void element_assembly (const E_ &e, const LocalMatrix< T_, N_, N_ > &ae, SkMatrix< T_ > &A)
 Assemble local matrix into global skyline matrix. More...
 
template<class T_ , size_t N_, class E_ >
void element_assembly (const E_ &e, const LocalMatrix< T_, N_, N_ > &ae, SkSMatrix< T_ > &A)
 Assemble local matrix into global symmetric skyline matrix. More...
 
template<class T_ , size_t N_, class E_ >
void element_assembly (const E_ &e, const LocalMatrix< T_, N_, N_ > &ae, SpMatrix< T_ > &A)
 Assemble local matrix into global sparse matrix. More...
 
template<class T_ , size_t N_>
void side_assembly (const Element &e, const LocalMatrix< T_, N_, N_ > &ae, SkSMatrix< T_ > &A)
 Side assembly of local matrix into global matrix (as instance of class SkSMatrix). More...
 
template<class T_ , size_t N_>
void side_assembly (const Element &e, const LocalMatrix< T_, N_, N_ > &ae, SkMatrix< T_ > &A)
 Side assembly of local matrix into global matrix (as instance of class SkMatrix). More...
 
template<class T_ , size_t N_>
void side_assembly (const Element &e, const LocalVect< T_, N_ > &be, Vect< T_ > &b)
 Side assembly of local vector into global vector. More...
 
template<class T_ >
Vect< T_ > operator* (const BMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
BMatrix< T_ > operator* (T_ a, const BMatrix< T_ > &A)
 Operator * (Premultiplication of matrix by constant) More...
 
template<class T_ >
ostream & operator<< (ostream &s, const BMatrix< T_ > &a)
 Output matrix in output stream.
 
template<class T_ >
Vect< T_ > operator* (const DMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
ostream & operator<< (ostream &s, const DMatrix< T_ > &a)
 Output matrix in output stream.
 
template<class T_ >
Vect< T_ > operator* (const DSMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
ostream & operator<< (ostream &s, const DSMatrix< T_ > &a)
 Output matrix in output stream.
 
template<class T_ , size_t NR_, size_t NC_>
LocalMatrix< T_, NR_, NC_ > operator* (T_ a, const LocalMatrix< T_, NR_, NC_ > &x)
 Operator * (Multiply matrix x by scalar a) More...
 
template<class T_ , size_t NR_, size_t NC_>
LocalVect< T_, NR_ > operator* (const LocalMatrix< T_, NR_, NC_ > &A, const LocalVect< T_, NC_ > &x)
 Operator * (Multiply matrix A by vector x) More...
 
template<class T_ , size_t NR_, size_t NC_>
LocalMatrix< T_, NR_, NC_ > operator/ (T_ a, const LocalMatrix< T_, NR_, NC_ > &x)
 Operator / (Divide matrix x by scalar a) More...
 
template<class T_ , size_t NR_, size_t NC_>
LocalMatrix< T_, NR_, NC_ > operator+ (const LocalMatrix< T_, NR_, NC_ > &x, const LocalMatrix< T_, NR_, NC_ > &y)
 Operator + (Add matrix x to y) More...
 
template<class T_ , size_t NR_, size_t NC_>
LocalMatrix< T_, NR_, NC_ > operator- (const LocalMatrix< T_, NR_, NC_ > &x, const LocalMatrix< T_, NR_, NC_ > &y)
 Operator - (Subtract matrix y from x) More...
 
template<class T_ , size_t NR_, size_t NC_>
ostream & operator<< (ostream &s, const LocalMatrix< T_, NR_, NC_ > &A)
 Output vector in output stream.
 
template<class T_ , size_t N_>
LocalVect< T_, N_ > operator+ (const LocalVect< T_, N_ > &x, const LocalVect< T_, N_ > &y)
 Operator + (Add two vectors) More...
 
template<class T_ , size_t N_>
LocalVect< T_, N_ > operator- (const LocalVect< T_, N_ > &x, const LocalVect< T_, N_ > &y)
 Operator - (Subtract two vectors) More...
 
template<class T_ , size_t N_>
LocalVect< T_, N_ > operator* (T_ a, const LocalVect< T_, N_ > &x)
 Operator * (Premultiplication of vector by constant) More...
 
template<class T_ , size_t N_>
LocalVect< T_, N_ > operator/ (T_ a, const LocalVect< T_, N_ > &x)
 Operator / (Division of vector by constant) More...
 
template<class T_ , size_t N_>
real_t Dot (const LocalVect< T_, N_ > &a, const LocalVect< T_, N_ > &b)
 Calculate dot product of 2 vectors (instances of class LocalVect) More...
 
template<class T_ , size_t N_>
void Scale (T_ a, const LocalVect< T_, N_ > &x, LocalVect< T_, N_ > &y)
 Multiply vector x by constant a and store result in y.
 
template<class T_ , size_t N_>
void Scale (T_ a, LocalVect< T_, N_ > &x)
 Multiply vector x by constant a and store result in x.
 
template<class T_ , size_t N_>
void Axpy (T_ a, const LocalVect< T_, N_ > &x, LocalVect< T_, N_ > &y)
 Add a*x to vector y.
 
template<class T_ , size_t N_>
void Copy (const LocalVect< T_, N_ > &x, LocalVect< T_, N_ > &y)
 Copy vector x into vector y.
 
template<class T_ , size_t N_>
ostream & operator<< (ostream &s, const LocalVect< T_, N_ > &v)
 Output vector in output stream.
 
template<class T_ >
Vect< T_ > operator* (const SkMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
ostream & operator<< (ostream &s, const SkMatrix< T_ > &a)
 Output matrix in output stream. More...
 
template<class T_ >
Vect< T_ > operator* (const SkSMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
ostream & operator<< (ostream &s, const SkSMatrix< T_ > &a)
 Output matrix in output stream. More...
 
template<class T_ >
Vect< T_ > operator* (const SpMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
ostream & operator<< (ostream &s, const SpMatrix< T_ > &A)
 Output matrix in output stream. More...
 
template<class T_ >
Vect< T_ > operator* (const TrMatrix< T_ > &A, const Vect< T_ > &b)
 Operator * (Multiply vector by matrix and return resulting vector. More...
 
template<class T_ >
TrMatrix< T_ > operator* (T_ a, const TrMatrix< T_ > &A)
 Operator * (Premultiplication of matrix by constant) More...
 
template<class T_ >
ostream & operator<< (ostream &s, const TrMatrix< T_ > &A)
 Output matrix in output stream. More...
 
template<class T_ >
Vect< T_ > operator+ (const Vect< T_ > &x, const Vect< T_ > &y)
 Operator + (Addition of two instances of class Vect) More...
 
template<class T_ >
Vect< T_ > operator- (const Vect< T_ > &x, const Vect< T_ > &y)
 Operator - (Difference between two vectors of class Vect) More...
 
template<class T_ >
Vect< T_ > operator* (const T_ &a, const Vect< T_ > &x)
 Operator * (Premultiplication of vector by constant) More...
 
template<class T_ >
Vect< T_ > operator* (const Vect< T_ > &x, const T_ &a)
 Operator * (Postmultiplication of vector by constant) More...
 
template<class T_ >
Vect< T_ > operator/ (const Vect< T_ > &x, const T_ &a)
 Operator / (Divide vector entries by constant) More...
 
template<class T_ >
T_ Dot (const Vect< T_ > &x, const Vect< T_ > &y)
 Calculate dot product of two vectors. More...
 
void Modulus (const Vect< complex_t > &x, Vect< real_t > &y)
 Calculate modulus of complex vector. More...
 
void Real (const Vect< complex_t > &x, Vect< real_t > &y)
 Calculate real part of complex vector. More...
 
void Imag (const Vect< complex_t > &x, Vect< real_t > &y)
 Calculate imaginary part of complex vector. More...
 
template<class T_ >
istream & operator>> (istream &s, Vect< T_ > &v)
 
template<class T_ >
ostream & operator<< (ostream &s, const Vect< T_ > &v)
 Output vector in output stream. More...
 
real_t operator* (const vector< real_t > &x, const vector< real_t > &y)
 Operator * (Dot product of 2 vector instances) More...
 

Detailed Description

Vector and matrix classes.

Function Documentation

◆ Dot() [1/2]

double Dot ( const LocalVect< T_, N_ > &  a,
const LocalVect< T_, N_ > &  b 
)

Calculate dot product of 2 vectors (instances of class LocalVect)

Returns
Dot product

◆ Dot() [2/2]

T_ Dot ( const Vect< T_ > &  x,
const Vect< T_ > &  y 
)

Calculate dot product of two vectors.

Returns
Dot (inner or scalar) product Calculate dot (scalar) product of two vectors

◆ element_assembly() [1/5]

void element_assembly ( const E_ &  e,
const LocalMatrix< T_, N_, N_ > &  ae,
Matrix< T_ > *  A 
)

Assemble local matrix into global matrix.

This function is to be called with an abstract pointer to matrix (class Matrix)

Parameters
[in]eReference to local entity (Element or Side)
[in]aeLocal matrix
[in,out]APointer to global matrix
Author
Rachid Touzani

◆ element_assembly() [2/5]

void element_assembly ( const E_ &  e,
const LocalMatrix< T_, N_, N_ > &  ae,
SkMatrix< T_ > &  A 
)

Assemble local matrix into global skyline matrix.

Parameters
[in]eReference to local entity (Element or Side)
[in]aeLocal matrix
[in,out]AGlobal matrix
Author
Rachid Touzani

◆ element_assembly() [3/5]

void element_assembly ( const E_ &  e,
const LocalMatrix< T_, N_, N_ > &  ae,
SkSMatrix< T_ > &  A 
)

Assemble local matrix into global symmetric skyline matrix.

Parameters
[in]eReference to local entity (Element or Side)
[in]aeLocal matrix
[in,out]AGlobal matrix
Author
Rachid Touzani

◆ element_assembly() [4/5]

void element_assembly ( const E_ &  e,
const LocalMatrix< T_, N_, N_ > &  ae,
SpMatrix< T_ > &  A 
)

Assemble local matrix into global sparse matrix.

Parameters
[in]eReference to local entity (Element or Side)
[in]aeLocal matrix
[in,out]AGlobal matrix
Author
Rachid Touzani

◆ element_assembly() [5/5]

void element_assembly ( const E_ &  e,
const LocalMatrix< T_, N_, N_ > &  ae,
Vect< T_ > &  b 
)

Assemble diagonal local vector into global vector.

Parameters
[in]eReference to local entity (Element or Side)
[in]aeLocal matrix
[in,out]bGlobal vector
Author
Rachid Touzani

◆ Imag()

void Imag ( const Vect< complex_t > &  x,
Vect< real_t > &  y 
)

Calculate imaginary part of complex vector.

Parameters
[in]xVector with complex value entries
[out]yVector containing imaginary parts of entries of x

◆ Modulus()

void Modulus ( const Vect< complex_t > &  x,
Vect< real_t > &  y 
)

Calculate modulus of complex vector.

Parameters
[in]xVector with complex value entries
[out]yVector containing moduli of entries of x

◆ operator*() [1/15]

Vect< T_ > operator* ( const BMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ABMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b

◆ operator*() [2/15]

Vect< T_ > operator* ( const DMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ADMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b

◆ operator*() [3/15]

Vect< T_ > operator* ( const DSMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ADSMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b

◆ operator*() [4/15]

LocalVect< T_, NR_, NC_ > operator* ( const LocalMatrix< T_, NR_, NC_ > &  x,
const LocalVect< T_, NC_ > &  x 
)

Operator * (Multiply matrix A by vector x)

This function performs a matrix-vector product and returns resulting vector as a reference to LocalVect instance

Returns
A*x

◆ operator*() [5/15]

Vect< T_ > operator* ( const SkMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ASkMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b
Author
Rachid Touzani

◆ operator*() [6/15]

Vect< T_ > operator* ( const SkSMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ASkSMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b
Author
Rachid Touzani

◆ operator*() [7/15]

Vect< T_ > operator* ( const SpMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ASpMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b
Author
Rachid Touzani

◆ operator*() [8/15]

Vect< T_ > operator* ( const T_ &  a,
const Vect< T_ > &  x 
)

Operator * (Premultiplication of vector by constant)

Returns
a*x

◆ operator*() [9/15]

Vect< T_ > operator* ( const TrMatrix< T_ > &  A,
const Vect< T_ > &  b 
)

Operator * (Multiply vector by matrix and return resulting vector.

Parameters
[in]ATrMatrix instance to multiply by vector
[in]bVect instance
Returns
Vect instance containing A*b
Author
Rachid Touzani

◆ operator*() [10/15]

Vect< T_ > operator* ( const Vect< T_ > &  x,
const T_ &  a 
)

Operator * (Postmultiplication of vector by constant)

Returns
x*a

◆ operator*() [11/15]

real_t operator* ( const vector< real_t > &  x,
const vector< real_t > &  y 
)

Operator * (Dot product of 2 vector instances)

Returns
x.y

◆ operator*() [12/15]

BMatrix< T_ > operator* ( T_  a,
const BMatrix< T_ > &  A 
)

Operator * (Premultiplication of matrix by constant)

Returns
a*A

◆ operator*() [13/15]

LocalMatrix< T_, NR_, NC_ > operator* ( T_  a,
const LocalMatrix< T_, NR_, NC_ > &  x 
)

Operator * (Multiply matrix x by scalar a)

Returns
a*x

◆ operator*() [14/15]

LocalVect< T_, N_ > operator* ( T_  a,
const LocalVect< T_, N_ > &  x 
)

Operator * (Premultiplication of vector by constant)

Returns
a*x

◆ operator*() [15/15]

TrMatrix< T_ > operator* ( T_  a,
const TrMatrix< T_ > &  A 
)

Operator * (Premultiplication of matrix by constant)

Returns
a*A
Author
Rachid Touzani

◆ operator+() [1/3]

LocalMatrix< T_, NR_, NC_ > operator+ ( const LocalMatrix< T_, NR_, NC_ > &  x,
const LocalMatrix< T_, NR_, NC_ > &  y 
)

Operator + (Add matrix x to y)

Returns
x+y

◆ operator+() [2/3]

LocalVect< T_, N_ > operator+ ( const LocalVect< T_, N_ > &  x,
const LocalVect< T_, N_ > &  y 
)

Operator + (Add two vectors)

Returns
x+y

◆ operator+() [3/3]

Vect< T_ > operator+ ( const Vect< T_ > &  x,
const Vect< T_ > &  y 
)

Operator + (Addition of two instances of class Vect)

Returns
x + y

◆ operator-() [1/3]

LocalMatrix< T_, NR_, NC_ > operator- ( const LocalMatrix< T_, NR_, NC_ > &  x,
const LocalMatrix< T_, NR_, NC_ > &  y 
)

Operator - (Subtract matrix y from x)

Returns
x-y

◆ operator-() [2/3]

LocalVect< T_, N_ > operator- ( const LocalVect< T_, N_ > &  x,
const LocalVect< T_, N_ > &  y 
)

Operator - (Subtract two vectors)

Returns
x-y

◆ operator-() [3/3]

Vect< T_ > operator- ( const Vect< T_ > &  x,
const Vect< T_ > &  y 
)

Operator - (Difference between two vectors of class Vect)

Returns
x - y

◆ operator/() [1/3]

Vect< T_ > operator/ ( const Vect< T_ > &  x,
const T_ &  a 
)

Operator / (Divide vector entries by constant)

Returns
x/a

◆ operator/() [2/3]

LocalMatrix< T_, NR_, NC_ > operator/ ( T_  a,
const LocalMatrix< T_, NR_, NC_ > &  x 
)

Operator / (Divide matrix x by scalar a)

Returns
x/a

◆ operator/() [3/3]

LocalVect< T_, N_ > operator/ ( T_  a,
const LocalVect< T_, N_ > &  x 
)

Operator / (Division of vector by constant)

Returns
x/a

◆ operator<<() [1/5]

ostream & operator<< ( ostream &  s,
const SkMatrix< T_ > &  a 
)

Output matrix in output stream.

Author
Rachid Touzani
Author
Rachid Touzani

◆ operator<<() [2/5]

ostream & operator<< ( ostream &  s,
const SkSMatrix< T_ > &  a 
)

Output matrix in output stream.

Author
Rachid Touzani

◆ operator<<() [3/5]

ostream & operator<< ( ostream &  s,
const SpMatrix< T_ > &  A 
)

Output matrix in output stream.

Author
Rachid Touzani

◆ operator<<() [4/5]

ostream & operator<< ( ostream &  s,
const TrMatrix< T_ > &  a 
)

Output matrix in output stream.

Author
Rachid Touzani

◆ operator<<() [5/5]

ostream & operator<< ( ostream &  s,
const Vect< T_ > &  v 
)

Output vector in output stream.

Level of vector output depends on the global variable Verbosity

  • If Verbosity=0, this function outputs vector size only.
  • If Verbosity>0, this function outputs vector size, vector name, value of time, and number of components
  • If Verbosity>1, this function outputs in addition the first 10 entries in vector
  • If Verbosity>2, this function outputs in addition the first 50 entries in vector
  • If Verbosity>3, this function outputs in addition the first 100 entries in vector
  • If Verbosity>4, this function outputs all vector entries
Author
Rachid Touzani

◆ operator>>()

istream & operator>> ( istream &  s,
Vect< T_ > &  a 
)

Read vector from input stream

◆ Real()

void Real ( const Vect< complex_t > &  x,
Vect< real_t > &  y 
)

Calculate real part of complex vector.

Parameters
[in]xVector with complex value entries
[out]yVector containing real parts of entries of x

◆ side_assembly() [1/3]

void side_assembly ( const Element e,
const LocalMatrix< T_, N_, N_ > &  ae,
SkMatrix< T_ > &  A 
)

Side assembly of local matrix into global matrix (as instance of class SkMatrix).

Parameters
[in]eReference to local Element
[in]aeLocal matrix
[in,out]AGlobal matrix
Author
Rachid Touzani

◆ side_assembly() [2/3]

void side_assembly ( const Element e,
const LocalMatrix< T_, N_, N_ > &  ae,
SkSMatrix< T_ > &  A 
)

Side assembly of local matrix into global matrix (as instance of class SkSMatrix).

Parameters
[in]eReference to local Element
[in]aeLocal matrix
[in,out]AGlobal matrix
Author
Rachid Touzani

◆ side_assembly() [3/3]

void side_assembly ( const Element e,
const LocalVect< T_, N_ > &  be,
Vect< T_ > &  b 
)

Side assembly of local vector into global vector.

Parameters
[in]eReference to local Element
[in]beLocal vector
[in,out]bGlobal vector
Author
Rachid Touzani





Copyright © 1998-2022 Rachid Touzani