|
NAG[f11zac] NAG[nag_sparse_nsym_sort] - Sparse sort (nonsymmetric)
|
|
Calling Sequence
f11zac(n, nnz, a, irow, icol, dup, zero, istr, 'fail'=fail)
nag_sparse_nsym_sort(. . .)
Parameters
|
n - integer;
|
|
|
On entry: the order of the matrix .
|
|
Constraint: . .
|
|
|
nnz - assignable;
|
|
|
Note: On exit the variable nnz will have a value of type integer.
|
|
On entry: the number of non-zero elements in the matrix .
|
|
Constraint: . .
|
|
On exit: the number of non-zero elements with unique row and column indices.
|
|
|
a - Vector(1.. , datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array a must be at least .
|
|
On entry: the non-zero elements of the matrix . These may be in any order and there may be multiple non-zero elements with the same row and column indices.
|
|
On exit: the non-zero elements ordered by increasing row index, and by increasing column index within each row. Each non-zero element has a unique row and column index.
|
|
|
irow - Vector(1.. , datatype=integer[kernelopts('wordsize')/8]);
|
|
|
Note: the dimension, dim, of the array irow must be at least .
|
|
On entry: the row indices of the elements supplied in array a.
|
|
Constraint: , for . .
|
|
On exit: the first nnz elements contain the row indices corresponding to the elements returned in array a.
|
|
|
icol - Vector(1.. , datatype=integer[kernelopts('wordsize')/8]);
|
|
|
Note: the dimension, dim, of the array icol must be at least .
|
|
On entry: the column indices of the elements supplied in array a.
|
|
Constraint: , for . .
|
|
On exit: the first nnz elements contain the column indices corresponding to the elements returned in array a.
|
|
|
dup - String;
|
|
|
On entry: indicates how any non-zero elements with duplicate row and column indices are to be treated:
|
|
if then duplicate elements are removed;
|
|
if then the relevant values in array a are summed;
|
|
if then the function fails on detecting a duplicate.
|
|
Constraint: "Nag_SparseNsym_RemoveDups", "Nag_SparseNsym_SumDups" or "Nag_SparseNsym_FailDups". .
|
|
|
zero - String;
|
|
|
On entry: indicates how any elements with zero values in a are to be treated:
|
|
if then the entries are removed;
|
|
if then the entries are kept;
|
|
if then the function fails on detecting a zero.
|
|
Constraint: "Nag_SparseNsym_RemoveZeros", "Nag_SparseNsym_KeepZeros" or "Nag_SparseNsym_FailZeros". .
|
|
|
istr - Vector(1.. , datatype=integer[kernelopts('wordsize')/8]);
|
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_sparse_nsym_sort (f11zac) sorts the non-zero elements of a real sparse nonsymmetric matrix, represented in coordinate storage format.
|
|
Description
|
|
nag_sparse_nsym_sort (f11zac) takes a coordinate storage (CS) representation (see the f11 Chapter Introduction) of a real by sparse nonsymmetric matrix , and reorders the non-zero elements by increasing row index and increasing column index within each row. Entries with duplicate row and column indices may be removed, or the values may be summed. Any entries with zero values may optionally be removed.
nag_sparse_nsym_sort (f11zac) also returns istr which contains the starting indices of each row in .
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument dup had an illegal value.
"NE_INT_ARG_LT"
On entry, n must not be less than 1: .
"NE_NONSYMM_MATRIX"
A non-zero element has been supplied which does not lie within the matrix , i.e., one or more of the following constraints has been violated: , , for .
"NE_NON_ZERO_DUP"
Non-zero elements have been supplied which have duplicate row and column indices, when .
"NE_ZERO_COEFF"
At least one matrix element has been supplied with a zero coefficient value, when .
|
|
Further Comments
|
|
The time taken for a call to nag_sparse_nsym_sort (f11zac) is proportional to nnz.
Note that the resulting matrix may have either rows or columns with no entries. If row has no entries then .
|
|
|
Examples
|
|
>
|
n := 5:
nnz := 15:
dup := "Nag_SparseNsym_SumDups":
zero := "Nag_SparseNsym_RemoveZeros":
a := Vector([4, -2, 1, -2, -3, 1, 0, 1, -1, 6, 2, 2, 1, 1, 2], datatype=float[8]):
irow := Vector([3, 5, 4, 4, 5, 1, 1, 3, 2, 5, 1, 4, 2, 3, 4], datatype=integer[kernelopts('wordsize')/8]):
icol := Vector([1, 2, 4, 2, 5, 2, 5, 5, 4, 5, 1, 2, 3, 3, 5], datatype=integer[kernelopts('wordsize')/8]):
istr := Vector(6, datatype=integer[kernelopts('wordsize')/8]):
NAG:-f11zac(n, nnz, a, irow, icol, dup, zero, istr):
|
|
|