LASs - Linear Algebra Routines on OmpSs 1.0.0 LASs

- Main Page
- Files

- File List
- File Members

ddss_dtrsm.c
Go to the documentation of this file.
1 #include "../include/lass.h"
2
3 /**
4 *
5 * @file ddss_dtrsm.c
6 *
7 * @brief LASs-DDSs ddss_dtrsm 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 * @author Boro Sofranac boro.sofranac@bsc.es
14 * @date 2017-12-14
15 * @reviewer
16 * @modified
17 *
18 **/
19
20 /**
21 *
22 * @ingroup DDSS
23 *
24 * Solves one of the matrix equations:
25 *
26 * op( A ) * X = ALPHA * B, or X * op( A ) = ALPHA * B
27 *
28 * where op( A ) is one of:
29 *
30 * op( A ) = A or
31 * op( A ) = A**T
32 *
33 * ALPHA is a scalar, X and B are M by N matrices, A is a unit, or non-unit,
34 * upper or lower triangular matrix. The matrix X is overwritten on B
35 *
36 **/
37
38 /**
39 *
40 * @param[in]
41 * SIDE enum DDSS_SIDE.
42 * SIDE specifies the position of the triangular A matrix in
43 * the operations:
44 * - Left: op( A ) * X = ALPHA * B.
45 * - Right: X * op( A ) = ALPHA * B.
46 *
47 * @param[in]
48 * UPLO enum DDSS_UPLO.
49 * UPLO specifies the form of A is stored:
50 * - Lower: Lower triangle of A is stored. The upper traingular part is
51 * not referenced.
52 * - Upper: Upper triangle of A is stored. The lower triangular part is
53 * not referenced.
54 *
55 * @param[in]
56 * TRANS_A enum DDSS_TRANS.
57 * TRANS_A specifies the form of op( A ) to be used:
58 * - NoTrans: op( A ) = A.
59 * - Trans: op( A ) = A**T.
60 *
61 * @param[in]
62 * DIAG enum DDSS_DIAG.
63 * DIAG specifies whether or not A is unit triangular as follows:
64 * - Unit: A is assumed to be unit triangular.
65 * - NonUnit: A is not assumed to be unit triangular.
66 *
67 * @param[in]
68 * M int.
69 * M specifies the number of rows of B. M must be at least zero.
70 *
71 * @param[in]
72 * N int.
73 * N specifies the number of columns of B. N must be at least zero.
74 *
75 * @param[in]
76 * ALPHA double.
77 * ALPHA specifies the scalar alpha.
78 *
79 * @param[in]
80 * A double *.
81 * A is a pointer to a matrix of dimension K by K, where K is M when
82 * SIDE = Left and is N otherwise.
83 * When UPLO = Uppper the strictly lower triangular part of A is not
84 * referenced and when UPLO = Lower the strictly upper triangular part
85 * of A is not referenced.
86 * Note that when DIAG = Unit, the diagonal elements of A are not
87 * referenced either, but are assumed to be unity.
88 *
89 * @param[in]
90 * LDA int.
91 * LDA specifies the number of columns of A ( row-major order ).
92 * When SIDE = Left then LDA must be at least max( 1, M ), otherwise
93 * LDA must be at least max( 1, N ).
94 *
95 * @param[in, out]
96 * B double *.
97 * B is a pointer to a matrix of dimension M by N.
98 * On exit the matrix B is overwritten by the solution matrix X.
99 *
100 * @param[in]
101 * LDB int.
102 * LDB specifies the number of columns of B ( row-major order ).
103 * LDB must be at least max( 1, N ).
104 *
105 **/
106
107 /**
108 *
109 * @sa kdtrsm
110 *
111 **/
112
113 int ddss_dtrsm( enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO,
114 enum DDSS_TRANS TRANS_A, enum DDSS_DIAG DIAG,
115 int M, int N,
116 const double ALPHA, double* A, int LDA,
117 double *B, int LDB )
118 {
119
120 // Local variables
121 int nA;
122
123 // Argument checking
124 if ( ( SIDE != Left ) && ( SIDE != Right ) )
125 {
126 fprintf( stderr, "Illegal value of SIDE, in ddss_dtrsm code\n" );
127 return NoSuccess;
128 }
129
130 if ( ( UPLO != Upper ) && ( UPLO != Lower ) )
131 {
132 fprintf( stderr, "Illegal value of UPLO, in ddss_dtrsm code\n" );
133 return NoSuccess;
134 }
135
136 if ( ( TRANS_A != NoTrans ) && ( TRANS_A != Trans ) )
137 {
138 fprintf( stderr, "Illegal value of TRANS_A, in ddss_dtrsm code\n" );
139 return NoSuccess;
140 }
141
142 if ( ( DIAG != Unit ) && ( DIAG != NonUnit ) )
143 {
144 fprintf( stderr, "Illegal value of DIAG, in ddss_dtrsm code\n" );
145 return NoSuccess;
146 }
147
148 if ( M < 0 )
149 {
150 fprintf( stderr, "Illegal value of M, in ddss_dtrsm code\n" );
151 return NoSuccess;
152 }
153
154 if ( N < 0 )
155 {
156 fprintf( stderr, "Illegal value of N, in ddss_dtrsm code\n" );
157 return NoSuccess;
158 }
159
160 if ( SIDE == Left )
161 {
162 nA = M;
163 }
164 else
165 {
166 nA = N;
167 }
168
169 if ( LDA < MAX( 1, nA ) )
170 {
171 fprintf( stderr, "Illegal value of LDA, in ddss_dtrsm code\n" );
172 return NoSuccess;
173 }
174
175 if ( LDB < MAX( 1, N ) )
176 {
177 fprintf( stderr, "Illegal value of LDB, in ddss_dtrsm code\n" );
178 return NoSuccess;
179 }
180
181 // Quick return
182 if ( M == 0 || N == 0 )
183 {
184 return Success;
185 }
186
187 return kdtrsm( SIDE, UPLO,
188 TRANS_A, DIAG,
189 M, N,
190 ALPHA, A, LDA,
191 B, LDB );
192
193 }
194
kdtrsm
enum LASS_RETURN kdtrsm(enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO, enum DDSS_TRANS TRANS_A, enum DDSS_DIAG DIAG, int M, int N, const double ALPHA, double *A, int LDA, double *B, int LDB)
Definition: kdtrsm.c:123
ddss_dtrsm
int ddss_dtrsm(enum DDSS_SIDE SIDE, enum DDSS_UPLO UPLO, enum DDSS_TRANS TRANS_A, enum DDSS_DIAG DIAG, int M, int N, const double ALPHA, double *A, int LDA, double *B, int LDB)
Definition: ddss_dtrsm.c:113