Hex  1.0
Hydrogen-electron collision solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Data Structures | Enumerations | Functions
matrix.h File Reference
#include <cassert>
#include <complex>
#include <cstring>
#include <iostream>
#include <vector>
#include <png++/png.hpp>
#include <umfpack.h>
#include "arrays.h"
#include "complex.h"
Include dependency graph for matrix.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  RowMatrix< T >
 Dense (row-oriented) matrix. More...
 
class  ColMatrix< T >
 Dense (column-oriented) matrix. More...
 
class  DenseMatrix< T >
 DenseMatrix. More...
 
class  ColMatrix< T >
 Dense (column-oriented) matrix. More...
 
class  RowMatrix< T >
 Dense (row-oriented) matrix. More...
 
class  CscMatrix
 Complex CSC matrix. More...
 
class  CsrMatrix
 Complex CSR matrix. More...
 
class  CsrMatrix::PngGenerator
 
class  CsrMatrix::LUft
 LU factorization object. More...
 
class  CooMatrix
 Complex COO matrix. More...
 
class  SymDiaMatrix
 Symmetric diagonal matrix. More...
 

Enumerations

enum  MatrixTriangle {
  none = 0, strict_lower = 1, strict_upper = 2, strict_both = 3,
  diagonal = 4, lower = 5, upper = 6, both = 7
}
 Matrix parts. More...
 

Functions

template<class T >
RowMatrix< T > operator+ (RowMatrix< T > const &A, RowMatrix< T > const &B)
 
template<class T >
RowMatrix< T > operator- (RowMatrix< T > const &A, RowMatrix< T > const &B)
 
template<class T >
RowMatrix< T > operator* (T x, RowMatrix< T > const &A)
 
template<class T >
RowMatrix< T > operator* (RowMatrix< T > const &A, T x)
 
template<class T >
RowMatrix< T > operator/ (RowMatrix< T > const &A, T x)
 
template<class T >
RowMatrix< T > operator* (RowMatrix< T > const &A, ColMatrix< T > const &B)
 
template<class Type >
RowMatrix< Type > operator* (RowMatrix< Type > const &A, ColMatrix< Type > const &B)
 Dense matrix multiplication. More...
 
CsrMatrix operator& (const CsrMatrix &A, const CsrMatrix &B)
 
CsrMatrix operator^ (const CsrMatrix &A, const CsrMatrix &B)
 
CsrMatrix operator* (Complex z, const CsrMatrix &B)
 
CsrMatrix operator* (const CsrMatrix &A, double r)
 
CscMatrix operator& (const CscMatrix &A, const CscMatrix &B)
 
CscMatrix operator^ (const CscMatrix &A, const CscMatrix &B)
 
CscMatrix operator* (double r, const CscMatrix &B)
 
CscMatrix operator* (const CscMatrix &A, double r)
 
CooMatrix operator+ (const CooMatrix &A, const CooMatrix &B)
 
CooMatrix operator- (const CooMatrix &A, const CooMatrix &B)
 
CooMatrix operator* (const Complex &z, const CooMatrix &B)
 
CooMatrix operator* (CooMatrix const &A, const cArrayView B)
 
CooMatrix operator* (const CooMatrix &A, const Complex &z)
 
SymDiaMatrix operator+ (SymDiaMatrix const &A, SymDiaMatrix const &B)
 
SymDiaMatrix operator- (SymDiaMatrix const &A, SymDiaMatrix const &B)
 
SymDiaMatrix operator* (SymDiaMatrix const &A, SymDiaMatrix const &B)
 
SymDiaMatrix operator* (double z, SymDiaMatrix const &A)
 
SymDiaMatrix operator* (Complex z, SymDiaMatrix const &A)
 
CooMatrix kron (const CooMatrix &A, const CooMatrix &B)
 Kronecker product. More...
 
CooMatrix eye (size_t N)
 
CooMatrix stairs (size_t N)
 

Enumeration Type Documentation

This enumeration contains some matrix part identificators that can be used e.g. together with matrix-vector multiplication routines (if implemented). The multiplication is done, then, as if the other parts were zero. For example

y = A.dot(x, strict_upper | strict_lower)

will multiply vector x as if the diagonal of A were zero.

Enumerator
none 
strict_lower 
strict_upper 
strict_both 
diagonal 
lower 
upper 
both 

Function Documentation

CooMatrix eye ( size_t  N)

Identity matrix.

