[ 
https://issues.apache.org/jira/browse/MATH-1417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16002748#comment-16002748
 ] 

Gilles edited comment on MATH-1417 at 5/9/17 2:30 PM:
------------------------------------------------------

Ok, i got the source.
I'm not a QR specialist. I took a look at the code and I've found what gave me 
that weird result.

In performHouseholderReflection:(RRQRDecomposition.java:111), just change
for (int j = 0; j < qrt[i].length; j++) {
(Norm is computed against the whole column )
By
for (int j = minor; j < qrt[i].length; j++) {
(Norm is computed under the current pivot )

 In performHouseholderReflection:(QRDecomposition.java:139-143) the norm is 
calculated again using  the column starting from minor pivot, 
then in my case, I have a column whose values are before the diagonal ( then 
before the pivot ). This gives a "full norm" that is not null but that is null 
beside pivot.
This column is given for computing a reflector but this calculous failed ( a == 
0) because "restricted norm" is null.

If norms are computed always the same manner, the pivoting is ok and the result 
is ok in my test case.

Further testing should be done but maybe it can be a quick fix.

Hope this can help.

I'm also surprised to see a test (a!=0) in QR Decomposition with double values.



was (Author: lecomtje):
Ok, i got the source.
I'm not a QR specialist. I took a look at the code and I've found what gave me 
that weird result.

In performHouseholderReflection:(RRQRDecomposition.java:111), just change
for (int j = 0; j < qrt[i].length; j++) {
(Norm is computed against the whole column )
By
for (int j = minor; j < qrt[i].length; j++) {
(Norm is computed under the current pivot )

 In performHouseholderReflection:(QRDecomposition.java:139-143) the norm is 
calculated again using  the column starting from minor pivot, 
then in my case, I have a column whose values are before the diagonal ( then 
before the pivot ). This gives a "full norm" that is not null but that is null 
beside pivot.
This column is given for computing a reflector but this calculous failed ( a == 
0) because "restricted norm" is null.

If norms are computed always the same manner, the pivoting is ok and the result 
is ok in my test case.

Further testing should be done but maybe it can be a quick fix.

Hope this can help.

I'm also surprised to see a test (a!=0) in QR Decomposition with double values.

-----Message d'origine-----
De : Gilles (JIRA) [mailto:j...@apache.org] 
Envoyé : mardi 9 mai 2017 14:07
À : LECOMTE Jean-Francois
Objet : [jira] [Commented] (MATH-1417) weird result in RRQR decomposition.


    [ 
https://issues.apache.org/jira/browse/MATH-1417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16002571#comment-16002571
 ] 

Gilles commented on MATH-1417:
------------------------------

bq. Is common math easily compiled once i checked it out from git ?

Asumimg that you have "maven" installed, it should just be a matter of running 
this command:
{noformat}
mvn compile
{noformat}





--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
__________________________
Avant d'imprimer, pensez à l'environnement ! Please consider the environment 
before printing ! 
Ce message et toutes ses pièces jointes sont confidentiels et établis à 
l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa 
destination, toute diffusion ou toute publication, totale ou partielle, est 
interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute 
responsabilité au titre de ce message. This message and any attachments are 
confidential and intended solely for the addressees. Any unauthorised use or 
dissemination is prohibited. IFP Energies nouvelles should not be liable for 
this message.
__________________________


> weird result in RRQR decomposition.
> -----------------------------------
>
>                 Key: MATH-1417
>                 URL: https://issues.apache.org/jira/browse/MATH-1417
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>         Environment: linux RH6
> netbeans 8.2 
> java 1.8
>            Reporter: Lecomte
>
> When using RRQRDecomposition on rank deficient matrix, results are wrong.
> double[][] Xi = {
>             {0, 0, 0, 0, 0, 0, 0, 0, 0},
>             {0, 1, 0, 0, 0, 0, 0, 0, 0},
>             {0, 0, 1, 0, 0, 0, 0, 0, 0},
>             {0, 0, 1, 0, 0, 0, 0, 0, 0},
>             {0, 0, 1, 0, 0, 0, 0, 0, 0},
>             {0, 0, 0, 1, 0, 0, 0, 0, 0},
>             {0, 0, 0, 0, 0, 0, 1, 0, 0},
>             {0, 0, 0, 0, 0, 0, 0, 0, 0},};
> With this matrix, i obtain: 
> rank 6
> R:
> |1,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 1,000 1,000 1,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 1,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 1,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> Q:
> |0,000 0,000 1,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |1,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 1,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 1,000 0,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 1,000 0,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 1,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 1,000 0,000 0,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 1,000 0,000|
> |0,000 0,000 0,000 0,000 0,000 0,000 0,000 0,000 1,000|
> Where Scipy (lapack) or ejml gives me:
> rank 4
> Type = dense real , numRows = 9 , numCols = 8
> -1,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000  -1,000   0,000   0,000  -1,000   0,000  -1,000   0,000  
>  0,000   0,000  -1,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000  -1,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
> Type = dense real , numRows = 9 , numCols = 9
>  0,000   0,000   0,000   0,000   0,000   0,000   1,000   0,000   0,000  
> -1,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000  -1,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000  -1,000   0,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   1,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   1,000   0,000   0,000   0,000  
>  0,000   0,000   0,000  -1,000   0,000   0,000   0,000   0,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   1,000   0,000  
>  0,000   0,000   0,000   0,000   0,000   0,000   0,000   0,000   1,000  
> That are the results i expect.
>  



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to