sparse matrix with data type as 'single'
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Long Hong
le 18 Juin 2020
Réponse apportée : Mike Croucher
le 13 Août 2025
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
0 commentaires
Réponse acceptée
Mike Croucher
le 13 Août 2025
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
0 commentaires
Plus de réponses (1)
Walter Roberson
le 18 Juin 2020
No, that is not supported. sparse() is only supported for double and logical.
Voir également
Catégories
En savoir plus sur Sparse Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!