libflame revision_anchor
bl1_maxabsmr.c File Reference

(r)

Functions

void bl1_smaxabsmr (uplo1_t uplo, int m, int n, float *a, int a_rs, int a_cs, float *maxabs)
 
void bl1_dmaxabsmr (uplo1_t uplo, int m, int n, double *a, int a_rs, int a_cs, double *maxabs)
 
void bl1_cmaxabsmr (uplo1_t uplo, int m, int n, scomplex *a, int a_rs, int a_cs, float *maxabs)
 
void bl1_zmaxabsmr (uplo1_t uplo, int m, int n, dcomplex *a, int a_rs, int a_cs, double *maxabs)
 

Function Documentation

◆ bl1_cmaxabsmr()

void bl1_cmaxabsmr ( uplo1_t uplo,
int m,
int n,
scomplex * a,
int a_rs,
int a_cs,
float * maxabs )
144{
145 float zero = bl1_d0();
146 scomplex* a_begin;
147 float maxabs_cand;
148 float maxabs_temp;
149 int inca, lda;
150 int n_iter;
151 int n_elem_max;
152 int n_elem;
153 int j;
154
155 // Return early if possible.
156 if ( bl1_zero_dim2( m, n ) ) { *maxabs = zero; return; }
157
158 // Initialize with optimal values for column-major storage.
159 n_iter = n;
160 n_elem_max = m;
161 lda = a_cs;
162 inca = a_rs;
163
164 // An optimization: if A is row-major, then let's access the matrix by
165 // rows instead of by columns for increased spatial locality.
166 if ( bl1_is_row_storage( a_rs, a_cs ) )
167 {
168 bl1_swap_ints( n_iter, n_elem_max );
169 bl1_swap_ints( lda, inca );
170 bl1_toggle_uplo( uplo );
171 }
172
173 // Initialize the maximum absolute value candidate to the first element.
174 bl1_csabsval2( a, &maxabs_cand );
175
176 if ( bl1_is_upper( uplo ) )
177 {
178 for ( j = 0; j < n_iter; j++ )
179 {
180 n_elem = bl1_min( j + 1, n_elem_max );
181 a_begin = a + j*lda;
182
183 bl1_cmaxabsv( n_elem,
184 a_begin, inca,
185 &maxabs_temp );
186
187 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
188 }
189 }
190 else // if ( bl1_is_lower( uplo ) )
191 {
192 for ( j = 0; j < n_iter; j++ )
193 {
194 n_elem = bl1_max( 0, n_elem_max - j );
195 a_begin = a + j*lda + j*inca;
196
197 bl1_cmaxabsv( n_elem,
198 a_begin, inca,
199 &maxabs_temp );
200
201 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
202 }
203 }
204
205 *maxabs = maxabs_cand;
206}
int bl1_is_row_storage(int rs, int cs)
Definition bl1_is.c:95
int bl1_is_upper(uplo1_t uplo)
Definition bl1_is.c:54
int bl1_zero_dim2(int m, int n)
Definition bl1_is.c:118
double bl1_d0(void)
Definition bl1_constants.c:118
void bl1_cmaxabsv(int n, scomplex *x, int incx, float *maxabs)
Definition bl1_maxabsv.c:55
Definition blis_type_defs.h:133

References bl1_cmaxabsv(), bl1_d0(), bl1_is_row_storage(), bl1_is_upper(), and bl1_zero_dim2().

Referenced by FLA_Max_abs_value_herm().

◆ bl1_dmaxabsmr()

void bl1_dmaxabsmr ( uplo1_t uplo,
int m,
int n,
double * a,
int a_rs,
int a_cs,
double * maxabs )
79{
80 double zero = bl1_d0();
81 double* a_begin;
82 double maxabs_cand;
83 double maxabs_temp;
84 int inca, lda;
85 int n_iter;
86 int n_elem_max;
87 int n_elem;
88 int j;
89
90 // Return early if possible.
91 if ( bl1_zero_dim2( m, n ) ) { *maxabs = zero; return; }
92
93 // Initialize with optimal values for column-major storage.
94 n_iter = n;
95 n_elem_max = m;
96 lda = a_cs;
97 inca = a_rs;
98
99 // An optimization: if A is row-major, then let's access the matrix by
100 // rows instead of by columns for increased spatial locality.
101 if ( bl1_is_row_storage( a_rs, a_cs ) )
102 {
103 bl1_swap_ints( n_iter, n_elem_max );
104 bl1_swap_ints( lda, inca );
105 bl1_toggle_uplo( uplo );
106 }
107
108 // Initialize the maximum absolute value candidate to the first element.
109 bl1_dabsval2( a, &maxabs_cand );
110
111 if ( bl1_is_upper( uplo ) )
112 {
113 for ( j = 0; j < n_iter; j++ )
114 {
115 n_elem = bl1_min( j + 1, n_elem_max );
116 a_begin = a + j*lda;
117
118 bl1_dmaxabsv( n_elem,
119 a_begin, inca,
120 &maxabs_temp );
121
122 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
123 }
124 }
125 else // if ( bl1_is_lower( uplo ) )
126 {
127 for ( j = 0; j < n_iter; j++ )
128 {
129 n_elem = bl1_max( 0, n_elem_max - j );
130 a_begin = a + j*lda + j*inca;
131
132 bl1_dmaxabsv( n_elem,
133 a_begin, inca,
134 &maxabs_temp );
135
136 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
137 }
138 }
139
140 *maxabs = maxabs_cand;
141}
void bl1_dmaxabsv(int n, double *x, int incx, double *maxabs)
Definition bl1_maxabsv.c:34

