LASs - Linear Algebra Routines on OmpSs  1.0.0
LASs
ddss_dsymm.c
Go to the documentation of this file.
1 #include "../include/lass.h"
2 
3 /**
4  *
5  * @file ddss_dsymm.c
6  *
7  * @brief LASs-DDSs ddss_dsymm routine.
8  *
9  * LASs-DDSs is a software package provided by:
10  * Barcelona Supercomputing Center - Centro Nacional de Supercomputacion
11  *
12  * @author Pedro Valero-Lara pedro.valero@bsc.es
13  * @date 2017-07-11
14  * @reviewer
15  * @modified
16  *
17  **/
18 
19 /**
20  *
21  * @ingroup DDSS
22  *
23  * Performs one of the matrix-matrix operations:
24  *
25  * C = ALPHA * A * B + BETA * C
26  * or
27  *
28  * C = ALPHA * B * A + BETA * C
29  *
30  *
31  * where op( X ) is one of:
32  *
33  * op( X ) = X or
34  * op( X ) = X**T
35  *
36  * ALPHA and BETA are scalars, A is a symmetric matrix, and B and C
37  * are M by N matrices.
38  *
39 **/
40 
41 /**
42  *
43  * @param[in]
44  * SIDE enum DDSS_SIDE.
45  * UPLO specifies the position of the symmetric A matrix in
46  * the operation:
47  * - Left: C = ALPHA * A * B + BETA * C
48  * - Right: C = ALPHA * B * A + BETA * C
49  *
50  * @param[in]
51  * UPLO enum DDSS_UPLO.
52  * UPLO specifies the form of A is stored:
53  * - Lower: Lower triangle of A is stored. The upper traingular part is
54  * not referenced.
55  * - Upper: Upper triangle of A is stored. The lower triangular part is
56  * not referenced.
57  *
58  * @param[in]
59  * M int.
60  * M specifies the number of rows of the matrix C.
61  * M must be equal or greater than zero.
62  *
63  * @param[in]
64  * N int.
65  * N specifies the number of columns of the matrix C.
66  * N must be equal or greater than zero.
67  *
68  * @param[in]
69  * ALPHA double.
70  *
71  * @param[in]
72  * A double *.
73  * A is a pointer to a matrix of dimension Ma ( rows ) by Na
74  * (columns), where Ma is M and Na is M when SIDE = Left, and
75  * Ma is N and Na is N when SIDE = Right
76  *
77  *
78  * @param[in]
79  * LDA int.
80  * LDA specifies the number of columns of A ( row-major order ).
81  * LDA must be at least max( 1, Na ).
82  *
83  * @param[in]
84  * B double *.
85  * B is a pointer to a matrix of dimension M by N.
86  *
87  * @param[in]
88  * LDB int.
89  * LDB specifies the number of columns of B ( row-major order ).
90  * LDB must be at least max( 1, N ).
91  *
92  * @param[in]
93  * BETA double.
94  *
95  * @param[in,out]
96  * C double *.
97  * C is a pointer to a matrix of dimension M by N.
98  * On exit, C is overwritten by the M by N matrix.
99  *
100  * @param[in]
101  * LDC int.
102  * LDC specifies the number of columns of C ( row-major order ).
103  * LDC must be at least max( 1, N ).
104  *
105  **/
106 
107 /**
108  *
109  * @retval Success successful exit
110  * @retval NoSuccess unsuccessful exit
111  *
112  **/
113 
114 /**
115  *
116  * @sa kdsymm
117  *
118  **/
119 
120 int ddss_dsymm( enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO,
121  int M, int N,
122  double ALPHA, double *A, int LDA,
123  double *B, int LDB,
124  double BETA, double *C, int LDC )
125 {
126 
127  // Local variables
128  int nA;
129 
130  // Argument checking
131  if ( ( SIDE != Left ) && ( SIDE != Right ) )
132  {
133  fprintf( stderr, "Illegal value of SIDE, in ddss_dsymm code\n" );
134  return NoSuccess;
135  }
136 
137  if ( ( UPLO != Upper ) && ( UPLO != Lower ) )
138  {
139  fprintf( stderr, "Illegal value of UPLO, in ddss_dsymm code\n" );
140  return NoSuccess;
141  }
142 
143  if ( M < 0 )
144  {
145  fprintf( stderr, "Illegal value of M, in ddss_dsymm code\n" );
146  return NoSuccess;
147  }
148 
149  if ( N < 0 )
150  {
151  fprintf( stderr, "Illegal value of N, in ddss_dsymm code\n" );
152  return NoSuccess;
153  }
154 
155  // Quick return
156  if ( M == 0 || N == 0 || ( ALPHA == 0.0 && BETA == 1.0 ) )
157  {
158  return Success;
159  }
160 
161  if ( SIDE == Left )
162  {
163  nA = M;
164  }
165  else
166  {
167  nA = N;
168  }
169 
170  if ( LDA < MAX( 1, nA ) )
171  {
172  fprintf( stderr, "Illegal value of LDA, in ddss_dsymm code\n" );
173  return NoSuccess;
174  }
175 
176  if ( LDB < MAX( 1, N ) )
177  {
178  fprintf( stderr, "Illegal value of LDB, in ddss_dsymm code\n" );
179  return NoSuccess;
180  }
181 
182  if ( LDC < MAX( 1, N ) )
183  {
184  fprintf( stderr, "Illegal value of LDC, in ddss_dsymm code\n" );
185  return NoSuccess;
186  }
187 
188  return kdsymm( SIDE, UPLO, M, N,
189  ( const double ) ALPHA, A, LDA,
190  B, LDB,
191  ( const double ) BETA, C, LDC );
192 
193 }
int ddss_dsymm(enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO, int M, int N, double ALPHA, double *A, int LDA, double *B, int LDB, double BETA, double *C, int LDC)
Definition: ddss_dsymm.c:120
enum LASS_RETURN kdsymm(enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO, int M, int N, const double ALPHA, double *A, int LDA, double *B, int LDB, const double BETA, double *C, int LDC)
Definition: kdsymm.c:125