F11MKF (PDF version)
F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F11MKF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

 Contents

    1  Purpose
    7  Accuracy

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

SUBROUTINE F11MKF ( TRANS, N, M, ALPHA, ICOLZP, IROWIX, A, B, LDB, BETA, C, LDC, IFAIL)
INTEGER  N, M, ICOLZP(*), IROWIX(*), LDB, LDC, IFAIL
REAL (KIND=nag_wp)  ALPHA, A(*), B(LDB,*), BETA, C(LDC,*)
CHARACTER(1)  TRANS

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 parameter 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  Parameters

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 – INTEGERInput
On entry: n, the order of the matrix A.
Constraint: N0.
3:     M – INTEGERInput
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 arrayInput
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 arrayInput
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) arrayInput
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) arrayInput
Note: the second dimension of the array B must be at least max1,M.
On entry: the n by m matrix B.
9:     LDB – INTEGERInput
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) arrayInput/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 – INTEGERInput
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 – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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 parameter, 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,TRANS'N' or 'T',
orN<0,
orM<0,
orLDB<max1,N,
orLDC<max1,N.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.8 in the Essential Introduction for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.7 in the Essential Introduction for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.6 in the Essential Introduction 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)


F11MKF (PDF version)
F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2015