gnudatalanguage / gdl

GDL - GNU Data Language
GNU General Public License v2.0
270 stars 61 forks source link

Is there any way to have ELMHES/LA_ELMHES methods #1803

Open DamienAlbert opened 3 months ago

DamienAlbert commented 3 months ago

I'm looking for a way to import LA_ELMHES in my GDL project but can't find it in IDL libraries. I suppose it would have to be recoded natively in GDL ?

DamienAlbert commented 3 months ago

I see that it is included by a "lapack" library. Would it make the LA_* methods available ?

GillesDuvert commented 3 months ago

Hello Damien,

I suspect the easiest way would be to create the elmhes function in GDL using e.g., this as a start (ideally avoiding the need of linking with f2c), but the ELMHES documentation already shows that some understanding (that we do not have here) of what are the options is needed. All the more with the LA_ELMHES algorithm that would need lapack+blas and a specialist to use the 'good' LAPACK functions.

This is a good study case, because if some widely used or important data reduction sofware built on IDL, was only waiting for GDL to implement this function, then a call for aid to the GDL community would certainly find support. Implementing a known algorithm in GDL is quite straightforward for a C/C++ programmer, once the interface is properly described.

DamienAlbert commented 3 months ago

Hello Gilles,

The SPHERE Datacenter project would be glad for any help from the GDL community on this point. It is one of the last thing preventing us to fully migrate to the latest HPC grid computing resources and avoid a regression of features due to the unavailability of IDL on the new nodes. Sadly we don't have the manpower and the knowledge internally to do this method port ourselves.

[edit] : sorry for the duplicate notification, I used my personal account by mistake for the previous message.

GillesDuvert commented 3 months ago

I've introduced ELMHES + HQR in #1806 . Probably not as efficient or precise as the lapack version, but consistent with IDL's ELMHES and HQR results. HiH. Note: Eigen:: has HessenbergDecomposition, will be faster and give results approx similar to LA_ELMHES, with a few lines of code.

GillesDuvert commented 3 months ago

Actually, added a few other simple codes, including and abbreviated version of la_helmes, please try.

DamienAlbert commented 3 months ago

Thanks a lot !

I have to look how to use the latest GDL build on the SPHERE local servers to do some testing. The grid relies on a guix build, I'll have to check with the team how to update it.

GillesDuvert commented 3 months ago

just merged.

Danamir commented 3 months ago

I can't get the compiled version to work. I tried the Docker Container method mentioned on the wiki, but every launch outputs :

Unable to init server: Could not connect: Connection refused
15:27:52: Error: Unable to initialize GTK+, is DISPLAY set properly?

(gdl:8): Gtk-CRITICAL **: 15:27:52.685: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(gdl:8): Gtk-CRITICAL **: 15:27:52.685: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(gdl:8): Gtk-CRITICAL **: 15:27:52.685: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Segmentation fault

Is there a way to compile the headless version ?

[edit] I may have some success with xvfb-run -a gdl , I'll do some tests.

DamienAlbert commented 3 months ago

Well, I guess this is a progress, the error changed :

% Compiled module: PCA_IM_ANNV1.
% Warning: Keyword parameter PERMUT not supported in call to: LA_ELMHES. Ignored.
% Warning: Keyword parameter SCALE not supported in call to: LA_ELMHES. Ignored.
% PCA_IM_ANNV1: Function not found: LA_HQR
alaingdl commented 2 months ago

It is just the sign that function LA_HQR is missing too :disappointed:

Since Gilles prepared all the infrastuctures for ELMHES, LA_ELMHES & HQR, maybe it is not too much work to have LA_HQR too ! (thanks @GillesDuvert )

GillesDuvert commented 2 months ago

Elmhes is complete. This preliminary version of La_elmhes uses eigen:: and not lapack because we are already linked with eigen:: and it was extremely easy; adding blas + lapack will have to be planned more carefully as it adds a general dependency. Eigen's la_elmhes should be faster than lapack but indeed lacks all the options so they are just ignored by gdl. I presumed this would be sufficient. HQR is able to replace LA_HQR if your matrices are not of complex type. Just try by writing a la_hqr.pro procedure just calling hqr and you should go further.

GillesDuvert commented 2 months ago

I can't get the compiled version to work. I tried the Docker Container method mentioned on the wiki, but every launch outputs :

Unable to init server: Could not connect: Connection refused
15:27:52: Error: Unable to initialize GTK+, is DISPLAY set properly?

(gdl:8): Gtk-CRITICAL **: 15:27:52.685: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(gdl:8): Gtk-CRITICAL **: 15:27:52.685: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed

(gdl:8): Gtk-CRITICAL **: 15:27:52.685: _gtk_style_provider_private_get_settings: assertion 'GTK_IS_STYLE_PROVIDER_PRIVATE (provider)' failed
Segmentation fault

Is there a way to compile the headless version ?

[edit] I may have some success with xvfb-run -a gdl , I'll do some tests.

Gdl is compiled with all graphics by default. Headless builds are if i'm not mistaken generated by the build_gdl.sh procedure when the env var. DEPS is set to 'headless'

DamienAlbert commented 2 months ago

Gdl is compiled with all graphics by default. Headless builds are if i'm not mistaken generated by the build_gdl.sh procedure when the env var. DEPS is set to 'headless'

For now xvfb-run -a gdl is working, but I'll also do a headless compilation. It may be easier to run on the grid then.

DamienAlbert commented 2 months ago

Just try by writing a la_hqr.pro procedure just calling hqr and you should go further.

Good idea ! I'll give it a try.

GillesDuvert commented 2 months ago

@DamienAlbert Any progress?