|
ADS
Algorithms and Data Structures
|
The matrices of ADS as matrices of Eigen (https://eigen.tuxfamily.org), so that the solvers, the decompositions and the products of Eigen run on them, beyond the book: More...
#include "ADS/Contract.h"#include "ADS/numeric/CsrMatrix.h"#include "ADS/numeric/DenseMatrix.h"#include <Eigen/Core>#include <Eigen/SparseCore>#include <algorithm>#include <concepts>#include <cstddef>#include <cstdint>#include <limits>#include <tuple>#include <utility>#include <vector>Go to the source code of this file.
Namespaces | |
| namespace | ADS |
| namespace | ADS::eigen |
Typedefs | |
| template<class T> | |
| using | ADS::eigen::RowMatrix |
| a dense matrix of Eigen by rows, the layout of DenseMatrix | |
| template<class T, class I = int> | |
| using | ADS::eigen::RowSparse = Eigen::SparseMatrix< T , Eigen::RowMajor , I > |
| a sparse matrix of Eigen by rows, of the index type I | |
Functions | |
| template<class T> | |
| Eigen::Map< RowMatrix< T > > | ADS::eigen::map (DenseMatrix< T > &A) |
| the entries of \( A \) as a dense matrix of Eigen, with no copy | |
| template<class T> | |
| Eigen::Map< const RowMatrix< T > > | ADS::eigen::map (const DenseMatrix< T > &A) |
| the entries of a constant \( A \) as a dense matrix of Eigen, with no copy | |
| template<class T, std::signed_integral I> | |
| Eigen::Map< const RowSparse< T, I > > | ADS::eigen::map (const BasicCsrMatrix< T, I, I > &A) |
| \( A \) as a sparse matrix of Eigen by rows, its offsets, columns and values read in place: the columns and the offsets of one signed type, the StorageIndex of Eigen | |
| template<class S = int, class T, class I, class P> | |
| RowSparse< T, S > | ADS::eigen::toEigen (const BasicCsrMatrix< T, I, P > &A) |
| \( A \) copied into a sparse matrix of Eigen by rows of the index type S, in \( O( m + \mathit{nnz} ) \) time, for the layouts that map() does not take | |
| template<class I = std::uint32_t, class P = detail::CsrOffset< I >, class D> | |
| BasicCsrMatrix< typename D::Scalar, I, P > | ADS::eigen::fromEigen (const Eigen::SparseMatrixBase< D > &S) |
| the sparse expression \( S \) of Eigen copied into a BasicCsrMatrix of the columns I and the offsets P, by its triplets | |
The matrices of ADS as matrices of Eigen (https://eigen.tuxfamily.org), so that the solvers, the decompositions and the products of Eigen run on them, beyond the book:
Eigen has its own sparse and dense matrices, and ADS does not replace them: a program that keeps its data in the structures of ADS calls Eigen on them through these views, and the copies are only for the layouts that Eigen cannot read.
This header is of the set interop: no entry point of ADS includes it, and it needs the headers of Eigen (3.4 or later), found by CMake when ADS_WITH_EIGEN is AUTO or ON (the target ADS::Eigen). The contracts [see Contract.h]: a map does not outlive its matrix, nor sees a matrix that changes its size; the indices of a copy fit its type.