Go to the documentation of this file.
5 template <
typename Scalar>
42 for (
j = 0;
j <
n; ++
j) {
43 if (r(
j,
j) == 0. && nsing ==
n-1)
48 for (
j = nsing;
j>=0; --
j) {
51 for (
i = 0;
i <
j ; ++
i)
52 wa1[
i] -= r(
i,
j) * temp;
55 for (
j = 0;
j <
n; ++
j)
62 wa2 =
diag.cwiseProduct(
x);
63 dxnorm = wa2.blueNorm();
75 for (
j = 0;
j <
n; ++
j) {
77 wa1[
j] =
diag[
l] * (wa2[
l] / dxnorm);
81 for (
j = 0;
j <
n; ++
j) {
83 for (
i = 0;
i <
j; ++
i)
84 sum += r(
i,
j) * wa1[
i];
85 wa1[
j] = (wa1[
j] - sum) / r(
j,
j);
87 temp = wa1.blueNorm();
88 parl = fp /
delta / temp / temp;
92 for (
j = 0;
j <
n; ++
j)
93 wa1[
j] = r.col(
j).head(
j+1).dot(qtb.head(
j+1)) /
diag[ipvt[
j]];
95 gnorm = wa1.stableNorm();
105 par = gnorm / dxnorm;
117 qrsolv<Scalar>(r, ipvt, wa1, qtb,
x, sdiag);
119 wa2 =
diag.cwiseProduct(
x);
120 dxnorm = wa2.blueNorm();
127 if (
abs(fp) <=
Scalar(0.1) *
delta || (parl == 0. && fp <= temp && temp < 0.) ||
iter == 10)
131 for (
j = 0;
j <
n; ++
j) {
133 wa1[
j] =
diag[
l] * (wa2[
l] / dxnorm);
135 for (
j = 0;
j <
n; ++
j) {
138 for (
i =
j+1;
i <
n; ++
i)
139 wa1[
i] -= r(
i,
j) * temp;
141 temp = wa1.blueNorm();
142 parc = fp /
delta / temp / temp;
163 template <
typename Scalar>
189 const Index n =
qr.matrixQR().cols();
202 qr.matrixQR().topLeftCorner(rank, rank).template triangularView<Upper>().solveInPlace(wa1.head(rank));
204 x =
qr.colsPermutation()*wa1;
210 wa2 =
diag.cwiseProduct(
x);
211 dxnorm = wa2.blueNorm();
223 wa1 =
qr.colsPermutation().inverse() *
diag.cwiseProduct(wa2)/dxnorm;
225 temp = wa1.blueNorm();
226 parl = fp /
delta / temp / temp;
230 for (
j = 0;
j <
n; ++
j)
231 wa1[
j] =
qr.matrixQR().col(
j).head(
j+1).dot(qtb.head(
j+1)) /
diag[
qr.colsPermutation().indices()(
j)];
233 gnorm = wa1.stableNorm();
234 paru = gnorm /
delta;
243 par = gnorm / dxnorm;
256 qrsolv<Scalar>(
s,
qr.colsPermutation().indices(), wa1, qtb,
x, sdiag);
258 wa2 =
diag.cwiseProduct(
x);
259 dxnorm = wa2.blueNorm();
266 if (
abs(fp) <=
Scalar(0.1) *
delta || (parl == 0. && fp <= temp && temp < 0.) ||
iter == 10)
270 wa1 =
qr.colsPermutation().inverse() *
diag.cwiseProduct(wa2/dxnorm);
273 for (
j = 0;
j <
n; ++
j) {
277 wa1[
i] -=
s(
i,
j) * temp;
279 temp = wa1.blueNorm();
280 parc = fp /
delta / temp / temp;
Namespace containing all symbols from the Eigen library.
Matrix diag(const std::vector< Matrix > &Hs)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
void lmpar2(const QRSolver &qr, const VectorType &diag, const VectorType &qtb, typename VectorType::Scalar m_delta, typename VectorType::Scalar &par, VectorType &x)
void lmpar(Matrix< Scalar, Dynamic, Dynamic > &r, const VectorXi &ipvt, const Matrix< Scalar, Dynamic, 1 > &diag, const Matrix< Scalar, Dynamic, 1 > &qtb, Scalar delta, Scalar &par, Matrix< Scalar, Dynamic, 1 > &x)
static const Line3 l(Rot3(), 1, 1)
Householder rank-revealing QR decomposition of a matrix with column-pivoting.
HouseholderQR< MatrixXf > qr(A)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
iterator iter(handle obj)
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
A triangularView< Lower >().adjoint().solveInPlace(B)
Jet< T, N > sqrt(const Jet< T, N > &f)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:55