(directory ngsolve/basiclinalg)The basic linear algebra is implemented by expression templates. This allows to write matrix and vector operations in a convenient way such as
There is no compromise to efficiency. In particular, ther is now frequent allocation and dealloction of dynamic objects. The generated code is comparable to a manually optimized one.
The main idea is the following: The operator* (matrix, vector) returns a symbolic object matrix-vector product without evaluating it. The computations are done in the assignement, where the required memory for storing the result is available.
A good introduction to expression templates is "Techniques for Scientific C++" by Todd Veldhuizen.
The following vector types are available: Vec, FlatVector, Vector, VectorMem, SliceVector
The following matrix types are available: Mat, Matrix, MatrixFixWidth, MatrixFixHeight, SymBandMatrix, BandCholeskyFactors.
Again, there are corresponding matrix types without memory management: FlatMatrix, FlatMatrixFixWidth, FlatMatrixFixHeight, FlatSymBandMatrix, FlatBandCholeskyFactors,
NGBLA provides the canonical operators (+,-,*,+=, -=) for matrices and vectors. Additionally, the following functions are avialable: Trans, Inv, Height, Width, Trace, InnerProduct, L2Norm, Det
Implemented algorithms are Inversion CalcInverse, Eigenvalue computation EigenSystem
Alphabetic index Hierarchy of classes