NAG CL Interface
f11mkc (direct_​real_​gen_​matmul)

1 Purpose

f11mkc 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

#include <nag.h>
void  f11mkc (Nag_OrderType order, Nag_TransType trans, Integer n, Integer m, double alpha, const Integer icolzp[], const Integer irowix[], const double a[], const double b[], Integer pdb, double beta, double c[], Integer pdc, NagError *fail)
The function may be called by the names: f11mkc, nag_sparse_direct_real_gen_matmul or nag_superlu_matrix_product.

3 Description

f11mkc 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: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: trans Nag_TransType Input
On entry: specifies whether or not the matrix A is transposed.
trans=Nag_NoTrans
αAB+βC is computed.
trans=Nag_Trans
αATB+βC is computed.
Constraint: trans=Nag_NoTrans or Nag_Trans.
3: n Integer Input
On entry: n, the order of the matrix A.
Constraint: n0.
4: m Integer Input
On entry: m, the number of columns of matrices B and C.
Constraint: m0.
5: alpha double Input
On entry: α, the scalar factor in the matrix multiplication.
6: icolzp[dim] const Integer Input
Note: the dimension, dim, of the array icolzp must be at least n+1.
On entry: icolzp[i-1] contains the index in A of the start of a new column. See Section 2.1.3 in the F11 Chapter Introduction.
7: irowix[dim] const Integer Input
Note: the dimension, dim, of the array irowix must be at least icolzp[n]-1, the number of nonzeros of the sparse matrix A.
On entry: the row index array of sparse matrix A.
8: a[dim] const double Input
Note: the dimension, dim, of the array a must be at least icolzp[n]-1, the number of nonzeros of the sparse matrix A.
On entry: the array of nonzero values in the sparse matrix A.
9: b[dim] const double Input
Note: the dimension, dim, of the array b must be at least
  • max1,pdb×m when order=Nag_ColMajor;
  • max1,n×pdb when order=Nag_RowMajor.
The i,jth element of the matrix B is stored in
  • b[j-1×pdb+i-1] when order=Nag_ColMajor;
  • b[i-1×pdb+j-1] when order=Nag_RowMajor.
On entry: the n by m matrix B.
10: pdb Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraints:
  • if order=Nag_ColMajor, pdbmax1,n;
  • if order=Nag_RowMajor, pdbmax1,m.
11: beta double Input
On entry: the scalar factor β.
12: c[dim] double Input/Output
Note: the dimension, dim, of the array c must be at least
  • max1,pdc×m when order=Nag_ColMajor;
  • max1,n×pdc when order=Nag_RowMajor.
The i,jth element of the matrix C is stored in
  • c[j-1×pdc+i-1] when order=Nag_ColMajor;
  • c[i-1×pdc+j-1] when order=Nag_RowMajor.
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.
13: pdc Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array c.
Constraints:
  • if order=Nag_ColMajor, pdcmax1,n;
  • if order=Nag_RowMajor, pdcmax1,m.
14: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_INT
On entry, m=value.
Constraint: m0.
On entry, n=value.
Constraint: n0.
On entry, pdb=value.
Constraint: pdb>0.
On entry, pdc=value.
Constraint: pdc>0.
NE_INT_2
On entry, pdb=value and m=value.
Constraint: pdbmax1,m.
On entry, pdb=value and n=value.
Constraint: pdbmax1,n.
On entry, pdc=value and m=value.
Constraint: pdcmax1,m.
On entry, pdc=value and n=value.
Constraint: pdcmax1,n.
NE_INTERNAL_ERROR
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 for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

f11mkc 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 function. 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 f11mkc 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 (f11mkce.c)

10.2 Program Data

Program Data (f11mkce.d)

10.3 Program Results

Program Results (f11mkce.r)