5 template <
typename Scalar>
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;
102 x = temp * wa1 + alpha *
x;
Matrix diag(const std::vector< Matrix > &Hs)
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
Jet< T, N > sqrt(const Jet< T, N > &f)
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
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_DEVICE_FUNC bool abs2(bool x)
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)