入力値が疎行列かどうかを調べる (numeric or boolean)
res = issparse(S)
scilabオブジェクト
%T: 行列は疎行列, %F: その他
res = issparse(S) は、S が疎行列の時に %T, それ以外の時に %F を返します.
sp = sprand(10, 20, 0.1); if issparse(sp) then mprintf("Number of non-zero components: %d", nnz(sp)); end A = %pi; if ~issparse(A) then disp("A is not a sparse matrix"); end spb = sp~=0 & sp < 0.5; issparse(spb) nnz(spb)