The block
argument is a preallocated array where get()
will store the result (so as to keep memory management in the hands of the user of GenericMatrix
). Basically you just create an empty numpy.ndarray
with the right size beforehand and use that as argument.
The other arguments can be more confusing: There is a long standing bug with the python documentation automatically generated by SWIG, which has trouble with overloaded functions and ignores %typemap
s defined in the interface files. You need to call
get(block, row_indices, col_indices)
where row_indices
and col_indices
are of type numpy.ndarray
with dtype=numpy.intc
and block is a numpy.ndarray
of type numpy.float
and shape (len(row_indices), len(col_indices))
.
set()
behaves analogously.