libflame  revision_anchor
Functions
bl1_syr2.c File Reference

(r)

Functions

void bl1_ssyr2 (uplo1_t uplo, int m, float *alpha, float *x, int incx, float *y, int incy, float *a, int a_rs, int a_cs)
 
void bl1_dsyr2 (uplo1_t uplo, int m, double *alpha, double *x, int incx, double *y, int incy, double *a, int a_rs, int a_cs)
 
void bl1_csyr2 (uplo1_t uplo, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int a_rs, int a_cs)
 
void bl1_zsyr2 (uplo1_t uplo, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int a_rs, int a_cs)
 
void bl1_ssyr2_blas (uplo1_t uplo, int m, float *alpha, float *x, int incx, float *y, int incy, float *a, int lda)
 
void bl1_dsyr2_blas (uplo1_t uplo, int m, double *alpha, double *x, int incx, double *y, int incy, double *a, int lda)
 
void bl1_csyr2_blas (uplo1_t uplo, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int lda)
 
void bl1_zsyr2_blas (uplo1_t uplo, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int lda)
 

Function Documentation

◆ bl1_csyr2()

void bl1_csyr2 ( uplo1_t  uplo,
int  m,
scomplex alpha,
scomplex x,
int  incx,
scomplex y,
int  incy,
scomplex a,
int  a_rs,
int  a_cs 
)
104 {
105  int m_save = m;
106  scomplex* a_save = a;
107  int a_rs_save = a_rs;
108  int a_cs_save = a_cs;
109  int lda, inca;
110 
111  // Return early if possible.
112  if ( bl1_zero_dim1( m ) ) return;
113 
114  // If necessary, allocate, initialize, and use a temporary contiguous
115  // copy of the matrix rather than the original matrix.
116  bl1_ccreate_contigmr( uplo,
117  m,
118  m,
119  a_save, a_rs_save, a_cs_save,
120  &a, &a_rs, &a_cs );
121 
122  // Initialize with values assuming column-major storage.
123  lda = a_cs;
124  inca = a_rs;
125 
126  // If A is a row-major matrix, then we can use the underlying column-major
127  // BLAS implementation by fiddling with the parameters.
128  if ( bl1_is_row_storage( a_rs, a_cs ) )
129  {
130  bl1_swap_ints( lda, inca );
131  bl1_toggle_uplo( uplo );
132  }
133 
134  bl1_csyr2_blas( uplo,
135  m,
136  alpha,
137  x, incx,
138  y, incy,
139  a, lda );
140 
141  // Free the temporary contiguous matrix.
142  bl1_cfree_saved_contigm( m_save,
143  m_save,
144  a_save, a_rs_save, a_cs_save,
145  &a, &a_rs, &a_cs );
146 }
void bl1_csyr2_blas(uplo1_t uplo, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int lda)
Definition: bl1_syr2.c:253
int bl1_is_row_storage(int rs, int cs)
Definition: bl1_is.c:95
int bl1_zero_dim1(int m)
Definition: bl1_is.c:113
void bl1_ccreate_contigmr(uplo1_t uplo, int m, int n, scomplex *a_save, int a_rs_save, int a_cs_save, scomplex **a, int *a_rs, int *a_cs)
Definition: bl1_create_contigmr.c:77
void bl1_cfree_saved_contigm(int m, int n, scomplex *a_save, int a_rs_save, int a_cs_save, scomplex **a, int *a_rs, int *a_cs)
Definition: bl1_free_saved_contigm.c:59
Definition: blis_type_defs.h:133

References bl1_ccreate_contigmr(), bl1_cfree_saved_contigm(), bl1_csyr2_blas(), bl1_is_row_storage(), and bl1_zero_dim1().

Referenced by FLA_Syr2_external().

◆ bl1_csyr2_blas()

