Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.1.0 - Русский

Change language to:
English - Français - 日本語 - Português -

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Справка Scilab >> Sparse Matrix > Sparse Matrix Manipulation > issparse

issparse

tests whether the input is sparse encoded (numeric or boolean)

Syntax

res = issparse(S)

Arguments

S

a scilab object

res

boolean: %T if the matrix is a sparse, and %F otherwise/

Description

res = issparse(S) returns %T (true) if S is a sparse boolean or numerical matrix, and %F (false) otherwise.

Examples

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)

See also

  • isreal — проверка, имеет ли переменная вещественные или комплексные элементы
  • sparse — sparse matrix definition
  • type — возвращает тип переменной
  • typeof — explicit type or overloading code of an object

History

VersionDescription
6.0.2
  • issparse() now returns a boolean %T or %F instead of 1 or 0.
  • issparse() is now true as well for sparse booleans.
Report an issue
<< Sparse Matrix Manipulation Sparse Matrix Manipulation nnz >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:54:57 CET 2020