# naginterfaces.library.sparse.real_​symm_​sort¶

naginterfaces.library.sparse.real_symm_sort(n, a, irow, icol, dup, zer)[source]

real_symm_sort sorts the nonzero elements of a real sparse symmetric matrix, represented in symmetric coordinate storage format.

For full information please refer to the NAG Library document for f11zb

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/f11/f11zbf.html

Parameters
nint

, the order of the matrix .

afloat, array-like, shape

The nonzero elements of the lower triangular part of the real 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
afloat, ndarray, shape

The lower triangular 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

real_symm_sort takes a symmetric coordinate storage (SCS) representation (see the F11 Introduction) of a real sparse symmetric 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.

real_symm_sort also returns a pointer array to the starting address of each row in .