void bl1_csyr2_blas ( uplo1_t  uplo,
int  m,
scomplex alpha,
scomplex x,
int  incx,
scomplex y,
int  incy,
scomplex a,
int  lda 
)
254 {
255  scomplex* x_copy;
256  scomplex* y_copy;
257  scomplex beta;
258  int k = 1;
259  int ldx = m;
260  int ldy = m;
261 
262 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
263  enum CBLAS_ORDER cblas_order = CblasColMajor;
264  enum CBLAS_UPLO cblas_uplo;
265  enum CBLAS_TRANSPOSE cblas_trans;
266 
267  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
269 
270  x_copy = bl1_callocv( m );
271  y_copy = bl1_callocv( m );
272 
274  m,
275  x, incx,
276  x_copy, 1 );
277 
279  m,
280  y, incy,
281  y_copy, 1 );
282 
283  beta.real = 1.0;
284  beta.imag = 0.0;
285 
286  cblas_csyr2k( cblas_order,
287  cblas_uplo,
288  cblas_trans,
289  m,
290  k,
291  alpha,
292  x_copy, ldx,
293  y_copy, ldy,
294  &beta,
295  a, lda );
296 
297  bl1_cfree( x_copy );
298  bl1_cfree( y_copy );
299 #else
300  char blas_uplo;
301  char blas_trans;
302 
303  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
305 
306  x_copy = bl1_callocv( m );
307  y_copy = bl1_callocv( m );
308 
310  m,
311  x, incx,
312  x_copy, 1 );
313 
315  m,
316  y, incy,
317  y_copy, 1 );
318 
319  beta.real = 1.0;
320  beta.imag = 0.0;
321 
322  F77_csyr2k ( &blas_uplo,
323  &blas_trans,
324  &m,
325  &k,
326  alpha,
327  x_copy, &ldx,
328  y_copy, &ldy,
329  &beta,
330  a, &lda );
331 
332  bl1_cfree( x_copy );
333  bl1_cfree( y_copy );
334 #endif
335 }
void bl1_ccopyv(conj1_t conj, int m, scomplex *x, int incx, scomplex *y, int incy)
Definition: bl1_copyv.c:49
void F77_csyr2k(char *uplo, char *transa, int *n, int *k, scomplex *alpha, scomplex *a, int *lda, scomplex *b, int *ldb, scomplex *beta, scomplex *c, int *ldc)
CBLAS_ORDER
Definition: blis_prototypes_cblas.h:17
@ CblasColMajor
Definition: blis_prototypes_cblas.h:17
CBLAS_UPLO
Definition: blis_prototypes_cblas.h:19
CBLAS_TRANSPOSE
Definition: blis_prototypes_cblas.h:18
void cblas_csyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc)
void bl1_param_map_to_netlib_trans(trans1_t blis_trans, void *blas_trans)
Definition: bl1_param_map.c:15
void bl1_param_map_to_netlib_uplo(uplo1_t blis_uplo, void *blas_uplo)
Definition: bl1_param_map.c:47
void bl1_cfree(scomplex *p)
Definition: bl1_free.c:40
scomplex * bl1_callocv(unsigned int n_elem)
Definition: bl1_allocv.c:40
@ BLIS1_NO_TRANSPOSE
Definition: blis_type_defs.h:54
@ BLIS1_NO_CONJUGATE
Definition: blis_type_defs.h:81
float imag
Definition: blis_type_defs.h:134
float real
Definition: blis_type_defs.h:134

References bl1_callocv(), bl1_ccopyv(), bl1_cfree(), bl1_param_map_to_netlib_trans(), bl1_param_map_to_netlib_uplo(), BLIS1_NO_CONJUGATE, BLIS1_NO_TRANSPOSE, cblas_csyr2k(), CblasColMajor, F77_csyr2k(), scomplex::imag, and scomplex::real.

Referenced by bl1_csyr2().

◆ bl1_dsyr2()

