This forum has been archived. All content is frozen. Please use KDE Discuss instead.

ColPivHouseholderQR solver

Tags: None
(comma "," separated)
lvdong
Registered Member
Posts
5
Karma
0

ColPivHouseholderQR solver

Sun Jun 12, 2011 1:55 am
how to set tolerance before QR decomposition

seems impossible:
RealScalar threshold_helper = m_colSqNorms.maxCoeff() * internal::abs2(NumTraits<Scalar>::epsilon()) / RealScalar(rows);
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: ColPivHouseholderQR solver

Mon Jun 13, 2011 4:51 am
you mean that qr.setThreshold(XXX) does not work? if so then please fill a bug report: http://eigen.tuxfamily.org/bz
lvdong
Registered Member
Posts
5
Karma
0

Re: ColPivHouseholderQR solver

Tue Jun 14, 2011 5:27 am
ggael wrote:you mean that qr.setThreshold(XXX) does not work? if so then please fill a bug report: http://eigen.tuxfamily.org/bz

I mean changing tol beforeI have a qr instance, becase I found in the constructor of ColPivHouseholderQR, the threshold was not used to determin non-zero pivots.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: ColPivHouseholderQR solver

Tue Jun 14, 2011 8:05 am
ColPivHouseholderQR<MyMatrixType> qr;
qr.setThreshold(....);
qr.compute(mat);
...
lvdong
Registered Member
Posts
5
Karma
0

Re: ColPivHouseholderQR solver

Tue Jun 14, 2011 10:54 am
ggael wrote:...

but in the compute(), m_nonzero_pivots is determined by the default tol, NumTraits<Scalar>::epsilon(), so when I called solve(), the nonzeroPivots() will be called to determine the efficent rank, thus, also I cannot control the tol when using solve(), thanks
lvdong
Registered Member
Posts
5
Karma
0

Re: ColPivHouseholderQR solver

Tue Jun 14, 2011 11:20 am
You can check the following codes, result was strange.

Code: Select all
#include <iostream>
#include <Eigen/Eigen>

int main()
{
    Eigen::MatrixXd x(5,3);
    x << 0.8147, 0.8147, 0.1576,
         0.9058, 0.9058, 0.9706,
         0.1270, 0.1270, 0.9572,
         0.9134, 0.9134, 0.4854,
         0.6324, 0.6324, 0.8003;
    std::cout << "\nmatrix x:\n" << x << std::endl;

    Eigen::VectorXd y(5);
    y << 0.1712, 0.7060, 0.0318, 0.2769, 0.0462;
    std::cout << "\nvector y:\n" << y << std::endl;

    std::cout << "\nsolution:\n"
              << x.colPivHouseholderQr().solve(y) << std::endl;

    return 0;
}


matrix x:
0.8147 0.8147 0.1576
0.9058 0.9058 0.9706
0.127 0.127 0.9572
0.9134 0.9134 0.4854
0.6324 0.6324 0.8003

vector y:
0.1712
0.706
0.0318
0.2769
0.0462

solution:
-7.41133e+014
7.41133e+014
-0.301007
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: ColPivHouseholderQR solver  Topic is solved

Tue Jun 14, 2011 12:37 pm


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar