Does MATLAB support float16 operations? If so, how to convert a double matrix to float16? I am doing an arithmetic operation on a large matrix where 16-bit floating representation is sufficient for my representation. Representing by a double datatype takes 4 times more memory.
相关问题
- Extract matrix elements using a vector of column i
- How do you get R's null and residual deviance
- How to display an image represented by three matri
- OpenCV - Is there an implementation of marker base
- Avoid copying an array when using mexCallMATLAB
相关文章
- How can I convert a f64 to f32 and get the closest
- How do I append metadata to an image in Matlab?
- Macro or function to construct a float (double) fr
- How can I write-protect the Matlab language?
- Math.Max vs Enumerable.Max
- `std::sin` is wrong in the last bit
- Escape sequence to display apostrophe in MATLAB
- Converting hex string representation to float in p
The numeric classes, which Matlab supports out of the box are the following:
plus the complex data type. So no 16-bit floats, unfortunately.
On Mathworks file exchange, there seems to be a half-precision float library. It requires MEX, however.
Is your matrix full? Otherwise, try
sparse
-- saves a lot of memory if there's lots of zero-valued elements.AFAIK,
float16
is not supported. Lowest you can go infloat
-datatype is withsingle
, which is a 32-bit datatype:You could multiply by a constant and cast to
int16
, but you'd lose precision.