PDLPorters / pdl-linearalgebra

https://p3rl.org/PDL::LinearAlgebra
1 stars 7 forks source link

Add code to detect native complex in mdet #8

Closed wlmb closed 3 years ago

wlmb commented 3 years ago

mdet (and I guess other routines) fails on the native complex types, as it calls the real lapack routines instead of the complex lapack routines, unles the object type is the now deprecated PDL::Complex. Thus, I added a line to decide which lapack routine to use depending on the type of the object.

mohawk2 commented 3 years ago

Thanks! Could you add a test that would break without your change? I'm not at all worried about supporting the now-deprecated PDL::Complex, so don't worry about that.

wlmb commented 3 years ago

Added test. It was problematic, as there is a confussion between native complexes and PDL::Complex'es. For example, i()'s meaning is modified by use PDL::Complex, and this is not reverted by 'no PDL::Complex.

mohawk2 commented 3 years ago

Added test. It was problematic, as there is a confussion between native complexes and PDL::Complex'es. For example, i()'s meaning is modified by use PDL::Complex, and this is not reverted by 'no PDL::Complex.

Thank you! I've adjusted the change a tiny bit, including using pdl('i') to get i. An alternative would be to make a new test file.

mohawk2 commented 3 years ago

Released as 0.23

wlmb commented 3 years ago

Thank you! I've adjusted the change a tiny bit, including using pdl('i') to get i. An alternative would be to make a new test file.

I would have never guessed this trick! Regrds,

mohawk2 commented 3 years ago

It was a bit of lateral thinking, I might not have seen it another day!

By the way, I edited your comment above to insert a blank line between the bit from me you're quoting, and your words - otherwise GH thinks it's all quoted text. The "Preview" function is handy to spot that sort of thing before sending, and the markup can sometimes have surprising gotchas like that.