is float16 supported in matlab?

不羁的心 提交于 2019-12-05 17:17:27

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 in float-datatype is with single, which is a 32-bit datatype:

A = single( rand(50) );

You could multiply by a constant and cast to int16, but you'd lose precision.

The numeric classes, which Matlab supports out of the box are the following:

int8
int16
int32
int64
uint8
uint16
uint32
uint64
single (32-bit float)
double (64-bit float)

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.

This might be an old question, but I found it in search for a similiar problem (half precision in matlab).

Things seemed to have changed in time: https://www.mathworks.com/help/fixedpoint/ref/half.html

Half-precision seems to be supported nativeley by matlab now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!