Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ludc #1700

Open
myravian opened this issue Dec 22, 2023 · 6 comments
Open

ludc #1700

myravian opened this issue Dec 22, 2023 · 6 comments
Assignees

Comments

@myravian
Copy link

Hi there,

While trying GDL 1.0.4 on a script, I found this issue:

GDL> mat = [[1,1,1],[1,1,1],[1,1,1]]
GDL> ludc, mat, index, interchanges=parity
GDL> help, parity
PARITY UNDEFINED =

expected behavior:
PARITY FLOAT = 1.00000

Does it have to do with the way the array is being declared?

Cheers,
Vian

@GillesDuvert
Copy link
Contributor

@myravian I've checked the code, the INTERCHANGES keyword is silently ignored in GDL.
Apparently, the gsl procedure used inside GDL returns a "signum" value which is exactly what INTERCHANGE is for, but "signum" is not returned in "interchanges".
This will be patched, I hope you can proceed without it in the meantime.

@fawltylanguage
Copy link

mat is singular, it's determinant is exactly zero. Probably an error message should be printed, as with LA_LUDC in IDL.

@GillesDuvert
Copy link
Contributor

@fawltylanguage IDL does not complain about this mat. But yes, another issue, LUDC should return a warning when encountering a singular matrix.

@myravian
Copy link
Author

The matrix values were arbitrary and there just to illustrate the issue of the keyword that I wanted to raise. It's easy enough to check the determinant beforehand.

GillesDuvert added a commit that referenced this issue Dec 23, 2023
@GillesDuvert
Copy link
Contributor

I just corrected the bug in the trunk.
At the moment, I see this behaviour:

IDL> mat=fltarr(3,3) & ludc, mat, index
% LUDC: Singular matrix in routine ludcmp.
% Execution halted at: $MAIN$          
IDL> mat = [[1,1,1],[1,1,1],[1,1,1]] & ludc, mat, index
IDL> mat
       1.0000000       1.0000000       1.0000000
       1.0000000   9.9999997e-21       0.0000000
       1.0000000       0.0000000   9.9999997e-21
IDL> 
GDL> mat=fltarr(3,3) & ludc, mat, index
GDL> mat
       0.0000000       0.0000000       0.0000000
            -NaN            -NaN            -NaN
            -NaN            -NaN            -NaN
GDL> mat = [[1,1,1],[1,1,1],[1,1,1]] & ludc, mat, index
GDL> mat
       1.0000000       1.0000000       1.0000000
       1.0000000       0.0000000       0.0000000
       1.0000000            -NaN            -NaN

GDL should probably signal the singular matrix as IDL does, even if the unity matrix (wrongly?) passes for IDL. After LU decomposition, it would suffice to check the diagonal for any zero, agreed?

@alaingdl
Copy link
Contributor

alaingdl commented Jan 5, 2024

For my records :
-- it seems that the keyword /column is silently ignored in LUDC
-- the test of singularity in LUDC is not reliable at all in GDL (and in IDL NumRec also, but different)
-- it seems we lack some test coverage for matrix related codes (INVERT, DETERM, LUDC, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants