![]() |
algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
|
The math types and decompositions, implemented with Eigen. More...
#include "./scalar.hpp"#include <Eigen/Dense>#include <cstddef>Go to the source code of this file.
Classes | |
| struct | algotradelib::math::Observed |
| A series split into zero-filled values and a presence mask, for sums that skip gaps. More... | |
Namespaces | |
| namespace | algotradelib |
| The library: broker-neutral types (core), and the modules below. | |
| namespace | algotradelib::math |
| The numeric vocabulary: Scalar, missing(), and the matrix and vector types. | |
Typedefs | |
| using | algotradelib::math::Matrix = Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor> |
| A dense, column-major matrix of Scalar. | |
| using | algotradelib::math::Vector = Eigen::Matrix<Scalar, Eigen::Dynamic, 1> |
| A dense column vector of Scalar. | |
| using | algotradelib::math::SeriesView = Eigen::Ref<const Vector> |
| A read-only reference to one series. | |
| using | algotradelib::math::MutableSeriesView = Eigen::Ref<Vector> |
| A writable reference to one series, such as a Vector or a column of a Matrix. | |
| using | algotradelib::math::MatrixView = Eigen::Ref<const Matrix> |
| A read-only reference to a whole matrix. | |
| using | algotradelib::math::Index = Eigen::Index |
| The signed index type of rows and columns. | |
| using | algotradelib::math::Llt = Eigen::LLT<Matrix> |
| Cholesky decomposition of a symmetric positive-definite matrix. Check info(). | |
| using | algotradelib::math::Ldlt = Eigen::LDLT<Matrix> |
| Pivoting Cholesky (LDLT) decomposition of a symmetric, possibly semi-definite matrix. | |
| using | algotradelib::math::HouseholderQr = Eigen::HouseholderQR<Matrix> |
| Householder QR decomposition: the fastest QR, with no rank information. | |
| using | algotradelib::math::ColPivQr = Eigen::ColPivHouseholderQR<Matrix> |
| Column-pivoting Householder QR: a least-squares solution and a rank. | |
| using | algotradelib::math::FullPivQr = Eigen::FullPivHouseholderQR<Matrix> |
| Full-pivoting Householder QR: slower than ColPivQr, with the most reliable rank. | |
| using | algotradelib::math::FullPivLu = Eigen::FullPivLU<Matrix> |
| LU decomposition with full pivoting, for a square system with no known structure. | |
| using | algotradelib::math::Svd = Eigen::BDCSVD<Matrix> |
| Divide-and-conquer SVD: minimum-norm least-squares solutions and singular values. | |
| using | algotradelib::math::SelfAdjointEigen = Eigen::SelfAdjointEigenSolver<Matrix> |
| Eigenvalues (ascending) and eigenvectors of a symmetric matrix. Check info(). | |
Functions | |
| Vector | algotradelib::math::unobserved (std::size_t count) |
| Makes a vector filled with missing(). | |
| Matrix | algotradelib::math::unobserved (std::size_t rows, std::size_t columns) |
| Makes a matrix filled with missing(). | |
| Observed | algotradelib::math::observed_parts (SeriesView values) |
| Splits a series into zero-filled values and a presence mask. | |
| Vector | algotradelib::math::observed_or (SeriesView values, Scalar filler) |
| Replaces every unobserved entry of a series. | |
| Vector | algotradelib::math::both_present (const Vector &left, const Vector &right) |
| Combines two presence masks: 1 only where both series are observed. | |
| Svd | algotradelib::math::thin_svd (const Matrix &a) |
| Computes a thin SVD, ready to solve(). | |
Variables | |
| constexpr unsigned int | algotradelib::math::LOWER = Eigen::Lower |
| Selects the lower triangle, as in matrix.selfadjointView<math::LOWER>(). | |
| constexpr unsigned int | algotradelib::math::UPPER = Eigen::Upper |
| Selects the upper triangle. | |
| constexpr unsigned int | algotradelib::math::UNIT_LOWER = Eigen::UnitLower |
| Selects the lower triangle with an implicit unit diagonal. | |
| constexpr unsigned int | algotradelib::math::UNIT_UPPER = Eigen::UnitUpper |
| Selects the upper triangle with an implicit unit diagonal. | |
| constexpr auto | algotradelib::math::SUCCESS = Eigen::Success |
| The value a decomposition's info() returns on success. | |
The math types and decompositions, implemented with Eigen.
Include math/matrix.hpp rather than this header. Write against the math:: names (math::SeriesView, math::ColPivQr, ...) rather than the Eigen types behind them.
The decompositions are Eigen's own classes under math:: names; use their Eigen interfaces directly:
Matrix::ldlt(), Matrix::colPivHouseholderQr() and the other member forms work too, as does A.fullPivLu().solve(b) for a square system where no structure is known.
Definition in file eigen.hpp.