void bl1_dsyr2 ( uplo1_t  uplo,
int  m,
double *  alpha,
double *  x,
int  incx,
double *  y,
int  incy,
double *  a,
int  a_rs,
int  a_cs 
)
59 {
60  int m_save = m;
61  double* a_save = a;
62  int a_rs_save = a_rs;
63  int a_cs_save = a_cs;
64  int lda, inca;
65 
66  // Return early if possible.
67  if ( bl1_zero_dim1( m ) ) return;
68 
69  // If necessary, allocate, initialize, and use a temporary contiguous
70  // copy of the matrix rather than the original matrix.
72  m,
73  m,
74  a_save, a_rs_save, a_cs_save,
75  &a, &a_rs, &a_cs );
76 
77  // Initialize with values assuming column-major storage.
78  lda = a_cs;
79  inca = a_rs;
80 
81  // If A is a row-major matrix, then we can use the underlying column-major
82  // BLAS implementation by fiddling with the parameters.
83  if ( bl1_is_row_storage( a_rs, a_cs ) )
84  {
85  bl1_swap_ints( lda, inca );
86  bl1_toggle_uplo( uplo );
87  }
88 
89  bl1_dsyr2_blas( uplo,
90  m,
91  alpha,
92  x, incx,
93  y, incy,
94  a, lda );
95 
96  // Free the temporary contiguous matrix.
98  m_save,
99  a_save, a_rs_save, a_cs_save,
100  &a, &a_rs, &a_cs );
101 }
void bl1_dsyr2_blas(uplo1_t uplo, int m, double *alpha, double *x, int incx, double *y, int incy, double *a, int lda)
Definition: bl1_syr2.c:224
void bl1_dcreate_contigmr(uplo1_t uplo, int m, int n, double *a_save, int a_rs_save, int a_cs_save, double **a, int *a_rs, int *a_cs)
Definition: bl1_create_contigmr.c:45
void bl1_dfree_saved_contigm(int m, int n, double *a_save, int a_rs_save, int a_cs_save, double **a, int *a_rs, int *a_cs)
Definition: bl1_free_saved_contigm.c:36

References bl1_dcreate_contigmr(), bl1_dfree_saved_contigm(), bl1_dsyr2_blas(), bl1_is_row_storage(), and bl1_zero_dim1().

Referenced by bl1_dher2(), FLA_Her2_external(), FLA_Her2c_external(), FLA_Syr2_external(), FLA_Tridiag_UT_l_step_ofd_var2(), FLA_Tridiag_UT_l_step_opd_var1(), and FLA_Tridiag_UT_l_step_opd_var2().

◆ bl1_dsyr2_blas()

void bl1_dsyr2_blas ( uplo1_t  uplo,
int  m,
double *  alpha,
double *  x,
int  incx,
double *  y,
int  incy,
double *  a,
int  lda 
)
225 {
226 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
227  enum CBLAS_ORDER cblas_order = CblasColMajor;
228  enum CBLAS_UPLO cblas_uplo;
229 
230  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
231 
232  cblas_dsyr2( cblas_order,
233  cblas_uplo,
234  m,
235  *alpha,
236  x, incx,
237  y, incy,
238  a, lda );
239 #else
240  char blas_uplo;
241 
242  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
243 
244  F77_dsyr2( &blas_uplo,
245  &m,
246  alpha,
247  x, &incx,
248  y, &incy,
249  a, &lda );
250 #endif
251 }
void F77_dsyr2(char *uplo, int *n, double *alpha, double *x, int *incx, double *y, int *incy, double *a, int *lda)
void cblas_dsyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const double *X, const int incX, const double *Y, const int incY, double *A, const int lda)

References bl1_param_map_to_netlib_uplo(), cblas_dsyr2(), CblasColMajor, and F77_dsyr2().

Referenced by bl1_dsyr2().

◆ bl1_ssyr2()

void bl1_ssyr2 ( uplo1_t  uplo,
int  m,
float *  alpha,
float *  x,
int  incx,
float *  y,
int  incy,
float *  a,
int  a_rs,
int  a_cs 
)
14 {
15  int m_save = m;
16  float* a_save = a;
17  int a_rs_save = a_rs;
18  int a_cs_save = a_cs;
19  int lda, inca;
20 
21  // Return early if possible.
22  if ( bl1_zero_dim1( m ) ) return;
23 
24  // If necessary, allocate, initialize, and use a temporary contiguous
25  // copy of the matrix rather than the original matrix.
27  m,
28  m,
29  a_save, a_rs_save, a_cs_save,
30  &a, &a_rs, &a_cs );
31 
32  // Initialize with values assuming column-major storage.
33  lda = a_cs;
34  inca = a_rs;
35 
36  // If A is a row-major matrix, then we can use the underlying column-major
37  // BLAS implementation by fiddling with the parameters.
38  if ( bl1_is_row_storage( a_rs, a_cs ) )
39  {
40  bl1_swap_ints( lda, inca );
41  bl1_toggle_uplo( uplo );
42  }
43 
44  bl1_ssyr2_blas( uplo,
45  m,
46  alpha,
47  x, incx,
48  y, incy,
49  a, lda );
50 
51  // Free the temporary contiguous matrix.
53  m_save,
54  a_save, a_rs_save, a_cs_save,
55  &a, &a_rs, &a_cs );
56 }
void bl1_ssyr2_blas(uplo1_t uplo, int m, float *alpha, float *x, int incx, float *y, int incy, float *a, int lda)
Definition: bl1_syr2.c:195
void bl1_sfree_saved_contigm(int m, int n, float *a_save, int a_rs_save, int a_cs_save, float **a, int *a_rs, int *a_cs)
Definition: bl1_free_saved_contigm.c:13
void bl1_screate_contigmr(uplo1_t uplo, int m, int n, float *a_save, int a_rs_save, int a_cs_save, float **a, int *a_rs, int *a_cs)
Definition: bl1_create_contigmr.c:13

