NAG CL Interface
f16yac (dgemm)

1 Purpose

f16yac performs matrix-matrix multiplication for a real general matrix.

2 Specification

#include <nag.h>
void  f16yac (Nag_OrderType order, Nag_TransType transa, Nag_TransType transb, Integer m, Integer n, Integer k, double alpha, const double a[], Integer pda, const double b[], Integer pdb, double beta, double c[], Integer pdc, NagError *fail)
The function may be called by the names: f16yac, nag_blast_dgemm or nag_dgemm.

3 Description

f16yac performs one of the matrix-matrix operations
CαAB+βC, CαATB+βC, CαABT+βC  or CαATBT+βC,  
where A, B and C are real matrices, and α and β are real scalars; C is always m by n.

4 References

Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001) Basic Linear Algebra Subprograms Technical (BLAST) Forum Standard University of Tennessee, Knoxville, Tennessee https://www.netlib.org/blas/blast-forum/blas-report.pdf

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: transa Nag_TransType Input
On entry: specifies whether the operation involves A or AT.
transa=Nag_NoTrans
It involves A.
transa=Nag_Trans or Nag_ConjTrans
It involves AT.
Constraint: transa=Nag_NoTrans, Nag_Trans or Nag_ConjTrans.
3: transb Nag_TransType Input
On entry: specifies whether the operation involves B or BT.
transb=Nag_NoTrans
It involves B.
transb=Nag_Trans or Nag_ConjTrans
It involves BT.
Constraint: transb=Nag_NoTrans, Nag_Trans or Nag_ConjTrans.
4: m Integer Input
On entry: m, the number of rows of the matrix C; the number of rows of A if transa=Nag_NoTrans, or the number of columns of A if transa=Nag_Trans or Nag_ConjTrans.
Constraint: m0.
5: n Integer Input
On entry: n, the number of columns of the matrix C; the number of columns of B if transb=Nag_NoTrans, or the number of rows of B if transb=Nag_Trans or Nag_ConjTrans.
Constraint: n0.
6: k Integer Input
On entry: k, the number of columns of A if transa=Nag_NoTrans, or the number of rows of A if transa=Nag_Trans or Nag_ConjTrans; the number of rows of B if transb=Nag_NoTrans, or the number of columns of B if transb=Nag_Trans or Nag_ConjTrans.
Constraint: k0.
7: alpha double Input
On entry: the scalar α.
8: a[dim] const double Input
Note: the dimension, dim, of the array a must be at least
  • max1,pda×k when transa=Nag_NoTrans and order=Nag_ColMajor;
  • max1,m×pda when transa=Nag_NoTrans and order=Nag_RowMajor;
  • max1,pda×m when transa=Nag_Trans or Nag_ConjTrans and order=Nag_ColMajor;
  • max1,k×pda when transa=Nag_Trans or Nag_ConjTrans and order=Nag_RowMajor.
If order=Nag_ColMajor, Aij is stored in a[j-1×pda+i-1].
If order=Nag_RowMajor, Aij is stored in a[i-1×pda+j-1].
On entry: the matrix A; A is m by k if transa=Nag_NoTrans, or k by m if transa=Nag_Trans or Nag_ConjTrans.
9: pda Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraints:
  • if order=Nag_ColMajor,
    • if transa=Nag_NoTrans, pda max1,m ;
    • if transa=Nag_Trans or Nag_ConjTrans, pda max1,k ;
  • if order=Nag_RowMajor,
    • if transa=Nag_NoTrans, pdamax1,k;
    • if transa=Nag_Trans or Nag_ConjTrans, pdamax1,m.
10: b[dim] const double Input
Note: the dimension, dim, of the array b must be at least
  • max1,pdb×n when transb=Nag_NoTrans and order=Nag_ColMajor;
  • max1,k×pdb when transb=Nag_NoTrans and order=Nag_RowMajor;
  • max1,pdb×k when transb=Nag_Trans or Nag_ConjTrans and order=Nag_ColMajor;
  • max1,n×pdb when transb=Nag_Trans or Nag_ConjTrans and order=Nag_RowMajor.
If order=Nag_ColMajor, Bij is stored in b[j-1×pdb+i-1].
If order=Nag_RowMajor, Bij is stored in b[i-1×pdb+j-1].
On entry: the matrix B; B is k by n if transb=Nag_NoTrans, or n by k if transb=Nag_Trans or Nag_ConjTrans.
11: 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,
    • if transb=Nag_NoTrans, pdb max1,k ;
    • if transb=Nag_Trans or Nag_ConjTrans, pdb max1,n ;
  • if order=Nag_RowMajor,
    • if transb=Nag_NoTrans, pdbmax1,n;
    • if transb=Nag_Trans or Nag_ConjTrans, pdbmax1,k.
12: beta double Input
On entry: the scalar β.
13: c[dim] double Input/Output
Note: the dimension, dim, of the array c must be at least
  • max1,pdc×n when order=Nag_ColMajor;
  • max1,m×pdc when order=Nag_RowMajor.
If order=Nag_ColMajor, Cij is stored in c[j-1×pdc+i-1].
If order=Nag_RowMajor, Cij is stored in c[i-1×pdc+j-1].
On entry: the m by n matrix C.
If beta=0, c need not be set.
On exit: the updated matrix C.
14: 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,m;
  • if order=Nag_RowMajor, pdcmax1,n.
15: 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_ENUM_INT_2
On entry, transa=value, k=value, pda=value.
Constraint: if transa=Nag_NoTrans, pdamax1,k.
On entry, transa=value, m=value, pda=value.
Constraint: if transa=Nag_Trans or Nag_ConjTrans, pdamax1,m.
On entry, transa=value, pda=value, k=value.
Constraint: if transa=Nag_Trans or Nag_ConjTrans, pda max1,k .
On entry, transa=value, pda=value, m=value.
Constraint: if transa=Nag_NoTrans, pda max1,m .
On entry, transb=value, k=value, pdb=value.
Constraint: if transb=Nag_NoTrans, pdb max1,k .
On entry, transb=value, k=value, pdb=value.
Constraint: if transb=Nag_Trans or Nag_ConjTrans, pdbmax1,k.
On entry, transb=value, n=value, pdb=value.
Constraint: if transb=Nag_NoTrans, pdbmax1,n.
On entry, transb=value, n=value, pdb=value.
Constraint: if transb=Nag_Trans or Nag_ConjTrans, pdb max1,n .
NE_INT
On entry, k=value.
Constraint: k0.
On entry, m=value.
Constraint: m0.
On entry, n=value.
Constraint: n0.
NE_INT_2
On entry, pdc=value, 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.
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

The BLAS standard requires accurate implementations which avoid unnecessary over/underflow (see Section 2.7 of Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001)).

8 Parallelism and Performance

f16yac 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 computes the matrix-matrix product
C=αAB+βC  
where
A = 1.0 2.0 3.0 3.0 4.0 5.0 5.0 6.0 -1.0 ,  
B = 1.0 2.0 -2.0 1.0 3.0 -1.0 ,  
C = -2.0 1.0 1.0 3.0 2.0 -1.0 ,  
α=1.5   and   β=1.0 .  

10.1 Program Text

Program Text (f16yace.c)

10.2 Program Data

Program Data (f16yace.d)

10.3 Program Results

Program Results (f16yace.r)