smooth_feedback
Control and estimation on Lie groups
|
Sparse matrix utilities. More...
#include <numeric>
#include <optional>
#include <Eigen/Sparse>
Go to the source code of this file.
Functions | |
template<typename Source , int Options> requires (std::is_base_of_v<Eigen::EigenBase<Source>, Source>) | |
void | smooth::feedback::block_add (Eigen::SparseMatrix< double, Options > &dest, Eigen::Index row0, Eigen::Index col0, const Source &source, double scale=1, bool upper_only=false) |
Add block into a sparse matrix. More... | |
template<typename Source , int Options> requires (std::is_base_of_v<Eigen::EigenBase<Source>, Source>) | |
void | smooth::feedback::block_write (Eigen::SparseMatrix< double, Options > &dest, Eigen::Index row0, Eigen::Index col0, const Source &source, double scale=1, bool upper_only=false) |
Write block into a sparse matrix. More... | |
template<int Options> | |
void | smooth::feedback::block_add_identity (Eigen::SparseMatrix< double, Options > &dest, Eigen::Index row0, Eigen::Index col0, Eigen::Index n, double scale=1) |
Add identity matrix block into sparse matrix. More... | |
template<int Options> | |
void | smooth::feedback::block_write_identity (Eigen::SparseMatrix< double, Options > &dest, Eigen::Index row0, Eigen::Index col0, Eigen::Index n, double scale=1) |
Write identity matrix block into sparse matrix. More... | |
template<typename SparseMat > requires (std::is_base_of_v<Eigen::SparseCompressedBase<std::decay_t<SparseMat>>, std::decay_t<SparseMat>>) | |
void | smooth::feedback::set_zero (SparseMat &&mat) |
Zero a sparse matrix expression without changing allocation. More... | |
template<typename Mat > requires (std::is_base_of_v<Eigen::EigenBase<Mat>, Mat>) | |
uint64_t | smooth::feedback::count_explicit_zeros (const Mat &mat) |
Count number of explicit zeros in sparse matrix. More... | |
template<typename Mat > requires (std::is_base_of_v<Eigen::EigenBase<Mat>, Mat>) | |
Eigen::MatrixX< typename Mat::Scalar > | smooth::feedback::mark_explicit_zeros (const Mat &mat) |
Mark explicit zeros in sparse matrix. More... | |
template<typename S1 , typename S2 , typename S3 , typename S4 > requires (std::is_base_of_v<Eigen::EigenBase<S1>, S1> && std::is_base_of_v<Eigen::EigenBase<S2>, S2> && std::is_base_of_v<Eigen::EigenBase<S3>, S3> && std::is_base_of_v<Eigen::EigenBase<S4>, S4>) | |
void | smooth::feedback::d2r_fog (Eigen::SparseMatrix< double > &out, const S1 &Jf, const S2 &Hf, const S3 &Jg, const S4 &Hg, Eigen::Index r0=0, Eigen::Index c0=0) |
(Right) Hessian of composed function \( (f \circ g)(x) \). More... | |
Sparse matrix utilities.
Definition in file sparse.hpp.
|
inline |
Add block into a sparse matrix.
After this function the output variable dest is s.t.
dest[row0 + r, col0 + c] += scale * source[r, c]
dest | destination |
row0 | starting row for block |
col0 | starting column for block |
source | block values |
scale | scaling parameter |
upper_only | only add into upper triangular part |
Definition at line 35 of file sparse.hpp.
|
inline |
Add identity matrix block into sparse matrix.
After this function the output variable dest is s.t.
dest[row0 + k, col0 + k] += scale, k = 0...n-1
dest | destination |
row0 | starting row for block |
col0 | starting column for block |
n | size of identity matrix |
scale | scaling parameter |
Definition at line 103 of file sparse.hpp.
|
inline |
Write block into a sparse matrix.
After this function the output variable dest is s.t.
dest[row0 + r, col0 + c] = scale * source[r, c]
dest | destination |
row0 | starting row for block |
col0 | starting column for block |
source | block values |
scale | scaling parameter |
upper_only | only add into upper triangular part |
Definition at line 70 of file sparse.hpp.
|
inline |
Write identity matrix block into sparse matrix.
After this function the output variable dest is s.t.
dest[row0 + k, col0 + k] += scale, k = 0...n-1
dest | destination |
row0 | starting row for block |
col0 | starting column for block |
n | size of identity matrix |
scale | scaling parameter |
Definition at line 125 of file sparse.hpp.
uint64_t smooth::feedback::count_explicit_zeros | ( | const Mat & | mat | ) |
Count number of explicit zeros in sparse matrix.
mat | sparse matrix |
Definition at line 158 of file sparse.hpp.
|
inline |
(Right) Hessian of composed function \( (f \circ g)(x) \).
[out] | out | result [No x No*Nx] |
[in] | Jf | (Right) Jacobian of f at y = g(x) [No x Ny ] |
[in] | Hf | (Right) Hessian of f at y = g(x) [Ny x No*Ny] |
[in] | Jg | (Right) Jacobian of g at x [Ny x Nx ] |
[in] | Hg | (Right) Hessian of g at x [Nx x Ny*Nx] |
[in] | r0 | row to insert result |
[in] | r0 | col to insert result |
Definition at line 213 of file sparse.hpp.
Eigen::MatrixX< typename Mat::Scalar > smooth::feedback::mark_explicit_zeros | ( | const Mat & | mat | ) |
Mark explicit zeros in sparse matrix.
mat | sparse matrix |
Returns a matrix that has values as follows:
Definition at line 181 of file sparse.hpp.
|
inline |
Zero a sparse matrix expression without changing allocation.
Definition at line 140 of file sparse.hpp.