1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
sparse(1) Scilab Function sparse(1)
NAME
sparse - sparse matrix definition
CALLING SEQUENCE
sp=sparse(X)
sp=sparse(ij,v [,mn])
PARAMETERS
X : real or complex full (or sparse) matrix
ij : two columns integer matrix (indices of non-zeros entries)
mn : integer vector with two entries (row-dimension, column-dimension)
sp : sparse matrix
DESCRIPTION
sparse is used to build a sparse matrix. Only non-zero entries are stored.
sp = sparse(X) converts a full matrix to sparse form by
squeezing out any zero elements. (If X is already sparse sp is X).
sp=sparse(ij,v [,mn]) builds an mn(1)-by-mn(2) sparse matrix with
sp(ij(k,1),ij(k,2))=v(k). ij and v must have the same column dimension. If
optional mn parameter is not given the sp matrix dimensions are the max
value of ij(:,1) and ij(:,2) respectively.
Operations (concatenation, addition, etc,) with sparse matrices are made
using the same syntax as for full matrices.
Elementary functions are also available (abs,maxi,sum,diag,...) for sparse
matrices.
Mixed operations (full-sparse) are allowed. Results are full or sparse
depending on the operations.
EXAMPLE
sp=sparse([1,2;4,5;3,10],[1,2,3])
size(sp)
x=rand(2,2);abs(x)-full(abs(sparse(x)))
SEE ALSO
full, spget, sprand, speye, lufact
|