naginterfaces.library.sparse.real_rect_sort¶
- naginterfaces.library.sparse.real_rect_sort(m, a, irow, n=None, icol=None, istc=None, dup='S', zer='R')[source]¶
real_rect_sort
sorts the nonzero elements of a real sparse rectangular matrix, represented in coordinate storage or compressed column storage format.For full information please refer to the NAG Library document for f11zc
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/f11/f11zcf.html
- Parameters
- mint
, the number of rows in the matrix .
- afloat, array-like, shape
The nonzero elements of the matrix . If column indices are supplied via , the elements may be in any order. If column starting addresses are supplied via , the elements must be ordered by increasing column index. 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 .
- nNone or int, optional
, the number of columns in the matrix .
If you are providing column starting addresses via then your supplied value of will be ignored and it will be inferred from that array instead.
- icolNone or int, array-like, shape , optional
Must be used to supply the column indices corresponding to the elements supplied in the array , when is represented in coordinate storage format.
- istcNone or int, array-like, shape , optional
Must be used to supply the starting address of each column, as supplied in the array , when is represented in compressed column storage format.
- dupstr, length 1, optional
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 = 12 on detecting a duplicate.
- zerstr, length 1, optional
Indicates how elements in with zero values are to be treated.
The entries are removed.
The entries are kept.
The function fails with = 13 on detecting a zero.
- Returns
- afloat, ndarray, shape
The nonzero elements ordered by increasing column index, and by increasing row index within each column. Each nonzero element has a unique row and column index.
- irowint, ndarray, shape
The row indices corresponding to the elements returned in the array .
- icolint, ndarray, shape
The column indices corresponding to the elements returned in the array .
- istcint, ndarray, shape
The starting address of each column, as returned in the array . is the address of the last element in plus one.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, .
Constraint: , or .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, , and .
Constraint: if column indices are supplied, then .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, , and .
Constraint: , for
- (errno )
On entry, , and .
Constraint: .
- (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 .
- (errno )
Exactly one of and must be provided.
- (errno )
or must be provided.
- Notes
real_rect_sort
takes a coordinate storage (CS) representation (see the F11 Introduction), or compressed column storage (CCS) representation (see the F11 Introduction) of a real sparse rectangular matrix , and reorders the nonzero elements by increasing column index and increasing row index within each column.Entries with duplicate row and column indices may be removed. Alternatively, duplicate entries may be summed, which facilitates sparse matrix addition (see Further Comments). Any entries with zero values may optionally be removed.
Both CS and CCS representations of the resulting matrix are output, which allows
real_rect_sort
to be used to convert between the two formats (see Further Comments).