1HPL_dgemm(3) HPL Library Functions HPL_dgemm(3)
2
3
4
6 HPL_dgemm - C := alpha * op(A) * op(B) + beta * C.
7
9 #include "hpl.h"
10
11 void HPL_dgemm( const enum HPL_ORDER ORDER, const enum HPL_TRANS
12 TRANSA, const enum HPL_TRANS TRANSB, const int M, const int N, const
13 int K, const double ALPHA, const double * A, const int LDA, const dou‐
14 ble * B, const int LDB, const double BETA, double * C, const int LDC );
15
17 HPL_dgemm performs one of the matrix-matrix operations
18
19 C := alpha * op( A ) * op( B ) + beta * C
20
21 where op( X ) is one of
22
23 op( X ) = X or op( X ) = X^T.
24
25 Alpha and beta are scalars, and A, B and C are matrices, with op(A)
26 an m by k matrix, op(B) a k by n matrix and C an m by n matrix.
27
29 ORDER (local input) const enum HPL_ORDER
30 On entry, ORDER specifies the storage format of the operands
31 as follows:
32 ORDER = HplRowMajor,
33 ORDER = HplColumnMajor.
34
35 TRANSA (local input) const enum HPL_TRANS
36 On entry, TRANSA specifies the form of op(A) to be used in
37 the matrix-matrix operation follows:
38 TRANSA==HplNoTrans : op( A ) = A,
39 TRANSA==HplTrans : op( A ) = A^T,
40 TRANSA==HplConjTrans : op( A ) = A^T.
41
42 TRANSB (local input) const enum HPL_TRANS
43 On entry, TRANSB specifies the form of op(B) to be used in
44 the matrix-matrix operation follows:
45 TRANSB==HplNoTrans : op( B ) = B,
46 TRANSB==HplTrans : op( B ) = B^T,
47 TRANSB==HplConjTrans : op( B ) = B^T.
48
49 M (local input) const int
50 On entry, M specifies the number of rows of the matrix
51 op(A) and of the matrix C. M must be at least zero.
52
53 N (local input) const int
54 On entry, N specifies the number of columns of the matrix
55 op(B) and the number of columns of the matrix C. N must be
56 at least zero.
57
58 K (local input) const int
59 On entry, K specifies the number of columns of the matrix
60 op(A) and the number of rows of the matrix op(B). K must be
61 be at least zero.
62
63 ALPHA (local input) const double
64 On entry, ALPHA specifies the scalar alpha. When ALPHA is
65 supplied as zero then the elements of the matrices A and B
66 need not be set on input.
67
68 A (local input) const double *
69 On entry, A is an array of dimension (LDA,ka), where ka is k
70 when TRANSA==HplNoTrans, and is m otherwise. Before
71 entry with TRANSA==HplNoTrans, the leading m by k part of
72 the array A must contain the matrix A, otherwise the leading k
73 by m part of the array A must contain the matrix A.
74
75 LDA (local input) const int
76 On entry, LDA specifies the first dimension of A as declared
77 in the calling (sub) program. When TRANSA==HplNoTrans then
78 LDA must be at least max(1,m), otherwise LDA must be at least
79 max(1,k).
80
81 B (local input) const double *
82 On entry, B is an array of dimension (LDB,kb), where kb is n
83 when TRANSB==HplNoTrans, and is k otherwise. Before entry
84 with TRANSB==HplNoTrans, the leading k by n part of the
85 array B must contain the matrix B, otherwise the leading n by
86 k part of the array B must contain the matrix B.
87
88 LDB (local input) const int
89 On entry, LDB specifies the first dimension of B as declared
90 in the calling (sub) program. When TRANSB==HplNoTrans then
91 LDB must be at least max(1,k), otherwise LDB must be at least
92 max(1,n).
93
94 BETA (local input) const double
95 On entry, BETA specifies the scalar beta. When BETA is
96 supplied as zero then the elements of the matrix C need
97 not be set on input.
98
99 C (local input/output) double *
100 On entry, C is an array of dimension (LDC,n). Before entry,
101 the leading m by n part of the array C must contain the
102 matrix C, except when beta is zero, in which case C need not
103 be set on entry. On exit, the array C is overwritten by the m
104 by n matrix ( alpha*op( A )*op( B ) + beta*C ).
105
106 LDC (local input) const int
107 On entry, LDC specifies the first dimension of C as declared
108 in the calling (sub) program. LDC must be at least
109 max(1,m).
110
112 #include "hpl.h"
113
114 int main(int argc, char *argv[])
115 {
116 double a[2*2], b[2*2], c[2*2];
117 a[0] = 1.0; a[1] = 2.0; a[2] = 3.0; a[3] = 3.0;
118 b[0] = 2.0; b[1] = 1.0; b[2] = 1.0; b[3] = 2.0;
119 c[0] = 4.0; c[1] = 3.0; c[2] = 2.0; c[3] = 1.0;
120 HPL_dgemm( HplColumnMajor, HplNoTrans, HplNoTrans,
121 2, 2, 2, 2.0, a, 2, b, 2, -1.0, c, 2 );
122 printf(" [%f,%f]\n", c[0], c[2]);
123 printf("c=[%f,%f]\n", c[1], c[3]);
124 exit(0); return(0);
125 }
126
128 HPL_dtrsm (3).
129
130
131
132HPL 2.2 February 24, 2016 HPL_dgemm(3)