Example 1 - Cholesky Decomposition

This example computes the cholesky decomposition L of a symmetric positive matrix A: LLT = A

The example shows the use of dense, triangular and banded matrices and corresponding adapters.

cholesky.hpp header file: defines templates doing the decomposition.
cholesky_test.cpp main file: containes test methods and helper functions.

Example 2 - Solve a System of Linear Equations

This example computes the solution x of the system Ax=b of linear equations using the iterative method of conjugate gradients. The influence of different preconditioners can be seen. The numer of iterations of the original CG, a diagonal preconditioner, a cholesky preconditioner and an incomplete cholesky preconditioner can be compared.

Note:The structure of the matrix is chosen such that the incomplete cholesky is equivalent to the comlete cholesky decomposition.

This example shows the usage of sparse matrices and demonstrates some template programming techniques.

cholesky.hpp header file: defines templates doing the decomposition.
precond.hpp header file: defines template classes defining the preconditioners.
pcg.hpp header file: defines template functions of the conjugate gradient iteration.
pcg_test.cpp main file: defines templates doing the decomposition.

Example 3 - a read only adapter

This example implements a (minimal) read only array adaptor which can be used to create ublas data structures using a prepared chunk of memory as underlying storage.

storage_adaptors.hpp template header file: contains class readonly_array_adaptor.
point.h template header for a small fixed size vector class using storage adaptors
ex_ro_adapt.cpp example file that shows the usage of these adaptors

Example 4 - reading and writing sparse matrices

This example implements a method to read and write sparse matrices as triplets.

sparse_io.cpp example for sparse matrix i/o.
sparse_matrices.zip some sparse matrices in triplet form. (see README inside)

Example 5 - scatter and gather

This example provides simple scatter/gather and AXPY operations for sparse vectors. The code needs some clean up and it should be optimized much more.

scatter-gather.hpp Scatter/gather operations and working_row class.
scatter_main.cpp Sample application an benchmark using scatter/gather operations.

Example 6 - Solve a System of Linear Equations using GMRES

This example computes the solution x of the system Ax=b of linear equations using the iterative method of generalized minimal residuals.

This example shows the usage of sparse matrices and demonstrates some template programming techniques.

orthogonal.hpp header file: GMRES implementation, orthogonalization of vectors.
lin_op.hpp header file: linear operator wrapper for ublas matrices.
precond.hpp header file: defines template classes defining the preconditioners.
cholesky.hpp header file: defines templates doing the decomposition. (not used, but included from precond.hpp)
main_gmres.cpp main file: example of calling GMRES.

License

All files here are provided under the Boost Software License, Version 1.0, unless the file itself contains other license information.

Contributions from other people

Matrix exponential

Purpose: compute exp(A) for a real or complex matrix.

Author: Tsai, Dung-Bang

expm.hpp header file: EXPGM_PAD computes the matrix exponential exp(H) for general matrixs.
expm_sample.cpp main file: example of using expm_pad() to compute rotation matrix around z axis.