[jira] [Comment Edited] (MATH-1417) weird result in RRQR decomposition.

2017-05-10 Thread Gilles (JIRA)

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

Gilles edited comment on MATH-1417 at 5/10/17 9:47 AM:
---

Ok, it's ok for me.

I use the current stable release 3.6.1 of apache math in an industrial product.
How should I proceed to take advantage of this fix ?



was (Author: lecomtje):
Ok, it's ok for me.

I use the current stable release 3.6.1 of apache math in an industrial product.
How should I proceed to take advantage of this fix ?

-Message d'origine-
De : Gilles (JIRA) [mailto:j...@apache.org] 
Envoyé : mardi 9 mai 2017 21:36
À : 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=16003376#comment-16003376
 ] 

Gilles commented on MATH-1417:
--

Got it. :)
Please check that commit ed1ce82d822ffe185875b7b7d38352f20171c096 fixed the 
problem.





--
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   

[jira] [Comment Edited] (MATH-1417) weird result in RRQR decomposition.

2017-05-09 Thread Gilles (JIRA)

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

Gilles edited comment on MATH-1417 at 5/9/17 7:35 PM:
--

Sorry, but i am searching a nullspace and so i work with Xi transposed, not Xi 
by itself. And with this transposed matrix I should also obtain rank 4.
I didn't test master branch but the code seems the same.



was (Author: lecomtje):
Sorry, but i am searching a nullspace and so i work with Xi transposed, not Xi 
by itself. And with this transposed matrix I should also obtain rank 4.
I didn't test master branch but the code seems the same.



-Message d'origine-
De : Gilles (JIRA) [mailto:j...@apache.org] 
Envoyé : mardi 9 mai 2017 16:42
À : 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=16002798#comment-16002798
 ] 

Gilles commented on MATH-1417:
--

Have you checked out the git "master" branch?
With your example (and no change to the source), I obtain 4 as the rank value.




--
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   

[jira] [Comment Edited] (MATH-1417) weird result in RRQR decomposition.

2017-05-09 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/MATH-1417?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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=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 

[jira] [Comment Edited] (MATH-1417) weird result in RRQR decomposition.

2017-05-09 Thread Gilles (JIRA)

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

Gilles edited comment on MATH-1417 at 5/9/17 12:04 PM:
---

Hi Gilles,

Why not ? 
Is common math easily compiled once i checked it out  from git ?

Thanks.

Jef




was (Author: lecomtje):
Hi Gilles,

Why not ? 
Is common math easily compiled once i checked it out  from git ?

Thanks.

Jef

-Message d'origine-
De : Gilles (JIRA) [mailto:j...@apache.org] 
Envoyé : mardi 9 mai 2017 12:52
À : 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=16002476#comment-16002476
 ] 

Gilles commented on MATH-1417:
--

Thanks for the report!

Are you willing to dig into the code in order to locate the bug?




--
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