NAG Library Function Document
nag_sparse_sym_matvec (f11xec) computes a matrix-vector product involving a real sparse symmetric matrix stored in symmetric coordinate storage format.
||nag_sparse_sym_matvec (Integer n,
const double a,
const Integer irow,
const Integer icol,
const double x,
nag_sparse_sym_matvec (f11xec) computes the matrix-vector product
symmetric sparse matrix, of arbitrary sparsity pattern, stored in symmetric coordinate storage (SCS) format (see Section 2.1.2
in the f11 Chapter Introduction). The array a
stores all nonzero elements in the lower triangular part of
, while arrays irow
store the corresponding row and column indices respectively.
It is envisaged that a common use of nag_sparse_sym_matvec (f11xec) will be to compute the matrix-vector product required in the application of nag_sparse_sym_basic_solver (f11gec)
to sparse symmetric linear systems. An illustration of this usage appears in nag_sparse_sym_precon_ssor_solve (f11jdc)
n – IntegerInput
, the order of the matrix .
nnz – IntegerInput
the number of nonzero elements in the lower triangular part of .
a[nnz] – const doubleInput
: the nonzero elements in the lower triangular part of the matrix
, ordered by increasing row index, and by increasing column index within each row. Multiple entries for the same row and column indices are not permitted. The function nag_sparse_sym_sort (f11zbc)
may be used to order the elements in this way.
irow[nnz] – const IntegerInput
icol[nnz] – const IntegerInput
: the row and column indices of the nonzero elements supplied in array a
must satisfy these constraints (which may be imposed by a call to nag_sparse_sym_sort (f11zbc)
- and , for ;
- or and , for .
check – Nag_SparseSym_CheckDataInput
: specifies whether or not the SCS representation of the matrix
, values of n
should be checked.
- Checks are carried out on the values of n, nnz, irow and icol.
- None of these checks are carried out.
x[n] – const doubleInput
On entry: the vector .
y[n] – doubleOutput
On exit: the vector .
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
On entry, argument had an illegal value.
On entry, .
On entry, .
On entry, and .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG
On entry, ,
Constraint: and .
On entry, , ,
Constraint: and .
On entry, is out of order:
On entry, the location (
) is a duplicate:
. Consider calling nag_sparse_sym_sort (f11zbc)
to reorder and sum or remove duplicates.
The computed vector
satisfies the error bound
is a modest linear function of
is the machine precision
The time taken for a call to nag_sparse_sym_matvec (f11xec) is proportional to nnz
It is expected that a common use of nag_sparse_sym_matvec (f11xec) will be to compute the matrix-vector product required in the application of nag_sparse_sym_basic_solver (f11gec)
to sparse symmetric linear systems. In this situation nag_sparse_sym_matvec (f11xec) is likely to be called many times with the same matrix
. In the interests of both reliability and efficiency you are recommended to set
for the first of such calls, and to set
for all subsequent calls.
This example reads in a symmetric positive definite sparse matrix and a vector . It then calls nag_sparse_sym_matvec (f11xec) to compute the matrix-vector product .
9.1 Program Text
Program Text (f11xece.c)
9.2 Program Data
Program Data (f11xece.d)
9.3 Program Results
Program Results (f11xece.r)