-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sequence() fails as instance method #370
Comments
Thank you for figuring out where PDL::CCS's expectation was being broken! I'll add this to the unit test and then see about fixing it. |
In fact, thank you for the unit tests as well! That saves time :-D |
FYI I've moved the tests from t/core.t to t/basic.t, because despite how fundamental |
By the way, Another issue is that in the hopefully-near-future loop-fusion change, the whole concept of |
I am closing this, because #371 has been merged and released with 2.067. But I do still want to see your thoughts on the above point :-) |
Yep.
I think my policy on bad-balue-conversion to date has been mostly "hide my head in the sand and hope it doesn't bite me". CCS has some special handling for treating the "missing" value as BAD or NaN ... but it's basically just setting explicit administrative flags (analogous to $pdl->badflag).
I guess the principle of least surprise dictates that BAD should always be BAD. My understanding has been that the actual BAD value is dependent only on the datatype, so that would suggest that the conversion target type's badvalue() replaces the source's one (maybe in a 2nd pass scan of the input if badflag is set?), so -2**31 would replace 255 for a byte->long conversion (as is the case for the current convert()). That said, I also think that anyone who needs inplace conversion and bad values should be savvy enough to figure out what those values are and treat them according to the needs of their application ... maybe they actually want 255-BAD to stay 255, and it would be fairly easy to do bad-mapping on the perl side with
CCS inplace-conversion actually uses PDL::convert() for the values ($ccs->[$VALS]), but it's a no-op for the non-missing indices ($ccs->[$WHICH]): the entire justification for allowing $ccs->inplace()->convert() is to save the memory & CPU cycles that would be needed to copy $ccs->[$WHICH].
sounds interesting! |
My feeling is you'd be better off using explicit values for BAD rather than out-of-band information, if only for performance reasons (in terms of data locality, it's right there with the non-BAD data). But I don't know CCS well at all! And the not-dealing is tempting; until the last month or so,
Depending on how it was compiled, PDL has had per-ndarray bad values for a long time. Badvalues and per-ndarray values became enabled by default last year, together with being able to use
I suppose I was imagining for CCS that you could "simply" convert the underlying dense storage, since no dimensional stuff would change? As I said, I don't know the library well :-)
Please take a look at #349 and comment if you like :-) |
Since commit f49ac06 (v2.063_03), sequence() called as an instance method returns a copy of the calling object whenever its type is not
double
.Examples:
This leads to downstream failures in PDL::CCS (-> moocow-the-bovine/PDL-CCS#1), and appears to have resulted from changes made to
PDL::sequence()
andPDL::axisvals2()
in the aforementioned commit. I'm guessing that the changed behavior is related to the new$type_given
lexical inPDL::sequence()
(which is false when called as an instance method), but I don't have a fix.PDL::axisvals2()
appears to be generating the correct values (in both$bar
and$dummy
), albeit always as typedouble
(which seems rather inefficient). Perhaps theinplace()
on thesequence()
lexical$bar
isn't propagating correctly throughaxisvals2()
when there's a type-mismatch?The text was updated successfully, but these errors were encountered: