|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Online Householder QR solver for least-squares problems with block-arrowhead structure. More...
#include <online_householder_qr.h>
Public Types | |
| using | MatrixType = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> |
| using | VectorType = Eigen::Matrix<T, Eigen::Dynamic, 1> |
Public Member Functions | |
| OnlineBlockHouseholderQR (Eigen::Index n_common, T lambda=T(0)) | |
Constructs a solver for problems with n_common shared unknowns. | |
| void | add (size_t iBlock, MatrixType A_diag, MatrixType A_common, VectorType b) |
| Copying overload of addMutating(). | |
| void | addMutating (size_t iBlock, Eigen::Ref< MatrixType > A_diag, Eigen::Ref< MatrixType > A_common, Eigen::Ref< VectorType > b) |
| In-place addition; convenience wrapper that wraps the matrices in ColumnIndexedMatrix views without remapping. | |
| void | addMutating (size_t iBlock, ColumnIndexedMatrix< MatrixType > A_diag, ColumnIndexedMatrix< MatrixType > A_common, Eigen::Ref< VectorType > b) |
In-place addition that also accepts column-remapped views, so callers can pass arbitrary subsets of the columns in A_diag and A_common. | |
| VectorType | x_dense () const |
| Retrieves the full dense result [x_0; x_1; ...; x_{B-1}; x_n]. | |
| VectorType | x_i (size_t iBlock) const |
Retrieves the answer for a single diagonal block iBlock. | |
| VectorType | x_n () const |
| Retrieves the answer for just the final "common" rows. | |
| const MatrixType & | R_ii (size_t iBlock) const |
| const VectorType & | y_i (size_t iBlock) const |
| MatrixType | R_dense () const |
| MatrixType | y_dense () const |
| VectorType | At_times_b_i (size_t iBlock) const |
| VectorType | At_times_b_n () const |
| VectorType | At_times_b_dense () const |
| T | At_times_b_dot (Eigen::Ref< const VectorType > rhs) const |
| void | reset () |
Online Householder QR solver for least-squares problems with block-arrowhead structure.
Solves
where A has the block structure
i.e. independent diagonal blocks A_ii (one set of disjoint x_i per block) plus a shared set of "common" columns A_in that are used by every block.
This is the case for calibration problems, where each hand pose is independent but a shared set of calibration parameters connects them.
Besides the blockwise structure, the behavior of this solver is identical to OnlineHouseholderQR — see that class's notes for the algorithmic details. The key takeaway is that this can be used in an online fashion: poses are passed in one at a time and the Jacobians can then be thrown away.
n_common and (optionally) lambda damping. Diagonal block sizes are inferred from each add() call.iBlock index. Internal R_ii_, R_in_, R_nn_, y_i_, and y_n_ are mutated incrementally.Definition at line 260 of file online_householder_qr.h.
| using momentum::OnlineBlockHouseholderQR< T >::MatrixType = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> |
Definition at line 262 of file online_householder_qr.h.
| using momentum::OnlineBlockHouseholderQR< T >::VectorType = Eigen::Matrix<T, Eigen::Dynamic, 1> |
Definition at line 263 of file online_householder_qr.h.
|
explicit |
Constructs a solver for problems with n_common shared unknowns.
Per-block unknown counts are determined from the first add() call for each block. lambda implements LM-style damping, emulating
without materializing the extra rows.
Definition at line 249 of file online_householder_qr.cpp.
|
inline |
Copying overload of addMutating().
Definition at line 277 of file online_householder_qr.h.
References addMutating().
| void momentum::OnlineBlockHouseholderQR< T >::addMutating | ( | size_t | iBlock, |
| ColumnIndexedMatrix< MatrixType > | A_diag, | ||
| ColumnIndexedMatrix< MatrixType > | A_common, | ||
| Eigen::Ref< VectorType > | b ) |
In-place addition that also accepts column-remapped views, so callers can pass arbitrary subsets of the columns in A_diag and A_common.
| iBlock | Index identifying the diagonal block this contribution belongs to. The first call with a given iBlock fixes the size of R_ii_[iBlock]; later calls must provide a matching A_diag.cols(). |
| A_diag | Block-local Jacobian columns for this iBlock. A_diag.cols() defines the per-block unknown count. |
| A_common | Jacobian columns for the shared unknowns. Must have n_common columns. |
| b | Residual vector with A_diag.rows() entries. |
A_diag, A_common, and b are arbitrary on return. Definition at line 257 of file online_householder_qr.cpp.
References momentum::ColumnIndexedMatrix< MatrixType >::col(), momentum::ColumnIndexedMatrix< MatrixType >::cols(), MT_CHECK, R_ii(), momentum::ColumnIndexedMatrix< MatrixType >::rows(), and y_i().
|
inline |
In-place addition; convenience wrapper that wraps the matrices in ColumnIndexedMatrix views without remapping.
Definition at line 283 of file online_householder_qr.h.
References addMutating().
Referenced by add(), addMutating(), and momentum::MultiposeSolverT< T >::doIteration().
|
nodiscard |
Definition at line 477 of file online_householder_qr.cpp.
References y_i().
Referenced by At_times_b_dot().
|
nodiscard |
Definition at line 501 of file online_householder_qr.cpp.
References At_times_b_dense().
|
nodiscard |
Definition at line 457 of file online_householder_qr.cpp.
|
nodiscard |
Definition at line 466 of file online_householder_qr.cpp.
|
nodiscard |
Definition at line 365 of file online_householder_qr.cpp.
|
inlinenodiscard |
Definition at line 332 of file online_householder_qr.h.
Referenced by addMutating(), and R_dense().
| void momentum::OnlineBlockHouseholderQR< T >::reset | ( | ) |
Definition at line 506 of file online_householder_qr.cpp.
|
nodiscard |
Retrieves the full dense result [x_0; x_1; ...; x_{B-1}; x_n].
Definition at line 414 of file online_householder_qr.cpp.
References x_n().
Referenced by momentum::MultiposeSolverT< T >::doIteration().
|
nodiscard |
Retrieves the answer for a single diagonal block iBlock.
Definition at line 450 of file online_householder_qr.cpp.
|
nodiscard |
Retrieves the answer for just the final "common" rows.
Definition at line 445 of file online_householder_qr.cpp.
Referenced by x_dense().
|
nodiscard |
Definition at line 391 of file online_householder_qr.cpp.
References y_i().
|
inlinenodiscard |
Definition at line 336 of file online_householder_qr.h.
Referenced by addMutating(), At_times_b_dense(), and y_dense().