morphologica
morphologica copied to clipboard
Ensure that sum() mean() and similar statistics in vvec ignore NaNs in the array.
Currently, the NaNs are acted on, which is probably not what one wants in a computation.
The problem with doing this is that you end up with lots of conditionals in your loops. For example, in a sum() you have to test if each element isnan() which will slow things down. Alternative is to first scan through to see if there are any nans, then loop to accumulate with isnan testing only if necessary.
Best approach to have methods that explicitly deal with nans, and let client code decide which to use?
So is best approach to do what I already did with minmax?:
https://github.com/ABRG-Models/morphologica/blob/main/morph/vvec.h#L609