Parameters
NDimension.
CooMatrix kron ( const CooMatrix A,
const CooMatrix B 
)

This routine computes the Kronecker product (“flattened tensor product”)

\[ C = A \otimes B \ , \]

where the matrix \( C \) is of size \( mn \times rs \) (for matrix \( A \) of size \( m \times r \) and matrix \( B \) of size \( n \times s \)) and defined by

\[ c_{i,j} = a_{i \,\mathrm{div}\, m, j \,\mathrm{div}\, r} \cdot b_{i \,\mathrm{mod}\, m, j \,\mathrm{mod}\, r} \]

Parameters
AFirst matrix
BSecond matrix.
CsrMatrix operator& ( const CsrMatrix A,
const CsrMatrix B 
)
inline

Computes a sum of two csr-matrices OF THE SAME SPARSE STRUCTURE.

CscMatrix operator& ( const CscMatrix A,
const CscMatrix B 
)
inline

Computes a sum of two csc-matrices OF THE SAME SPARSE STRUCTURE.

template<class T >
RowMatrix<T> operator* ( x,
RowMatrix< T > const &  A 
)
template<class T >
RowMatrix<T> operator* ( RowMatrix< T > const &  A,
x 
)
template<class T >
RowMatrix<T> operator* ( RowMatrix< T > const &  A,
ColMatrix< T > const &  B 
)
template<class Type >
RowMatrix<Type> operator* ( RowMatrix< Type > const &  A,
ColMatrix< Type > const &  B 
)
CsrMatrix operator* ( Complex  z,
const CsrMatrix B 
)
inline

Multiplication of csr-matrix by a number.

CsrMatrix operator* ( const CsrMatrix A,
double  r 
)
inline

Multiplication of csr-matrix by a number.

CscMatrix operator* ( double  r,
const CscMatrix B 
)
inline

Multiplication of csc-matrix by a number.

CscMatrix operator* ( const CscMatrix A,
double  r 
)
inline

Multiplication of csc-matrix by a number.

CooMatrix operator* ( const Complex z,
const CooMatrix B 
)
inline

Computes product of a matrix and a complex number.

Parameters
zNumber.
BMatrix.
CooMatrix operator* ( CooMatrix const &  A,
const cArrayView  B 
)
inline

Computes product of a sparse matrix and a dense matrix.

Parameters
ACOO-Matrix.
BDense matrix (as a column-major ordered array).
CooMatrix operator* ( const CooMatrix A,
const Complex z 
)
inline

Computes product of a matrix and a complex number.

Parameters
ACOO-Matrix.
zNumber.
SymDiaMatrix operator* ( SymDiaMatrix const &  A,
SymDiaMatrix const &  B 
)
SymDiaMatrix operator* ( double  z,
SymDiaMatrix const &  A 
)
SymDiaMatrix operator* ( Complex  z,
SymDiaMatrix const &  A 
)
template<class T >
RowMatrix<T> operator+ ( RowMatrix< T > const &  A,
RowMatrix< T > const &  B 
)
CooMatrix operator+ ( const CooMatrix A,
const CooMatrix B 
)
inline

Computes a sum of two coo-matrices.

Parameters
ACOO-matrix.
BCOO-matrix.
SymDiaMatrix operator+ ( SymDiaMatrix const &  A,
SymDiaMatrix const &  B 
)
template<class T >
RowMatrix<T> operator- ( RowMatrix< T > const &  A,
RowMatrix< T > const &  B 
)
CooMatrix operator- ( const CooMatrix A,
const CooMatrix B 
)
inline

Computes a difference of two coo-matrices.

Parameters
ACOO-matrix.
BCOO-matrix.
SymDiaMatrix operator- ( SymDiaMatrix const &  A,
SymDiaMatrix const &  B 
)
template<class T >
RowMatrix<T> operator/ ( RowMatrix< T > const &  A,
x 
)
CsrMatrix operator^ ( const CsrMatrix A,
const CsrMatrix B 
)
inline

Computes a difference of two csr-matrices OF THE SAME SPARSE STRUCTURE.

CscMatrix operator^ ( const CscMatrix A,
const CscMatrix B 
)
inline

Computes a difference of two csc-matrices OF THE SAME SPARSE STRUCTURE.

CooMatrix stairs ( size_t  N)

Diagonal matrix with diagonal consisting of 0, 1, 2, 3, ..., N - 1.

Parameters
NDimension.