sparse matrix with data type as 'single'

40 次查看(过去 30 天)
Dear all:
I have a very large sparse matrix that I hope to reduce the size further more. I noticed that in full matrix, one could cast a matrix to a different data type, e.g., from double to single.
A = eye(100);
S = sparse(A);
B = single(eye(100));
S = sparse(B); % error: Undefined function 'sparse' for input arguments of type 'single'.
whos
I am wondering if there is any way to turn non-zero part of a sparse matrix into a data type of single so that I could save half of the space.
Thank you, and I look forward to hearing from you!
Best,
Long

回答(1 个)

Walter Roberson
Walter Roberson 2020-6-18
No, that is not supported. sparse() is only supported for double and logical.
  5 个评论
Long Hong
Long Hong 2020-6-19
Thank you, Walter! I will check this post out!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sparse Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by