5 template <
typename Scalar>
20 Scalar
sum, temp, alpha, bnorm;
26 const Index n = qrfac.
cols();
33 for (j = n-1; j >=0; --j) {
36 temp = epsmch * qrfac.col(j).head(j+1).maxCoeff();
43 x[j] = (qtb[j] - qrfac.row(j).tail(n-j-1).dot(x.tail(n-j-1))) / temp;
47 qnorm = diag.cwiseProduct(x).stableNorm();
57 for (j = 0; j < n; ++j) {
58 wa1.tail(n-j) += qrfac.row(j).tail(n-j) * qtb[j];
64 gnorm = wa1.stableNorm();
66 alpha = delta / qnorm;
72 wa1.array() /= (diag*gnorm).
array();
75 for (j = 0; j < n; ++j) {
77 for (i = j; i < n; ++i) {
78 sum += qrfac(j,i) * wa1[i];
82 temp = wa2.stableNorm();
83 sgnorm = gnorm / temp / temp;
93 bnorm = qtb.stableNorm();
94 temp = bnorm / gnorm * (bnorm / qnorm) * (sgnorm / delta);
96 alpha = delta / qnorm * (1. -
numext::abs2(sgnorm / delta)) / temp;
101 temp = (1.-alpha) * (std::min)(sgnorm,delta);
102 x = temp * wa1 + alpha * x;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
void dogleg(const Matrix< Scalar, Dynamic, Dynamic > &qrfac, const Matrix< Scalar, Dynamic, 1 > &diag, const Matrix< Scalar, Dynamic, 1 > &qtb, Scalar delta, Matrix< Scalar, Dynamic, 1 > &x)