Navigation

Operators and Keywords

Function List:

C++ API

: val = sparse_auto_mutate ()
: old_val = sparse_auto_mutate (new_val)
: sparse_auto_mutate (new_val, "local")

Query or set the internal variable that controls whether Octave will automatically mutate sparse matrices to full matrices to save memory.

For example:

s = speye (3);
sparse_auto_mutate (false);
s(:, 1) = 1;
typeinfo (s)
⇒ sparse matrix
sparse_auto_mutate (true);
s(1, :) = 1;
typeinfo (s)
⇒ matrix

When called from inside a function with the "local" option, the variable is changed locally for the function and any subroutines it calls. The original variable value is restored when exiting the function.

Package: octave