References bl1_d0(), bl1_dmaxabsv(), bl1_is_row_storage(), bl1_is_upper(), and bl1_zero_dim2().

Referenced by FLA_Max_abs_value_herm().

◆ bl1_smaxabsmr()

void bl1_smaxabsmr ( uplo1_t uplo,
int m,
int n,
float * a,
int a_rs,
int a_cs,
float * maxabs )
14{
15 float zero = bl1_s0();
16 float* a_begin;
17 float maxabs_cand;
18 float maxabs_temp;
19 int inca, lda;
20 int n_iter;
21 int n_elem_max;
22 int n_elem;
23 int j;
24
25 // Return early if possible.
26 if ( bl1_zero_dim2( m, n ) ) { *maxabs = zero; return; }
27
28 // Initialize with optimal values for column-major storage.
29 n_iter = n;
30 n_elem_max = m;
31 lda = a_cs;
32 inca = a_rs;
33
34 // An optimization: if A is row-major, then let's access the matrix by
35 // rows instead of by columns for increased spatial locality.
36 if ( bl1_is_row_storage( a_rs, a_cs ) )
37 {
38 bl1_swap_ints( n_iter, n_elem_max );
39 bl1_swap_ints( lda, inca );
40 bl1_toggle_uplo( uplo );
41 }
42
43 // Initialize the maximum absolute value candidate to the first element.
44 bl1_sabsval2( a, &maxabs_cand );
45
46 if ( bl1_is_upper( uplo ) )
47 {
48 for ( j = 0; j < n_iter; j++ )
49 {
50 n_elem = bl1_min( j + 1, n_elem_max );
51 a_begin = a + j*lda;
52
53 bl1_smaxabsv( n_elem,
54 a_begin, inca,
55 &maxabs_temp );
56
57 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
58 }
59 }
60 else // if ( bl1_is_lower( uplo ) )
61 {
62 for ( j = 0; j < n_iter; j++ )
63 {
64 n_elem = bl1_max( 0, n_elem_max - j );
65 a_begin = a + j*lda + j*inca;
66
67 bl1_smaxabsv( n_elem,
68 a_begin, inca,
69 &maxabs_temp );
70
71 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
72 }
73 }
74
75 *maxabs = maxabs_cand;
76}
void bl1_smaxabsv(int n, float *x, int incx, float *maxabs)
Definition bl1_maxabsv.c:13
float bl1_s0(void)
Definition bl1_constants.c:111

References bl1_is_row_storage(), bl1_is_upper(), bl1_s0(), bl1_smaxabsv(), and bl1_zero_dim2().

Referenced by FLA_Max_abs_value_herm().

◆ bl1_zmaxabsmr()

void bl1_zmaxabsmr ( uplo1_t uplo,
int m,
int n,
dcomplex * a,
int a_rs,
int a_cs,
double * maxabs )
209{
210 double zero = bl1_d0();
211 dcomplex* a_begin;
212 double maxabs_cand;
213 double maxabs_temp;
214 int inca, lda;
215 int n_iter;
216 int n_elem_max;
217 int n_elem;
218 int j;
219
220 // Return early if possible.
221 if ( bl1_zero_dim2( m, n ) ) { *maxabs = zero; return; }
222
223 // Initialize with optimal values for column-major storage.
224 n_iter = n;
225 n_elem_max = m;
226 lda = a_cs;
227 inca = a_rs;
228
229 // An optimization: if A is row-major, then let's access the matrix by
230 // rows instead of by columns for increased spatial locality.
231 if ( bl1_is_row_storage( a_rs, a_cs ) )
232 {
233 bl1_swap_ints( n_iter, n_elem_max );
234 bl1_swap_ints( lda, inca );
235 bl1_toggle_uplo( uplo );
236 }
237
238 // Initialize the maximum absolute value candidate to the first element.
239 bl1_zdabsval2( a, &maxabs_cand );
240
241 if ( bl1_is_upper( uplo ) )
242 {
243 for ( j = 0; j < n_iter; j++ )
244 {
245 n_elem = bl1_min( j + 1, n_elem_max );
246 a_begin = a + j*lda;
247
248 bl1_zmaxabsv( n_elem,
249 a_begin, inca,
250 &maxabs_temp );
251
252 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
253 }
254 }
255 else // if ( bl1_is_lower( uplo ) )
256 {
257 for ( j = 0; j < n_iter; j++ )
258 {
259 n_elem = bl1_max( 0, n_elem_max - j );
260 a_begin = a + j*lda + j*inca;
261
262 bl1_zmaxabsv( n_elem,
263 a_begin, inca,
264 &maxabs_temp );
265
266 if ( maxabs_temp > maxabs_cand ) maxabs_cand = maxabs_temp;
267 }
268 }
269
270 *maxabs = maxabs_cand;
271}
void bl1_zmaxabsv(int n, dcomplex *x, int incx, double *maxabs)
Definition bl1_maxabsv.c:76
Definition blis_type_defs.h:138

References bl1_d0(), bl1_is_row_storage(), bl1_is_upper(), bl1_zero_dim2(), and bl1_zmaxabsv().

Referenced by FLA_Max_abs_value_herm().