5template <
typename Scalar>
30 const Scalar dwarf = (std::numeric_limits<Scalar>::min)();
42 for (
j = 0;
j <
n; ++
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);
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();
102 par = (std::max)(par,
parl);
103 par = (std::min)(par,
paru);
114 wa1 = sqrt(par)* diag;
119 wa2 = diag.cwiseProduct(
x);
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;
163template <
typename Scalar>
188 const Scalar dwarf = (std::numeric_limits<Scalar>::min)();
189 const Index n =
qr.matrixQR().cols();
204 x =
qr.colsPermutation()*wa1;
210 wa2 = diag.cwiseProduct(
x);
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;
240 par = (std::max)(par,
parl);
241 par = (std::min)(par,
paru);
253 wa1 = sqrt(par)* diag;
258 wa2 = diag.cwiseProduct(
x);
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;
int n
Definition BiCGSTAB_simple.cpp:1
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define eigen_assert(x)
Definition Macros.h:1037
SCALAR Scalar
Definition bench_gemm.cpp:46
Householder rank-revealing QR decomposition of a matrix with column-pivoting.
Definition ColPivHouseholderQR.h:53
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition PlainObjectBase.h:145
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition CwiseNullaryOp.h:562
#define abs(x)
Definition datatypes.h:17
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
Definition gnuplot_common_settings.hh:12
A triangularView< Lower >().adjoint().solveInPlace(B)
RealScalar s
Definition level1_cplx_impl.h:126
void lmpar2(const QRSolver &qr, const VectorType &diag, const VectorType &qtb, typename VectorType::Scalar m_delta, typename VectorType::Scalar &par, VectorType &x)
Definition LMpar.h:20
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)
Definition lmpar.h:6
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Definition Meta.h:66
Definition BandTriangularSolver.h:13
void qr()
Definition qr_colpivoting.cpp:99
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2