|
Janus 2.0.0
High-performance C++20 dual-mode numerical framework
|
Linear algebra operations (solve, inverse, determinant, eigendecomposition, norms). More...
#include "janus/core/JanusConcepts.hpp"#include "janus/core/JanusError.hpp"#include "janus/core/JanusTypes.hpp"#include "janus/math/Arithmetic.hpp"#include "janus/math/Logic.hpp"#include "janus/math/Trig.hpp"#include <Eigen/Dense>#include <Eigen/IterativeLinearSolvers>#include <Eigen/SparseCholesky>#include <Eigen/SparseLU>#include <Eigen/SparseQR>#include <algorithm>#include <array>#include <casadi/casadi.hpp>#include <cmath>#include <complex>#include <functional>#include <limits>#include <numeric>#include <string>#include <unsupported/Eigen/IterativeSolvers>#include <vector>

Go to the source code of this file.
Classes | |
| struct | janus::LinearSolvePolicy |
| Configuration for linear system solve backend and algorithm. More... | |
| class | janus::detail::FunctionalPreconditioner |
| struct | janus::EigenDecomposition< Scalar > |
| Result of eigendecomposition: eigenvalues and eigenvectors. More... | |
Namespaces | |
| namespace | janus |
| namespace | janus::detail |
| Smooth approximation of ReLU function: softplus(x) = (1/beta) * log(1 + exp(beta * x)). | |
Enumerations | |
| enum class | janus::LinearSolveBackend { janus::Dense , janus::SparseDirect , janus::IterativeKrylov } |
| Backend selection for linear system solves. More... | |
| enum class | janus::DenseLinearSolver { janus::ColPivHouseholderQR , janus::PartialPivLU , janus::FullPivLU , janus::LLT , janus::LDLT } |
| Dense linear solver algorithm. More... | |
| enum class | janus::SparseDirectLinearSolver { janus::SparseLU , janus::SparseQR , janus::SimplicialLLT , janus::SimplicialLDLT } |
| Sparse direct solver algorithm. More... | |
| enum class | janus::IterativeKrylovSolver { janus::BiCGSTAB , janus::GMRES } |
| Iterative Krylov solver algorithm. More... | |
| enum class | janus::IterativePreconditioner { janus::None , janus::Diagonal } |
| Preconditioner for iterative solvers. More... | |
| enum class | janus::NormType { janus::L1 , janus::L2 , janus::Inf , janus::Frobenius } |
| Norm type selection. More... | |
Functions | |
| void | janus::detail::validate_linear_solve_dims (Eigen::Index a_rows, Eigen::Index a_cols, Eigen::Index b_rows, const std::string &context) |
| void | janus::detail::validate_square_required (Eigen::Index rows, Eigen::Index cols, const std::string &context, const std::string &solver_name) |
| void | janus::detail::validate_iterative_policy (const LinearSolvePolicy &policy, const std::string &context) |
| std::function< NumericVector(const NumericVector &)> | janus::detail::make_preconditioner (const SparseMatrix &A, const LinearSolvePolicy &policy) |
| template<typename MatrixLike> | |
| SparseMatrix | janus::detail::dense_to_sparse (const MatrixLike &A) |
| template<typename DerivedB> | |
| auto | janus::detail::solve_sparse_direct_numeric (const SparseMatrix &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| template<typename Solver, typename DerivedB> | |
| auto | janus::detail::solve_iterative_with_solver (Solver &solver, const Eigen::MatrixBase< DerivedB > &b) |
| template<typename DerivedB> | |
| auto | janus::detail::solve_iterative_numeric (const SparseMatrix &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| template<typename DerivedA, typename DerivedB> | |
| auto | janus::detail::solve_dense_numeric (const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| template<typename DerivedA, typename DerivedB> | |
| auto | janus::solve (const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &b) |
| Solves linear system Ax = b using the default backend policy. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | janus::solve (const Eigen::MatrixBase< DerivedA > &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| Solves linear system Ax = b using an explicit backend policy. | |
| template<typename DerivedB> | |
| auto | janus::solve (const SparseMatrix &A, const Eigen::MatrixBase< DerivedB > &b) |
| Solve a numeric sparse linear system with a sparse-aware default backend. | |
| template<typename DerivedB> | |
| auto | janus::solve (const SparseMatrix &A, const Eigen::MatrixBase< DerivedB > &b, const LinearSolvePolicy &policy) |
| Solve a numeric sparse linear system using an explicit backend policy. | |
| template<typename DerivedX, typename DerivedY> | |
| auto | janus::outer (const Eigen::MatrixBase< DerivedX > &x, const Eigen::MatrixBase< DerivedY > &y) |
| Computes outer product x * y^T. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | janus::dot (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Computes dot product of two vectors. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | janus::cross (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Computes 3D cross product. | |
| template<typename Derived> | |
| auto | janus::inv (const Eigen::MatrixBase< Derived > &A) |
| Computes matrix inverse. | |
| template<typename Derived> | |
| auto | janus::det (const Eigen::MatrixBase< Derived > &A) |
| Computes matrix determinant. | |
| template<typename DerivedA, typename DerivedB> | |
| auto | janus::inner (const Eigen::MatrixBase< DerivedA > &a, const Eigen::MatrixBase< DerivedB > &b) |
| Computes inner product of two vectors (dot product). | |
| template<typename Derived> | |
| auto | janus::pinv (const Eigen::MatrixBase< Derived > &A) |
| Computes Moore-Penrose pseudo-inverse. | |
| template<typename Derived> | |
| auto | janus::norm (const Eigen::MatrixBase< Derived > &x, NormType type=NormType::L2) |
| Computes vector/matrix norm. | |
| template<typename Scalar> | |
| JanusVector< Scalar > | janus::detail::normalize_vector (const JanusVector< Scalar > &v) |
| template<typename Scalar> | |
| JanusVector< Scalar > | janus::detail::best_eigenvector_candidate (const std::array< JanusVector< Scalar >, 3 > &cands) |
| template<typename Scalar> | |
| JanusVector< Scalar > | janus::detail::symmetric_eigenvector_2x2 (const JanusMatrix< Scalar > &A, const Scalar &lambda) |
| template<typename Scalar> | |
| JanusVector< Scalar > | janus::detail::symmetric_eigenvector_3x3 (const JanusMatrix< Scalar > &A, const Scalar &lambda) |
| template<typename Scalar> | |
| Scalar | janus::detail::determinant_3x3 (const JanusMatrix< Scalar > &A) |
| template<typename Scalar> | |
| void | janus::detail::sort_eigenpairs (JanusVector< Scalar > &eigenvalues, JanusMatrix< Scalar > &eigenvectors) |
| template<typename Scalar> | |
| EigenDecomposition< Scalar > | janus::detail::eig_symmetric_symbolic (const JanusMatrix< Scalar > &A) |
| template<typename Derived> | |
| auto | janus::eig (const Eigen::MatrixBase< Derived > &A) |
| Computes the eigendecomposition of a square matrix with a real spectrum. | |
| template<typename Derived> | |
| auto | janus::eig_symmetric (const Eigen::MatrixBase< Derived > &A) |
| Computes the eigendecomposition of a symmetric matrix. | |
| template<typename T> | |
| std::tuple< T, T, T, T, T, T > | janus::inv_symmetric_3x3_explicit (const T &m11, const T &m22, const T &m33, const T &m12, const T &m23, const T &m13) |
| Explicit inverse of a symmetric 3x3 matrix. | |
| SparseMatrix | janus::sparse_from_triplets (int rows, int cols, const std::vector< SparseTriplet > &triplets) |
| Create sparse matrix from triplets. | |
| SparseMatrix | janus::to_sparse (const NumericMatrix &dense, double tol=0.0) |
| Convert dense matrix to sparse. | |
| NumericMatrix | janus::to_dense (const SparseMatrix &sparse) |
| Convert sparse matrix to dense. | |
| SparseMatrix | janus::sparse_identity (int n) |
| Create identity sparse matrix. | |
Variables | |
| template<typename Scalar> | |
| constexpr bool | janus::is_numeric_scalar_v = std::is_floating_point_v<Scalar> || std::is_integral_v<Scalar> |
| Compile-time check for numeric scalar types. | |
Linear algebra operations (solve, inverse, determinant, eigendecomposition, norms).