Debian Codegraph @

frame/2/trsv/bli_trsv_unf_var1.c

raw symbols SCIP
1 /*
2
3 BLIS
4 An object-based framework for developing high-performance BLAS-like
5 libraries.
6
7 Copyright (C) 2014, The University of Texas at Austin
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions are
11 met:
12 - Redistributions of source code must retain the above copyright
13 notice, this list of conditions and the following disclaimer.
14 - Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
17 - Neither the name(s) of the copyright holder(s) nor the names of its
18 contributors may be used to endorse or promote products derived
19 from this software without specific prior written permission.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 */
34
35 #include "blis.h"
36
37 #undef GENTFUNC
38 #define GENTFUNC( ctype, ch, varname ) \
39 \
40 void PASTEMAC(ch,varname) \
41 ( \
42 uplo_t uploa, \
43 trans_t transa, \
44 diag_t diaga, \
45 dim_t m, \
46 ctype* alpha, \
47 ctype* a, inc_t rs_a, inc_t cs_a, \
48 ctype* x, inc_t incx, \
49 cntx_t* cntx \
50 ) \
51 { \
52 const num_t dt = PASTEMAC(ch,type); \
53 \
54 ctype* one = PASTEMAC(ch,1); \
55 ctype* minus_one = PASTEMAC(ch,m1); \
56 ctype* A10; \
57 ctype* A11; \
58 ctype* A12; \
59 ctype* a10t; \
60 ctype* alpha11; \
61 ctype* a12t; \
62 ctype* x0; \
63 ctype* x1; \
64 ctype* x2; \
65 ctype* x01; \
66 ctype* chi11; \
67 ctype* x21; \
68 ctype alpha11_conj; \
69 ctype rho1; \
70 dim_t iter, i, k, j, l; \
71 dim_t b_fuse, f; \
72 dim_t n_behind, f_behind; \
73 inc_t rs_at, cs_at; \
74 uplo_t uploa_trans; \
75 conj_t conja; \
76 \
77 /* x = alpha * x; */ \
78 PASTEMAC(ch,scalv,BLIS_TAPI_EX_SUF) \
79 ( \
80 BLIS_NO_CONJUGATE, \
81 m, \
82 alpha, \
83 x, incx, \
84 cntx, \
85 NULL \
86 ); \
87 \
88 if ( bli_does_notrans( transa ) ) \
89 { \
90 rs_at = rs_a; \
91 cs_at = cs_a; \
92 uploa_trans = uploa; \
93 } \
94 else /* if ( bli_does_trans( transa ) ) */ \
95 { \
96 rs_at = cs_a; \
97 cs_at = rs_a; \
98 uploa_trans = bli_uplo_toggled( uploa ); \
99 } \
100 \
101 conja = bli_extract_conj( transa ); \
102 \
103 /* Query the context for the kernel function pointer and fusing factor. */ \
104 dotxf_ker_ft kfp_df = bli_cntx_get_ukr_dt( dt, BLIS_DOTXF_KER, cntx ); \
105 b_fuse = bli_cntx_get_blksz_def_dt( dt, BLIS_DF, cntx ); \
106 \
107 /* We reduce all of the possible cases down to just lower/upper. */ \
108 if ( bli_is_upper( uploa_trans ) ) \
109 { \
110 for ( iter = 0; iter < m; iter += f ) \
111 { \
112 f = bli_determine_blocksize_dim_b( iter, m, b_fuse ); \
113 i = m - iter - f; \
114 n_behind = iter; \
115 A11 = a + (i )*rs_at + (i )*cs_at; \
116 A12 = a + (i )*rs_at + (i+f)*cs_at; \
117 x1 = x + (i )*incx; \
118 x2 = x + (i+f)*incx; \
119 \
120 /* x1 = x1 - A12 * x2; */ \
121 kfp_df \
122 ( \
123 conja, \
124 BLIS_NO_CONJUGATE, \
125 n_behind, \
126 f, \
127 minus_one, \
128 A12, cs_at, rs_at, \
129 x2, incx, \
130 one, \
131 x1, incx, \
132 cntx \
133 ); \
134 \
135 /* x1 = x1 / triu( A11 ); */ \
136 for ( k = 0; k < f; ++k ) \
137 { \
138 l = f - k - 1; \
139 f_behind = k; \
140 alpha11 = A11 + (l )*rs_at + (l )*cs_at; \
141 a12t = A11 + (l )*rs_at + (l+1)*cs_at; \
142 chi11 = x1 + (l )*incx; \
143 x21 = x1 + (l+1)*incx; \
144 \
145 /* chi11 = chi11 - a12t * x21; */ \
146 bli_tset0s( ch, rho1 ); \
147 if ( bli_is_conj( conja ) ) \
148 { \
149 for ( j = 0; j < f_behind; ++j ) \
150 bli_tdotjs( ch,ch,ch,ch, *(a12t + j*cs_at), *(x21 + j*incx), rho1 ); \
151 } \
152 else \
153 { \
154 for ( j = 0; j < f_behind; ++j ) \
155 bli_tdots( ch,ch,ch,ch, *(a12t + j*cs_at), *(x21 + j*incx), rho1 ); \
156 } \
157 bli_tsubs( ch,ch,ch, rho1, *chi11 ); \
158 \
159 /* chi11 = chi11 / alpha11; */ \
160 if ( bli_is_nonunit_diag( diaga ) ) \
161 { \
162 bli_tcopycjs( ch,ch, conja, *alpha11, alpha11_conj ); \
163 bli_tinvscals( ch,ch,ch, alpha11_conj, *chi11 ); \
164 } \
165 } \
166 } \
167 } \
168 else /* if ( bli_is_lower( uploa_trans ) ) */ \
169 { \
170 for ( iter = 0; iter < m; iter += f ) \
171 { \
172 f = bli_determine_blocksize_dim_f( iter, m, b_fuse ); \
173 i = iter; \
174 n_behind = i; \
175 A11 = a + (i )*rs_at + (i )*cs_at; \
176 A10 = a + (i )*rs_at + (0 )*cs_at; \
177 x1 = x + (i )*incx; \
178 x0 = x + (0 )*incx; \
179 \
180 /* x1 = x1 - A10 * x0; */ \
181 kfp_df \
182 ( \
183 conja, \
184 BLIS_NO_CONJUGATE, \
185 n_behind, \
186 f, \
187 minus_one, \
188 A10, cs_at, rs_at, \
189 x0, incx, \
190 one, \
191 x1, incx, \
192 cntx \
193 ); \
194 \
195 /* x1 = x1 / tril( A11 ); */ \
196 for ( k = 0; k < f; ++k ) \
197 { \
198 l = k; \
199 f_behind = l; \
200 alpha11 = A11 + (l )*rs_at + (l )*cs_at; \
201 a10t = A11 + (l )*rs_at + (0 )*cs_at; \
202 chi11 = x1 + (l )*incx; \
203 x01 = x1 + (0 )*incx; \
204 \
205 /* chi11 = chi11 - a10t * x01; */ \
206 bli_tset0s( ch, rho1 ); \
207 if ( bli_is_conj( conja ) ) \
208 { \
209 for ( j = 0; j < f_behind; ++j ) \
210 bli_tdotjs( ch,ch,ch,ch, *(a10t + j*cs_at), *(x01 + j*incx), rho1 ); \
211 } \
212 else \
213 { \
214 for ( j = 0; j < f_behind; ++j ) \
215 bli_tdots( ch,ch,ch,ch, *(a10t + j*cs_at), *(x01 + j*incx), rho1 ); \
216 } \
217 bli_tsubs( ch,ch,ch, rho1, *chi11 ); \
218 \
219 /* chi11 = chi11 / alpha11; */ \
220 if ( bli_is_nonunit_diag( diaga ) ) \
221 { \
222 bli_tcopycjs( ch,ch, conja, *alpha11, alpha11_conj ); \
223 bli_tinvscals( ch,ch,ch, alpha11_conj, *chi11 ); \
224 } \
225 } \
226 } \
227 } \
228 }
229
230 INSERT_GENTFUNC_BASIC( trsv_unf_var1 )
231