이전: Creating Sparse Matrices in Oct-Files, 상위 문서: Sparse Matrices in Oct-Files [차례][찾아보기]
Most of the same operators and functions for sparse matrices that are available
from the Octave interpreter are also available within oct-files. The basic
means of extracting a sparse matrix from an octave_value
, and returning
it as an octave_value
, can be seen in the following example.
octave_value_list retval; SparseMatrix sm = args(0).sparse_matrix_value (); SparseComplexMatrix scm = args(1).sparse_complex_matrix_value (); SparseBoolMatrix sbm = args(2).sparse_bool_matrix_value (); … retval(2) = sbm; retval(1) = scm; retval(0) = sm;
The conversion to an octave_value
is handled by the sparse
octave_value
constructors, and so no special care is needed.