[Fwd: correction to full size Q output from a QR factorization]
- Subject: [Fwd: correction to full size Q output from a QR factorization]
- From: Ron Boisvert <boisvert@nist.gov>
- Date: Thu, 13 Dec 2007 10:01:56 -0500
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=ISO-8859-1; format=flowed
- User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
Sender: Andreas Kyrmegalos <andreask1@vivodinet.gr>
Subject: correction to full size Q output from a QR factorization
Hello again,
in the QRDecomposition code I have neglected to include the case when
rank= n-1 and no householder vector has been calculated. I have an
implementation of the QR algorithm that allows pivoting but I m
skeptical about releasing it. This slight omission is a good example of
why I refrain from its release.
Anyway here's the corrected code (the only change is the addition of the
else clause):
....
if (!economy) {
if (QR[n-1][n-1] != 0.0) {
for(int k = m-1; k >= n-1;k--) {
Q[k][k] = 1.0;
double s = 0.0;
for (int i = n-1; i <=k; i++) {
s += QR[i][n-1]*Q[i][k];
}
s = -s/QR[n-1][n-1];
Q[k][k] += s*QR[k][n-1];
for (int i = m-1; i >k; i--) {
Q[i][k] += s*QR[i][n-1];
Q[k][i] = Q[i][k];
}
}
}
else {
for(int k = m-1; k >= n-1;k--)
Q[k][k] = 1.0;
}
}
....
I apologize to anyone who may have used the code but as I've pointed
out before, please do test the code before using it.
Cheers,
Andreas
Date Index |
Thread Index |
Problems or questions? Contact list-master@nist.gov