Does PDL already have a way to apply a "rounding" to the vector elements by some precision in the way that Math::Round::nearest() does? I've looked through the PDL::Math documentation but didn't see a good candidate option.
I could unpdl/re-pdl but that seems like too much overhead.
Is there already a vectorized way to do this?
I tried something like this:
$pdl = pdl [4.45, 5.55, 45];
$n = pdl [.1, .3, 10];
print rint($pdl/$n)*$n
[4.4 5.4 40]
but as as you can see it doesn't quite work because it should round up to the nearest precision. This would be the "correct" output:
[4.5 5.6 50]