23 #include <boost/format.hpp> 38 double alpha = ATA(k, k);
41 if (alpha < negativePivotThreshold) {
43 }
else if (alpha < 0.0)
46 const double beta =
sqrt(alpha);
48 if (beta > zeroPivotThreshold) {
49 const double betainv = 1.0 / beta;
54 if (k < (order - 1)) {
57 BlockRow
V = ATA.row(k).segment(k + 1, order - (k + 1));
61 ATA.block(k + 1, k + 1, order - (k + 1), order - (k + 1)) -= V.transpose() *
V;
69 for (
size_t j = k + 1;
j < order; ++
j)
78 assert(ATA.rows() == ATA.cols());
81 const size_t n = ATA.rows();
87 assert(
size_t(order) <= n);
94 for (
size_t k = 0; k <
size_t(order); ++k) {
96 if (stepResult == 1) {
98 }
else if (stepResult == -1) {
104 return make_pair(maxrank, success);
113 assert(ABC.cols() == ABC.rows());
114 assert(
size_t(ABC.rows()) >= topleft);
115 const size_t n =
static_cast<size_t>(ABC.rows() - topleft);
116 assert(nFrontal <=
size_t(n));
119 auto A = ABC.block(topleft, topleft, nFrontal, nFrontal);
120 auto B = ABC.block(topleft, topleft + nFrontal, nFrontal, n - nFrontal);
121 auto C = ABC.block(topleft + nFrontal, topleft + nFrontal, n - nFrontal, n - nFrontal);
136 R.transpose().solveInPlace(
B);
142 C.selfadjointView<
Eigen::Upper>().rankUpdate(
B.transpose(), -1.0);
149 (void)
frexp(
R(nFrontal - 2, nFrontal - 2), &
exp2);
150 (void)
frexp(
R(nFrontal - 1, nFrontal - 1), &exp1);
151 return (exp2 - exp1 < underconstrainedExponentDifference);
152 }
else if (nFrontal == 1) {
154 (void)
frexp(
R(0, 0), &exp1);
155 return (exp1 > -underconstrainedExponentDifference);
const mpreal exp2(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
VectorBlock< Derived > SegmentReturnType
Traits::MatrixU matrixU() const
Rot2 R(Rot2::fromAngle(0.1))
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Matrix< SCALARB, Dynamic, Dynamic > B
ComputationInfo info() const
Reports whether previous computation was successful.
static const int underconstrainedExponentDifference
static const double zeroPivotThreshold
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static int choleskyStep(Matrix &ATA, size_t k, size_t order)
const mpreal frexp(const mpreal &x, mp_exp_t *exp, mp_rnd_t mode=mpreal::get_default_rnd())
Matrix< Scalar, Dynamic, Dynamic > C
bool choleskyPartial(Matrix &ABC, size_t nFrontal, size_t topleft)
static const double negativePivotThreshold
static const double underconstrainedPrior
pair< size_t, bool > choleskyCareful(Matrix &ATA, int order)
Efficient incomplete Cholesky on rank-deficient matrices, todo: constrained Cholesky.