jlapeyre / PDL-Fit-Levmar

PDL interface to constrained Levenberg-Marquardt library levmar
Other
3 stars 3 forks source link

support for newer PDL versions with the new PDL_Indx type #1

Closed fantasma13 closed 7 years ago

fantasma13 commented 8 years ago

Hi,

I've created a branch where I substituted PDL_Long by PDL_Indx in pdlperlfunc.c at a few places. This seems to work for newer PDLs but obviously this breaks versions prior to 2.007 or 2.008.

Feel free to pull! https://github.com/fantasma13/PDL-Fit-Levmar

I'm not sure where and how to introduce an #ifdef clause or do some magic at the Makefile.PL stage to capture the transition. It would be very much appreciated, if you could release a new version which works for newer PDLs.

Ingo

jlapeyre commented 8 years ago

Hi Ingo, Thanks! I will look at this. John

On 11/26/2015 04:34 PM, fantasma13 wrote:

Hi,

I've created a branch where I substituted PDL_Long by PDL_Indx in pdlperlfunc.c at a few places. This seems to work for newer PDLs but obviously this breaks versions prior to 2.007 or 2.008.

Feel free to pull! https://github.com/fantasma13/PDL-Fit-Levmar

I'm not sure where and how to introduce an #ifdef clause or do some magic at the Makefile.PL stage to capture the transition. It would be very much appreciated, if you could release a new version which works for newer PDLs.

Regardless,

Ingo

— Reply to this email directly or view it on GitHub https://github.com/jlapeyre/PDL-Fit-Levmar/issues/1.

sisyphus commented 8 years ago

Hi John, In support of Ingo's request, his fork is passing its test suite for me on Windows across a wide range of perl versions and configurations, using (latest) PDL-2.015.

Cheers, Rob

jlapeyre commented 8 years ago

Hi Rob, Thanks. I wrote Ingo. I'll find a spare tuit today. John

Hi John, In support of Ingo's request, his fork is passing its test suite for me on Windows across a wide range of perl versions and configurations, using (latest) PDL-2.015.

Cheers, Rob

fantasma13 commented 8 years ago

Excellent, tell me where I can help.

Ingo

jlapeyre commented 8 years ago

I don't know the relation between the PDL version, eg 2.007, 2.015 and the C preprocessor macro PDL_CORE_VERSION in pdlcore.h, which has a value of 10 in the PDL-2.007 debian package. I searched a bit on the web, but no luck. If there is a particular value of PDL_CORE_VERSION at which the data type change occurred, then it should be easy to make the fix. Any ideas ?

jlapeyre commented 8 years ago

Can you try the following ? First, undo the changes of PDL_Long to PDL_Indx. Then, after this line

#include "pdlcore.h"

insert this

#if defined(PDL_CORE_VERSION) && PDL_CORE_VERSION < 10
typedef PDL_Long PDL_Indx;
#endif

I don't have multiple (eg old versions) of PDL, but I can try it on the debian packaged PDL.

I found this code at this link

sisyphus commented 8 years ago

From: John Lapeyre

On Windows, there's no problems if $Config{ivtype} is 'long' (ivsize = 32) but I get a few crashes during the running of the test suite on perls whose $Config{ivtype} is 'long long' (ivsize == 64). On Windows perls we have to use the 'long long' type as our 64-bit integer because 'long' is always 32 bits. It may well be that there's no problem on nix machines where ivtype is 'long' (irrespective of whether 'long' is 32 or 64 bits).

Just to be sure that I've done what I was supposed to do, I simply took the PDL-Fit-Levmar source distro as it appears on cpan and patched pdlperlfunc.c as follows:

include "XSUB.h"

include "pdl.h"

include "pdlcore.h"

+#if defined(PDL_CORE_VERSION) && PDL_CORE_VERSION < 10 +typedef PDL_Long PDL_Indx; +#endif +

include

I then tried to build against PDL-2.015.

But I think I might be trying this the wrong way around. Shouldn't I be using Ingo's version of pdlperlfunc.c, and then patching it as per above ? That is, apply the patch to Ingo's version, not to the original.

Obviously, that will be fine for 2.015 as it's effectively no different to what I tested yesterday, since PDL_CORE_VERSION > 10 for me. (It's 12 for both 2.014 and 2015.)

FWIW, PDL-LinearAlgebra-0.12 builds and tests fine for me.

Cheers, Rob

jlapeyre commented 8 years ago

Hi Rob, Of course you are correct. Sorry! The #ifdef code should be added to Ingo's version. Cheers, John

jlapeyre commented 8 years ago

I pushed the change these lines and following. This passes tests on PDL-2.007. Does this work for you ?

sisyphus commented 8 years ago

Works for me on MS Windows with PDL-2.015 - for my usual range of perl versions/configurations. AFAIK, 2.007 is version 10 of PDL_CORE_VERSION, so we still haven't tested it against a PDL whose PDL_CORE_VERSION < 10. That doesn't bother me in the slightest .... I only draw attention to it in case it bothers someone else.