gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
278 stars 62 forks source link

CORRELATE should pass if input dim > 2 #1373

Open alaingdl opened 2 years ago

alaingdl commented 2 years ago

CORRELATE() in GDL stops when input array dim is higher than 2. Same problem with and without /COVARIANCE keyword. I am afraid if is more that just removing the test at line 42 ...

IDL> a=randomu(seed,13,13, 2)
IDL> covMatrix = Correlate(a, /COVARIANCE, /DOUBLE)
% Compiled module: CORRELATE.
% Loaded DLM: LAPACK.
IDL> help, covMatrix
COVMATRIX       DOUBLE    = Array[13, 13]

but on the GDL side :+1:

GDL> a=randomu(seed,13,13, 2)
GDL> covMatrix = Correlate(a, /COVARIANCE, /DOUBLE)
% CORRELATE: Expecting two-dimensional array
% Error occurred at: CORRELATE           42 /home/alaingdl/GDL/gdl-1.0.1git220525/src/pro/correlate.pro
%                    $MAIN$          
% Execution halted at: $MAIN$          
GillesDuvert commented 2 years ago

Yes but IDL 'forgets' about the 3rd dimension.

IDL> a=randomu(33,2,13,13) & covMatrix = Correlate(a,/cov) & print,covmatrix
     0.101819   -0.0113056
   -0.0113056    0.0989166
IDL> a=randomu(33,2,13,2) & covMatrix = Correlate(a,/cov) & print,covmatrix 
     0.101819   -0.0113056
   -0.0113056    0.0989166

I would call that a bug, and GDL is well inspired to signal the error ?