naginterfaces.library.sparse.complex_gen_sort¶
- naginterfaces.library.sparse.complex_gen_sort(n, a, irow, icol, dup, zer)[source]¶
complex_gen_sort
sorts the nonzero elements of a complex sparse non-Hermitian matrix, represented in coordinate storage format.For full information please refer to the NAG Library document for f11zn
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/f11/f11znf.html
- Parameters
- nint
, the order of the matrix .
- acomplex, array-like, shape
The nonzero elements of the matrix . These may be in any order and there may be multiple nonzero elements with the same row and column indices.
- irowint, array-like, shape
The row indices corresponding to the elements supplied in the array .
- icolint, array-like, shape
The column indices corresponding to the elements supplied in the array .
- dupstr, length 1
Indicates how elements in with duplicate row and column indices are to be treated.
Duplicate entries are removed, only the first entry is kept.
The relevant values in are summed.
The function fails with = 3 on detecting a duplicate.
- zerstr, length 1
Indicates how elements in with zero values are to be treated.
The entries are removed.
The entries are kept.
The function fails with = 4 on detecting a zero.
- Returns
- acomplex, ndarray, shape
The nonzero elements ordered by increasing row index, and by increasing column index within each row. Each nonzero element has a unique row and column index.
- irowint, ndarray, shape
The first elements contain the row indices corresponding to the elements returned in the array .
- icolint, ndarray, shape
The first elements contain the column indices corresponding to the elements returned in the array .
- istrint, ndarray, shape
, for , is the starting address in the arrays , and of row of the matrix . is the address of the last element in plus one.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, , and .
Constraint: and .
- (errno )
On entry, , and .
Constraint: and .
- (errno )
On entry, a duplicate entry has been found in row and column : , .
- (errno )
On entry, a zero entry has been found in row and column : , .
- Notes
complex_gen_sort
takes a coordinate storage (CS) representation (see the F11 Introduction) of a sparse complex non-Hermitian matrix , and reorders the nonzero elements by increasing row index and increasing column index within each row. Entries with duplicate row and column indices may be removed. Alternatively, duplicate entries may be summed, which facilitates spare matrix addition (see Further Comments). Any entries with zero values may optionally be removed.complex_gen_sort
also returns a pointer array to the starting address of each row in . This can be used to construct a compressed column storage (CCS) representation of the matrix (see Further Comments).