vectorz icon indicating copy to clipboard operation
vectorz copied to clipboard

Will there be future support for single-precision floating point numbers?

Open NickWeintraut opened this issue 10 years ago • 1 comments

This library is fantastic for the current project I am working on, however to save on memory usage (as all of our matrix and vector data comes to us in single-precision), might there be a configuration of the project in the future to support single-precision matrices? My apologies if this is not the right place to bring this up; I just wanted to check in before I try a find/replace of 'double' to 'float'!

NickWeintraut avatar Nov 22 '16 08:11 NickWeintraut

The API will probably always be double, but there's nothing to stop you from implementing INDArray subclasses that use floating point precision as underlying storage.

So you could for example make a FloatVector class that is like Vector but uses a float[] array as underlying storage. We already do something similar that is even more space efficient for binary arrays: see BitVector.

I'd be willing to take a PR to include something like this in the main library, as long as both:

  • it doesn't add too much code footprint
  • the main double-based API doesn't change.

This may be a good solution assuming your main concern is memory size.

mikera avatar Nov 22 '16 09:11 mikera