sparse matrix with data type as 'single'

조회 수: 11 (최근 30일)
Long Hong
Long Hong 2020년 6월 18일
답변: Mike Croucher 2025년 8월 13일
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

채택된 답변

Mike Croucher
Mike Croucher 2025년 8월 13일
This is now supported, starting from MATLAB R2025a. A detailed write up can be found at New in MATLAB: Single precision sparse matrices » The MATLAB Blog - MATLAB & Simulink

추가 답변 (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