References bl1_is_row_storage(), bl1_screate_contigmr(), bl1_sfree_saved_contigm(), bl1_ssyr2_blas(), and bl1_zero_dim1().

Referenced by bl1_sher2(), FLA_Her2_external(), FLA_Her2c_external(), FLA_Syr2_external(), FLA_Tridiag_UT_l_step_ofs_var2(), FLA_Tridiag_UT_l_step_ops_var1(), and FLA_Tridiag_UT_l_step_ops_var2().

◆ bl1_ssyr2_blas()

void bl1_ssyr2_blas ( uplo1_t  uplo,
int  m,
float *  alpha,
float *  x,
int  incx,
float *  y,
int  incy,
float *  a,
int  lda 
)
196 {
197 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
198  enum CBLAS_ORDER cblas_order = CblasColMajor;
199  enum CBLAS_UPLO cblas_uplo;
200 
201  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
202 
203  cblas_ssyr2( cblas_order,
204  cblas_uplo,
205  m,
206  *alpha,
207  x, incx,
208  y, incy,
209  a, lda );
210 #else
211  char blas_uplo;
212 
213  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
214 
215  F77_ssyr2( &blas_uplo,
216  &m,
217  alpha,
218  x, &incx,
219  y, &incy,
220  a, &lda );
221 #endif
222 }
void F77_ssyr2(char *uplo, int *n, float *alpha, float *x, int *incx, float *y, int *incy, float *a, int *lda)
void cblas_ssyr2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const float alpha, const float *X, const int incX, const float *Y, const int incY, float *A, const int lda)

References bl1_param_map_to_netlib_uplo(), cblas_ssyr2(), CblasColMajor, and F77_ssyr2().

Referenced by bl1_ssyr2().

◆ bl1_zsyr2()

void bl1_zsyr2 ( uplo1_t  uplo,
int  m,
dcomplex alpha,
dcomplex x,
int  incx,
dcomplex y,
int  incy,
dcomplex a,
int  a_rs,
int  a_cs 
)
149 {
150  int m_save = m;
151  dcomplex* a_save = a;
152  int a_rs_save = a_rs;
153  int a_cs_save = a_cs;
154  int lda, inca;
155 
156  // Return early if possible.
157  if ( bl1_zero_dim1( m ) ) return;
158 
159  // If necessary, allocate, initialize, and use a temporary contiguous
160  // copy of the matrix rather than the original matrix.
161  bl1_zcreate_contigmr( uplo,
162  m,
163  m,
164  a_save, a_rs_save, a_cs_save,
165  &a, &a_rs, &a_cs );
166 
167  // Initialize with values assuming column-major storage.
168  lda = a_cs;
169  inca = a_rs;
170 
171  // If A is a row-major matrix, then we can use the underlying column-major
172  // BLAS implementation by fiddling with the parameters.
173  if ( bl1_is_row_storage( a_rs, a_cs ) )
174  {
175  bl1_swap_ints( lda, inca );
176  bl1_toggle_uplo( uplo );
177  }
178 
179  bl1_zsyr2_blas( uplo,
180  m,
181  alpha,
182  x, incx,
183  y, incy,
184  a, lda );
185 
186  // Free the temporary contiguous matrix.
187  bl1_zfree_saved_contigm( m_save,
188  m_save,
189  a_save, a_rs_save, a_cs_save,
190  &a, &a_rs, &a_cs );
191 }
void bl1_zsyr2_blas(uplo1_t uplo, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int lda)
Definition: bl1_syr2.c:337
void bl1_zcreate_contigmr(uplo1_t uplo, int m, int n, dcomplex *a_save, int a_rs_save, int a_cs_save, dcomplex **a, int *a_rs, int *a_cs)
Definition: bl1_create_contigmr.c:109
void bl1_zfree_saved_contigm(int m, int n, dcomplex *a_save, int a_rs_save, int a_cs_save, dcomplex **a, int *a_rs, int *a_cs)
Definition: bl1_free_saved_contigm.c:82
Definition: blis_type_defs.h:138

