1 Reply Latest reply on Sep 6, 2013 9:06 AM by chipf

    dgels (or dgels_): reuse already allocated memory / meaning of parameter trans_len


      Dear all,


      I would like to solve a linear least squares problem with dgels (or dgels_). It is crucial for me to avoid any memory allocation besides the one made at compile time. To avoid this, I intend to recycle a large chunk of memory which I have already available in my program.


      As far as I understand, using dgesl_ gives the possibility to provide a pointer to external memory in its argument "double *work" (as declared in acml.h, v. 5.3.0). Here is where I would like to use my available memory chunk. However, I find nowhere in internet what the last argument of dgesl_ ("int trans_len") is supposed to mean.


      So, my two questions are:

      a) Is it true that my only option to recycle memory for the workspace is to use dgesl_ instead of dgesl? (I don't see how calling degsl alone can manage to recycle memory, as it does not have an argument for it).


      b) What does the argument trans_len in dgesl_ mean?


      Thanks a lot in advance.


      Kind regards,


      Roberto Lemoine

        • Re: dgels (or dgels_): reuse already allocated memory / meaning of parameter trans_len

          Understand first that the dgels_ interface is a fortran interface.  The dgels (no underscore) is a interface to the ACML style C wrappers


          The dgels interface WILL do internal allocation for the work array, meaning that the calling C program does not need to.  So this is not the interface you want to use.

          The dgels_ is just the actual fortran routine, with the interface made visible to C programs.  This must use Fortran calling interfaces,  As documented in the ACML user guide, the integer trans length argument is just the length of the string passed for the trans argument.  This is necessary since Fortran strings do not have a null terminator. Note that different fortran compilers expect these integer string length argument in different places in the parameter list, and you would see this if you looked at the acml.h file for all the different libraries we provide.


          The fortran inter