(9)

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_ >
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...
 

Friends

template<class TT_ >
ostream & operator<< (ostream &s, const SpMatrix< TT_ > &A)
 

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

◆ 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]

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

Operator * (Multiply matrix x by scalar a)

Returns
a*x

◆ operator*() [2/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*() [3/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*() [4/15]

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

Operator * (Premultiplication of vector by constant)

Returns
a*x

◆ operator*() [5/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*() [6/15]

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

Operator * (Premultiplication of matrix by constant)

Returns
a*A
Author
Rachid Touzani

◆ operator*() [7/15]

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

Operator * (Premultiplication of matrix by constant)

Returns
a*A

◆ operator*() [8/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*() [9/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*() [10/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*() [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]

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*() [13/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*() [14/15]

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

Operator * (Premultiplication of vector by constant)

Returns
a*x

◆ operator*() [15/15]

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

Operator * (Postmultiplication of vector by constant)

Returns
x*a

◆ operator+() [1/3]

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

Operator + (Add two vectors)

Returns
x+y

◆ operator+() [2/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+() [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]

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

Operator - (Subtract two vectors)

Returns
x-y

◆ operator-() [2/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-() [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]

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

Operator / (Divide matrix x by scalar a)

Returns
x/a

◆ operator/() [2/3]

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

Operator / (Division of vector by constant)

Returns
x/a

◆ operator/() [3/3]

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

Operator / (Divide vector entries by constant)

Returns
x/a

◆ operator<<() [1/5]

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

Output matrix in output stream.

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 SkMatrix< T_ > &  a 
)

Output matrix in output stream.

Author
Rachid Touzani
Author
Rachid Touzani

◆ operator<<() [4/5]

ostream & operator<< ( ostream &  s,
const SpMatrix< 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

Friends

◆ operator<<

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

Output matrix in output stream