Function: real_gen_matvec
NAG CPP Interface
nagcpp::sparse::real_gen_matvec (f11xa)
Function: real_gen_matvec
1
Purpose
real_gen_matvec computes a matrix-vector or transposed matrix-vector product involving a real sparse nonsymmetric matrix stored in coordinate storage format.
2
Specification
#include "f11/nagcpp_f11xa.hpp"
template <typename A, typename IROW, typename ICOL, typename X, typename Y>
void function real_gen_matvec(const string trans, const A &a, const IROW &irow, const ICOL &icol, const X &x, Y &&y, OptionalF11XA opt)
template <typename A, typename IROW, typename ICOL, typename X, typename Y>
void function real_gen_matvec(const string trans, const A &a, const IROW &irow, const ICOL &icol, const X &x, Y &&y)
3
Description
real_gen_matvec computes either the matrix-vector product
, or the transposed matrix-vector product
, according to the value of the argument
trans, where
is an
sparse nonsymmetric matrix, of arbitrary sparsity pattern. The matrix
is stored in coordinate storage (CS) format (see
Section 2.1.1 in the
F11 Chapter Introduction). The array
a stores all nonzero elements of
, while arrays
irow and
icol store the corresponding row and column indices respectively.
It is envisaged that a common use of
real_gen_matvec will be to compute the matrix-vector product required in the application of
f11bef (no CPP interface) to sparse linear systems.
4
References
None.
5
Arguments
-
1:
– string
Input
-
On entry: specifies whether or not the matrix
is transposed.
- is computed.
- is computed.
Constraint:
or .
-
2:
– double array
Input
-
On entry: the nonzero elements in 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
rtnrefs1 (no CPP interface) may be used to order the elements in this way.
-
3:
– types::f77_integer array
Input
-
On entry: the row and column indices of the nonzero elements supplied in array
a.
Constraints:
irow and
icol must satisfy the following constraints (which may be imposed by a call to
rtnrefs1 (no CPP interface)):
- and , for ;
- or and , for .
-
4:
– types::f77_integer array
Input
-
On entry: the row and column indices of the nonzero elements supplied in array
a.
Constraints:
irow and
icol must satisfy the following constraints (which may be imposed by a call to
rtnrefs1 (no CPP interface)):
- and , for ;
- or and , for .
-
5:
– double array
Input
-
On entry: the vector .
-
6:
– double array
Output
-
On exit: the vector .
-
7:
– OptionalF11XA
Input/Output
-
Optional parameter container, derived from
Optional.
Container for:
- check – string
This optional parameter
may be set using the method
OptionalF11XA::check
and accessed via
OptionalF11XA::get_check.
Default:
On entry: specifies whether or not the CS representation of the matrix
, values of
n,
nnz,
irow and
icol should be checked.
- Checks are carried on the values of n, nnz, irow and icol.
- None of these checks are carried out.
Constraint:
or .
5.1Additional Quantities
- 1:
- , the order of the matrix
- 2:
- The number of nonzero elements in the matrix
6
Exceptions and Warnings
Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field,
errorid, stored either as a member of the thrown exception object (see
errorid), or as a member of
opt.
ifail, depending on how errors
and warnings are being handled (see
Error Handling for more details).
- Raises: ErrorException
-
- On entry, .
Constraint: .
- On entry, .
Constraint: .
- On entry, and .
Constraint: .
- On entry, .
Constraint: .
- On entry, .
Constraint: .
- On entry, the location () is a duplicate:
.
- On entry, is out of order:
.
- On entry, ,
and .
Constraint: and .
- On entry, ,
and .
Constraint: and .
- On entry, argument must be a vector of size array.
Supplied argument has dimensions.
- On entry, argument must be a vector of size array.
Supplied argument was a vector of size .
- On entry, argument must be a vector of size array.
The size for the supplied array could not be ascertained.
- On entry, the raw data component of is null.
- On entry, unable to ascertain a value for .
- An unexpected error has been triggered by this routine.
- Your licence key may have expired or may not have been installed correctly.
- Dynamic memory allocation failed.
7
Accuracy
The computed vector
satisfies the error bound:
- , if , or
- ,
if ,
where
is a modest linear function of
, and
is the
machine precision.
8
Parallelism and Performance
Please see the description for the underlying computational routine in this section of the
FL Interface documentation.
The time taken for a call to
real_gen_matvec is proportional to
nnz.
It is expected that a common use of
real_gen_matvec will be to compute the matrix-vector product required in the application of
f11bef (no CPP interface) to sparse linear systems. In this situation
real_gen_matvec 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.
10
Example
Examples of the use of this method may be found in the examples for:
real_nmf_rcomm.
Function: real_gen_matvec