![]() |
Dem Bones
1.2.0
Skinning Decomposition Library
|
Linear least squares solver with non-negativity constraint and optional affinity constraint. More...
#include "DemBones/ConvexLS.h"
Public Types | |
using | MatrixX = Eigen::Matrix< _Scalar, Eigen::Dynamic, Eigen::Dynamic > |
using | VectorX = Eigen::Matrix< _Scalar, Eigen::Dynamic, 1 > |
Public Member Functions | |
ConvexLS (int maxSize=1) | |
void | init (int maxSize) |
void | solve (const MatrixX &aTa, const VectorX &aTb, VectorX &x, bool affine, bool warmStart=false) |
Linear least squares solver with non-negativity constraint and optional affinity constraint.
Solve:
\begin{eqnarray*} min &||Ax-b||^2 \\ \mbox{Subject to: } & x(0).. x(n-1) \geq 0, \\ \mbox{(optional) } & x(0) +.. + x(n-1) = 1 \end{eqnarray*}
The solver implements active set method to handle non-negativity constraint and QR decomposition to handle affinity constraint.
_Scalar is the floating-point data type.
Definition at line 31 of file ConvexLS.h.
using Dem::ConvexLS< _Scalar >::MatrixX = Eigen::Matrix<_Scalar, Eigen::Dynamic, Eigen::Dynamic> |
Definition at line 34 of file ConvexLS.h.
using Dem::ConvexLS< _Scalar >::VectorX = Eigen::Matrix<_Scalar, Eigen::Dynamic, 1> |
Definition at line 35 of file ConvexLS.h.
|
inline |
Constructor, just call init()
[in] | maxSize | is the maximum size of the unknown \( x \) if the affinity constraint is imposed. |
Definition at line 40 of file ConvexLS.h.
|
inline |
Init matrices \( Q \) in the QR decomposition used for affinity constraint
[in] | maxSize | is the maximum size of the unknown \( x \) if the affinity constraint is imposed. |
Definition at line 48 of file ConvexLS.h.
|
inline |
Solve the least squares problem
[in] | aTa | is the cross product matrix \( A^TA \) |
[in] | aTb | is the vector \( A^Tb \) |
[in,out] | x | is the by-reference output and it is also the init solution (if warmStart == true ) |
[in] | affine=true | will impose affinity constraint |
[in] | warmStart=true | will initialize the solution by x |
Definition at line 65 of file ConvexLS.h.