CGAL 4.13 - CGAL and Solvers
|
Several CGAL packages have to solve linear systems with dense or sparse matrices. This package provides concepts and models for that purpose.
We generally provide models using the Eigen library. Wrappers for the Eigen classes Eigen_matrix
and Eigen_vector
are also provided when needed.
It is straightforward to develop equivalent models for other solvers, for example those found in the Intel Math Kernel Library (MKL).
The concept DiagonalizeTraits<T,dim>
defines an interface for the diagonalization and computation of eigenvectors and eigenvalues of a symmetric matrix. T
is the number type and dim
is the dimension of the matrices and vector (set to 3 by default). We provide the model Eigen_diagonalize_traits<T,dim>
that uses the Eigen library.
This is an example of an eigen decomposition of a matrix using this class:
File Solver_interface/diagonalize_matrix.cpp
The concept SvdTraits
defines an interface for solving in the least square sense a linear system with a singular value decomposition. The field type is double
. We provide the model Eigen_svd
that uses the Eigen library.
Here is a simple example that shows how to handle matrices, vectors and this solver:
File Solver_interface/singular_value_decomposition.cpp
We define 3 concepts for sparse linear algebra:
SparseLinearAlgebraTraits_d
SparseLinearAlgebraWithFactorTraits_d
NormalEquationSparseLinearAlgebraTraits_d
An interface to the sparse solvers from the Eigen library is provided as a model for these 3 concepts through the class Eigen_solver_traits<T>
. This solver traits class can be used for an iterative or a direct, symmetric or general sparse solvers. The specific solver to be used must be given as template parameter.
Each CGAL package using a sparse solver specifies which type of matrix and solver is required:
Here is an example that shows how to fill the sparse matrix and call the solver:
File Solver_interface/sparse_solvers.cpp
This package is the result of the increasing needs for linear solvers in CGAL. The first packages that introduced the solver concepts were Triangulated Surface Mesh Parameterization Reference, Poisson Surface Reconstruction Reference and Estimation of Local Differential Properties of Point-Sampled Surfaces Reference. At that time, these packages were relying on Taucs, LAPACK, BLAS and OpenNL. Gaël Guennebaud then introduced new models using the Eigen library that became the only supported models by CGAL. Later on the packages Triangulated Surface Mesh Skeletonization and Triangulated Surface Mesh Deformation extended the existing concepts.
Simon Giraudot was responsible for gathering all concepts and classes, and also wrote this user manual with the help of Andreas Fabri.