nag_dgemm (f16yac) (PDF version)
f16 Chapter Contents
f16 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_dgemm (f16yac)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_dgemm (f16yac) performs matrix-matrix multiplication for a real general matrix.

2  Specification

#include <nag.h>
#include <nagf16.h>
void  nag_dgemm (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)

3  Description

nag_dgemm (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 http://www.netlib.org/blas/blast-forum/blas-report.pdf

5  Arguments

1:     orderNag_OrderTypeInput
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.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     transaNag_TransTypeInput
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:     transbNag_TransTypeInput
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:     mIntegerInput
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:     nIntegerInput
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:     kIntegerInput
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:     alphadoubleInput
On entry: the scalar α.
8:     a[dim]const doubleInput
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:     pdaIntegerInput
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 doubleInput
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:   pdbIntegerInput
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:   betadoubleInput
On entry: the scalar β.
13:   c[dim]doubleInput/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:   pdcIntegerInput
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:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
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.

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

Not applicable.

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)


nag_dgemm (f16yac) (PDF version)
f16 Chapter Contents
f16 Chapter Introduction
NAG Library Manual

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