References bl1_is_row_storage(), bl1_zcreate_contigmr(), bl1_zero_dim1(), bl1_zfree_saved_contigm(), and bl1_zsyr2_blas().

Referenced by FLA_Syr2_external().

◆ bl1_zsyr2_blas()

void bl1_zsyr2_blas ( uplo1_t  uplo,
int  m,
dcomplex alpha,
dcomplex x,
int  incx,
dcomplex y,
int  incy,
dcomplex a,
int  lda 
)
338 {
339  dcomplex* x_copy;
340  dcomplex* y_copy;
341  dcomplex beta;
342  int k = 1;
343  int ldx = m;
344  int ldy = m;
345 
346 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
347  enum CBLAS_ORDER cblas_order = CblasColMajor;
348  enum CBLAS_UPLO cblas_uplo;
349  enum CBLAS_TRANSPOSE cblas_trans;
350 
351  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
353 
354  x_copy = bl1_zallocv( m );
355  y_copy = bl1_zallocv( m );
356 
358  m,
359  x, incx,
360  x_copy, 1 );
361 
363  m,
364  y, incy,
365  y_copy, 1 );
366 
367  beta.real = 1.0;
368  beta.imag = 0.0;
369 
370  cblas_zsyr2k( cblas_order,
371  cblas_uplo,
372  cblas_trans,
373  m,
374  k,
375  alpha,
376  x_copy, ldx,
377  y_copy, ldy,
378  &beta,
379  a, lda );
380 
381  bl1_zfree( x_copy );
382  bl1_zfree( y_copy );
383 #else
384  char blas_uplo;
385  char blas_trans;
386 
387  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
389 
390  x_copy = bl1_zallocv( m );
391  y_copy = bl1_zallocv( m );
392 
394  m,
395  x, incx,
396  x_copy, 1 );
397 
399  m,
400  y, incy,
401  y_copy, 1 );
402 
403  beta.real = 1.0;
404  beta.imag = 0.0;
405 
406  F77_zsyr2k ( &blas_uplo,
407  &blas_trans,
408  &m,
409  &k,
410  alpha,
411  x_copy, &ldx,
412  y_copy, &ldy,
413  &beta,
414  a, &lda );
415 
416  bl1_zfree( x_copy );
417  bl1_zfree( y_copy );
418 #endif
419 }
void bl1_zcopyv(conj1_t conj, int m, dcomplex *x, int incx, dcomplex *y, int incy)
Definition: bl1_copyv.c:63
void F77_zsyr2k(char *uplo, char *transa, int *n, int *k, dcomplex *alpha, dcomplex *a, int *lda, dcomplex *b, int *ldb, dcomplex *beta, dcomplex *c, int *ldc)
void cblas_zsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc)
dcomplex * bl1_zallocv(unsigned int n_elem)
Definition: bl1_allocv.c:45
void bl1_zfree(dcomplex *p)
Definition: bl1_free.c:45
double real
Definition: blis_type_defs.h:139
double imag
Definition: blis_type_defs.h:139

References bl1_param_map_to_netlib_trans(), bl1_param_map_to_netlib_uplo(), bl1_zallocv(), bl1_zcopyv(), bl1_zfree(), BLIS1_NO_CONJUGATE, BLIS1_NO_TRANSPOSE, cblas_zsyr2k(), CblasColMajor, F77_zsyr2k(), dcomplex::imag, and dcomplex::real.

Referenced by bl1_zsyr2().