Skip to content
Joris Gillis edited this page Sep 16, 2022 · 2 revisions

Standard documentation for Sparsity.get_nz:

 Get the nonzero index for a set of elements.

 get_nz(self) -> [int]
 get_nz(self, int rr, int cc) -> int
 get_nz(self, [int] rr, [int] cc) -> [int]

The index vector is used both for input and outputs and must be sorted by increasing nonzero index, i.e. column-wise. Elements not found in the sparsity pattern are set to -1.

Extra doc: https://github.com/casadi/casadi/wiki/L_ch

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.hpp#L516

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.cpp#L721-L723

.......

::

 get_nz(self)

Get the nonzero index for a set of elements.

The index vector is used both for input and outputs and must be sorted by increasing nonzero index, i.e. column-wise. Elements not found in the sparsity pattern are set to -1.

Extra doc: https://github.com/casadi/casadi/wiki/L_ch

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.hpp#L516

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.cpp#L721-L723

.............

.......

::

 get_nz(self, int rr, int cc)

Get the index of an existing non-zero element.

return -1 if the element does not exist

Extra doc: https://github.com/casadi/casadi/wiki/L_cf

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.hpp#L496

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.cpp#L247-L249

.............

.......

::

 get_nz(self, [int] rr, [int] cc)

Get a set of non-zero element.

return -1 if the element does not exist

Extra doc: https://github.com/casadi/casadi/wiki/L_cg

Doc source: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.hpp#L506

Implementation: https://github.com/casadi/casadi/blob/develop/casadi/core/sparsity.cpp#L260-L263

.............

Extra documentation

To edit, see writing tips.

Clone this wiki locally