sparse matrix with data type as 'single'
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
Walter Roberson
il 18 Giu 2020
1 voto
No, that is not supported. sparse() is only supported for double and logical.
5 Commenti
Long Hong
il 19 Giu 2020
Walter Roberson
il 19 Giu 2020
Not while using the defined sparse functions.
What operations are you doing with the matrices? For some restricted operations it might be practical to write replacement sparse routines. However if you are doing something like eigs() or using sparse \ (matrix division) then enough would have to be reimplemented to make it questionable as to whether it is worth doing.
Long Hong
il 19 Giu 2020
Long Hong
il 19 Giu 2020
Categorie
Scopri di più su Sparse Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!