LASs - Linear Algebra Routines on OmpSs 1.0.0 LASs

- Main Page
- Files

- File List
- File Members

Functions
ddss_dgemm.c File Reference

LASs-DDSs ddss_dgemm routine. More...

`#include "../include/lass.h"`
Include dependency graph for ddss_dgemm.c:

Go to the source code of this file.

## Functions
int | ddss_dgemm (enum DDSS_TRANS TRANS_A, enum DDSS_TRANS TRANS_B, int M, int N, int K, double ALPHA, double *A, int LDA, double *B, int LDB, double BETA, double *C, int LDC)

## Detailed Description

LASs-DDSs ddss_dgemm routine.

LASs-DDSs is a software package provided by: Barcelona Supercomputing Center - Centro Nacional de Supercomputacion

Author
  Pedro Valero-Lara pedro.nosp@m..val.nosp@m.ero@b.nosp@m.sc.e.nosp@m.s

Date
  2017-01-02

Definition in file ddss_dgemm.c.

## Function Documentation

int ddss_dgemm | ( | enum DDSS_TRANS | TRANS_A,
|  | enum DDSS_TRANS | TRANS_B,
|  | int | M,
|  | int | N,
|  | int | K,
|  | double | ALPHA,
|  | double * | A,
|  | int | LDA,
|  | double * | B,
|  | int | LDB,
|  | double | BETA,
|  | double * | C,
|  | int | LDC
| ) |  |

Performs the matrix-matrix operation:

    C = ALPHA * op( A ) * op( B ) + BETA * C

where op( X ) is one of:

    op( X ) = X      or
    op( X ) = X**T

ALPHA and BETA are scalars, and A, B and C are matrices, with op( A ) an M by K matrix, op( B ) a K by N matrix and C an M by N matrix.

Parameters

  [in] | TRANS_A | enum DDSS_TRANS. TRANS_A specifies the form of op( A ) to be used in the matrix multiplication as follows: NoTrans: op( A ) = A. Trans: op( A ) = A**T.
  [in] | TRANS_B | enum DDSS_TRANS. TRANS_B specifies the form of op( B ) to be used in the matrix multiplication as follows: NoTrans: op( B ) = B. Trans: op( B ) = B**T.
  [in] | M | int. M specifies the number of rows of the matrix A and the number of rows of the matrix C. M must be greater than zero.
  [in] | N | int. N specifies the number of columns of the matrix B and the number of columns of the matrix C. N must be greater than zero.
  [in] | K | int. K specifies the number of columns of the matrix A and the number of rows of the matrix B. K must be greater than zero.
  [in] | ALPHA | double.
  [in] | A | double *. A is a pointer to a matrix of dimension Ma ( rows ) by Ka ( columns ), where Ma is M and Ka is K when TRANS_A = NoTrans, and Ma is K and Ka is M otherwise.
  [in] | LDA | int. LDA specifies the number of columns of A ( row-major order ). When TRANS_A = NoTrans then LDA must be at least max( 1, K ), otherwise LDA must be at least max( 1, M ).
  [in] | B | double *. B is a pointer to a matrix of dimension Kb ( rows ) by Nb ( columns ), where Kb is K and Nb is N when TRANS_B = NoTrans, and Kb is N and Nb is K otherwise.
  [in] | LDB | int. LDB specifies the number of columns of B ( row-major order ). When TRANS_B = NoTrans then LDB must be at least max( 1, N ), otherwise LDB must be at least max( 1, K ).
  [in] | BETA | double.
  [in,out] | C | double *. C is a pointer to a matrix of dimension M by N. On exit, C is overwritten by the M by N matrix ( ALPHA*op( A )*op( B ) + BETA*C ).
  [in] | LDC | int. LDC specifies the number of columns of C ( row-major order ). LDC must be at least max( 1, N ).

Return values

  Success | successful exit
  NoSuccess | unsuccessful exit

See also
  kdgemm

Definition at line 128 of file ddss_dgemm.c.

References kdgemm().

133 {
134
135 // Local variables
136 int An, Bn;
137
138 // Argument checking
139 if ( ( TRANS_A != NoTrans ) && ( TRANS_A != Trans ) )
140 {
141 fprintf( stderr, "Illegal value of TRANS_A, in ddss_dgemm code\n" );
142 return NoSuccess;
143 }
144
145 if ( ( TRANS_B != NoTrans ) && ( TRANS_B != Trans ) )
146 {
147 fprintf( stderr, "Illegal value of TRANS_B, in ddss_dgemm code\n" );
148 return NoSuccess;
149 }
150
151 if ( M < 0 )
152 {
153 fprintf( stderr, "Illegal value of M, in ddss_dgemm code\n" );
154 return NoSuccess;
155 }
156
157 if ( N < 0 )
158 {
159 fprintf( stderr, "Illegal value of N, in ddss_dgemm code\n" );
160 return NoSuccess;
161 }
162
163 if ( K < 0 )
164 {
165 fprintf( stderr, "Illegal value of K, in ddss_dgemm code\n" );
166 return NoSuccess;
167 }
168
169 if ( TRANS_A == NoTrans )
170 {
171 An = K;
172 }
173 else
174 {
175 An = M;
176 }
177
178 if ( LDA < MAX( 1, An ) )
179 {
180 fprintf( stderr, "Illegal value of LDA, in ddss_dgemm code\n" );
181 return NoSuccess;
182 }
183
184 if ( TRANS_B == NoTrans )
185 {
186 Bn = N;
187 }
188 else
189 {
190 Bn = K;
191 }
192
193 if ( LDB < MAX( 1, Bn ) )
194 {
195 fprintf( stderr, "Illegal value of LDB, in ddss_dgemm code\n" );
196 return NoSuccess;
197 }
198
199 if ( LDC < MAX( 1, N ) )
200 {
201 fprintf( stderr, "Illegal value of LDC, in ddss_dgemm code\n" );
202 return NoSuccess;
203 }
204
205 // Quick return
206 if ( M == 0 || N == 0 || ( ( ALPHA == 0.0 || K == 0 ) && BETA == 1.0 ) )
207 {
208 return Success;
209 }
210
211 return kdgemm( TRANS_A, TRANS_B, M, N, K,
212 (const double) ALPHA, A, LDA,
213 B, LDB,
214 (const double) BETA, C, LDC );
215
216 }
kdgemm
enum LASS_RETURN kdgemm(enum DDSS_TRANS TRANS_A, enum DDSS_TRANS TRANS_B, int M, int N, int K, const double ALPHA, double *A, int LDA, double *B, int LDB, const double BETA, double *C, int LDC)
Definition: kdgemm.c:131