NAG FL Interface
f11mkf (direct_​real_​gen_​matmul)

1 Purpose

f11mkf computes a matrix-matrix or transposed matrix-matrix product involving a real, square, sparse nonsymmetric matrix stored in compressed column (Harwell–Boeing) format.

2 Specification

Fortran Interface
Subroutine f11mkf ( trans, n, m, alpha, icolzp, irowix, a, b, ldb, beta, c, ldc, ifail)
Integer, Intent (In) :: n, m, icolzp(*), irowix(*), ldb, ldc
Integer, Intent (Inout) :: ifail
Real (Kind=nag_wp), Intent (In) :: alpha, a(*), b(ldb,*), beta
Real (Kind=nag_wp), Intent (Inout) :: c(ldc,*)
Character (1), Intent (In) :: trans
C Header Interface
#include <nag.h>
void  f11mkf_ (const char *trans, const Integer *n, const Integer *m, const double *alpha, const Integer icolzp[], const Integer irowix[], const double a[], const double b[], const Integer *ldb, const double *beta, double c[], const Integer *ldc, Integer *ifail, const Charlen length_trans)
The routine may be called by the names f11mkf or nagf_sparse_direct_real_gen_matmul.

3 Description

f11mkf computes either the matrix-matrix product CαAB+βC, or the transposed matrix-matrix product CαATB + βC, according to the value of the argument trans, where A is a real n by n sparse nonsymmetric matrix, of arbitrary sparsity pattern with nnz nonzero elements, B and C are n by m real dense matrices. The matrix A is stored in compressed column (Harwell–Boeing) storage format. The array a stores all nonzero elements of A, while arrays icolzp and irowix store the compressed column indices and row indices of A respectively.

4 References

None.

5 Arguments

1: trans Character(1) Input
On entry: specifies whether or not the matrix A is transposed.
trans='N'
αAB+βC is computed.
trans='T'
αATB+βC is computed.
Constraint: trans='N' or 'T'.
2: n Integer Input
On entry: n, the order of the matrix A.
Constraint: n0.
3: m Integer Input
On entry: m, the number of columns of matrices B and C.
Constraint: m0.
4: alpha Real (Kind=nag_wp) Input
On entry: α, the scalar factor in the matrix multiplication.
5: icolzp* Integer array Input
Note: the dimension of the array icolzp must be at least n+1.
On entry: icolzpi contains the index in A of the start of a new column. See Section 2.1.3 in the F11 Chapter Introduction.
6: irowix* Integer array Input
Note: the dimension of the array irowix must be at least icolzpn+1-1, the number of nonzeros of the sparse matrix A.
On entry: the row index array of sparse matrix A.
7: a* Real (Kind=nag_wp) array Input
Note: the dimension of the array a must be at least icolzpn+1-1, the number of nonzeros of the sparse matrix A.
On entry: the array of nonzero values in the sparse matrix A.
8: bldb* Real (Kind=nag_wp) array Input
Note: the second dimension of the array b must be at least max1,m.
On entry: the n by m matrix B.
9: ldb Integer Input
On entry: the first dimension of the array b as declared in the (sub)program from which f11mkf is called.
Constraint: ldbmax1,n.
10: beta Real (Kind=nag_wp) Input
On entry: the scalar factor β.
11: cldc* Real (Kind=nag_wp) array Input/Output
Note: the second dimension of the array c must be at least max1,m.
On entry: the n by m matrix C.
On exit: C is overwritten by αAB+βC or αATB +βC depending on the value of trans.
12: ldc Integer Input
On entry: the first dimension of the array c as declared in the (sub)program from which f11mkf is called.
Constraint: ldcmax1,n.
13: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 4 in the Introduction to the NAG Library FL Interface for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, ldb=value and n=value.
Constraint: ldbmax1,n.
On entry, ldc=value and n=value.
Constraint: ldcmax1,n.
On entry, m=value.
Constraint: m0.
On entry, n=value.
Constraint: n0.
On entry, trans=value.
Constraint: trans='N' or 'T'.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

f11mkf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

None.

10 Example

This example reads in a sparse matrix A and a dense matrix B. It then calls f11mkf to compute the matrix-matrix product C=AB and the transposed matrix-matrix product C=ATB, where
A= 2.00 1.00 0 0 0 0 0 1.00 -1.00 0 4.00 0 1.00 0 1.00 0 0 0 1.00 2.00 0 -2.00 0 0 3.00   and  B= 0.70 1.40 0.16 0.32 0.52 1.04 0.77 1.54 0.28 0.56 .  

10.1 Program Text

Program Text (f11mkfe.f90)

10.2 Program Data

Program Data (f11mkfe.d)

10.3 Program Results

Program Results (f11mkfe.r)