libflame  revision_anchor
Functions
bl1_her2.c File Reference

(r)

Functions

void bl1_sher2 (uplo1_t uplo, conj1_t conj, int m, float *alpha, float *x, int incx, float *y, int incy, float *a, int a_rs, int a_cs)
 
void bl1_dher2 (uplo1_t uplo, conj1_t conj, int m, double *alpha, double *x, int incx, double *y, int incy, double *a, int a_rs, int a_cs)
 
void bl1_cher2 (uplo1_t uplo, conj1_t conj, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int a_rs, int a_cs)
 
void bl1_zher2 (uplo1_t uplo, conj1_t conj, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int a_rs, int a_cs)
 
void bl1_cher2_blas (uplo1_t uplo, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int lda)
 
void bl1_zher2_blas (uplo1_t uplo, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int lda)
 

Function Documentation

◆ bl1_cher2()

void bl1_cher2 ( uplo1_t  uplo,
conj1_t  conj,
int  m,
scomplex alpha,
scomplex x,
int  incx,
scomplex y,
int  incy,
scomplex a,
int  a_rs,
int  a_cs 
)

References bl1_callocv(), bl1_ccopyv(), bl1_ccreate_contigmr(), bl1_cfree(), bl1_cfree_saved_contigm(), bl1_cher2_blas(), bl1_is_conj(), bl1_is_row_storage(), bl1_zero_dim1(), and BLIS1_CONJUGATE.

Referenced by FLA_Eig_gest_il_opc_var4(), FLA_Eig_gest_il_opc_var5(), FLA_Eig_gest_iu_opc_var4(), FLA_Eig_gest_iu_opc_var5(), FLA_Eig_gest_nl_opc_var4(), FLA_Eig_gest_nl_opc_var5(), FLA_Eig_gest_nu_opc_var4(), FLA_Eig_gest_nu_opc_var5(), FLA_Her2_external(), FLA_Her2c_external(), FLA_Lyap_h_opc_var4(), FLA_Lyap_n_opc_var4(), FLA_Tridiag_UT_l_step_ofc_var2(), FLA_Tridiag_UT_l_step_opc_var1(), and FLA_Tridiag_UT_l_step_opc_var2().

34 {
35  int m_save = m;
36  scomplex* a_save = a;
37  int a_rs_save = a_rs;
38  int a_cs_save = a_cs;
39  scomplex* x_conj;
40  scomplex* y_conj;
41  int incx_conj;
42  int incy_conj;
43  int lda, inca;
44 
45  // Return early if possible.
46  if ( bl1_zero_dim1( m ) ) return;
47 
48  // If necessary, allocate, initialize, and use a temporary contiguous
49  // copy of the matrix rather than the original matrix.
51  m,
52  m,
53  a_save, a_rs_save, a_cs_save,
54  &a, &a_rs, &a_cs );
55 
56  // Initialize with values assuming column-major storage.
57  lda = a_cs;
58  inca = a_rs;
59 
60  // If A is a row-major matrix, then we can use the underlying column-major
61  // BLAS implementation by fiddling with the parameters.
62  if ( bl1_is_row_storage( a_rs, a_cs ) )
63  {
64  bl1_swap_ints( lda, inca );
65  bl1_toggle_uplo( uplo );
66  bl1_toggle_conj( conj );
67  }
68 
69  // Initialize with values assuming no conjugation of ( x * y' ) or
70  // ( y * x' ).
71  x_conj = x;
72  incx_conj = incx;
73  y_conj = y;
74  incy_conj = incy;
75 
76  // We want to handle the case where ( x * y' ) and ( y * x' ) are
77  // conjugated, but without explicitly conjugating the matrices. To do
78  // so, we leverage the fact that computing the products conj( x * y' )
79  // and conj( y * x' ) is equivalent to computing ( conj(x) * conj(y)' )
80  // and ( conj(y) * conj(x)' ), respectively.
81  if ( bl1_is_conj( conj ) )
82  {
83  x_conj = bl1_callocv( m );
84  incx_conj = 1;
85 
86  y_conj = bl1_callocv( m );
87  incy_conj = 1;
88 
90  m,
91  x, incx,
92  x_conj, incx_conj );
93 
95  m,
96  y, incy,
97  y_conj, incy_conj );
98  }
99 
100  bl1_cher2_blas( uplo,
101  m,
102  alpha,
103  x_conj, incx_conj,
104  y_conj, incy_conj,
105  a, lda );
106 
107  // Free the temporary conjugated x and y vectors.
108  if ( bl1_is_conj( conj ) )
109  {
110  bl1_cfree( x_conj );
111  bl1_cfree( y_conj );
112  }
113 
114  // Free the temporary contiguous matrix.
115  bl1_cfree_saved_contigm( m_save,
116  m_save,
117  a_save, a_rs_save, a_cs_save,
118  &a, &a_rs, &a_cs );
119 }
int bl1_is_conj(conj1_t conj)
Definition: bl1_is.c:42
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
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
Definition: blis_type_defs.h:82
int bl1_zero_dim1(int m)
Definition: bl1_is.c:113
int bl1_is_row_storage(int rs, int cs)
Definition: bl1_is.c:95
Definition: blis_type_defs.h:132
void bl1_cfree(scomplex *p)
Definition: bl1_free.c:40
scomplex * bl1_callocv(unsigned int n_elem)
Definition: bl1_allocv.c:40
void bl1_cher2_blas(uplo1_t uplo, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int lda)
Definition: bl1_her2.c:211
void bl1_ccopyv(conj1_t conj, int m, scomplex *x, int incx, scomplex *y, int incy)
Definition: bl1_copyv.c:49

◆ bl1_cher2_blas()

void bl1_cher2_blas ( uplo1_t  uplo,
int  m,
scomplex alpha,
scomplex x,
int  incx,
scomplex y,
int  incy,
scomplex a,
int  lda 
)

References bl1_param_map_to_netlib_uplo(), cblas_cher2(), CblasColMajor, and F77_cher2().

Referenced by bl1_cher2().

212 {
213 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
214  enum CBLAS_ORDER cblas_order = CblasColMajor;
215  enum CBLAS_UPLO cblas_uplo;
216 
217  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
218 
219  cblas_cher2( cblas_order,
220  cblas_uplo,
221  m,
222  alpha,
223  x, incx,
224  y, incy,
225  a, lda );
226 #else
227  char blas_uplo;
228 
229  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
230 
231  F77_cher2( &blas_uplo,
232  &m,
233  alpha,
234  x, &incx,
235  y, &incy,
236  a, &lda );
237 #endif
238 }
CBLAS_ORDER
Definition: blis_prototypes_cblas.h:17
CBLAS_UPLO
Definition: blis_prototypes_cblas.h:19
Definition: blis_prototypes_cblas.h:17
void cblas_cher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const void *alpha, const void *X, const int incX, const void *Y, const int incY, void *A, const int lda)
void bl1_param_map_to_netlib_uplo(uplo1_t blis_uplo, void *blas_uplo)
Definition: bl1_param_map.c:47
void F77_cher2(char *uplo, int *n, scomplex *alpha, scomplex *x, int *incx, scomplex *y, int *incy, scomplex *a, int *lda)

◆ bl1_dher2()

void bl1_dher2 ( uplo1_t  uplo,
conj1_t  conj,
int  m,
double *  alpha,
double *  x,
int  incx,
double *  y,
int  incy,
double *  a,
int  a_rs,
int  a_cs 
)

References bl1_dsyr2().

Referenced by FLA_Eig_gest_il_opd_var4(), FLA_Eig_gest_il_opd_var5(), FLA_Eig_gest_iu_opd_var4(), FLA_Eig_gest_iu_opd_var5(), FLA_Eig_gest_nl_opd_var4(), FLA_Eig_gest_nl_opd_var5(), FLA_Eig_gest_nu_opd_var4(), FLA_Eig_gest_nu_opd_var5(), FLA_Lyap_h_opd_var4(), and FLA_Lyap_n_opd_var4().

24 {
25  bl1_dsyr2( uplo,
26  m,
27  alpha,
28  x, incx,
29  y, incy,
30  a, a_rs, a_cs );
31 }
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)
Definition: bl1_syr2.c:58

◆ bl1_sher2()

void bl1_sher2 ( uplo1_t  uplo,
conj1_t  conj,
int  m,
float *  alpha,
float *  x,
int  incx,
float *  y,
int  incy,
float *  a,
int  a_rs,
int  a_cs 
)

References bl1_ssyr2().

Referenced by FLA_Eig_gest_il_ops_var4(), FLA_Eig_gest_il_ops_var5(), FLA_Eig_gest_iu_ops_var4(), FLA_Eig_gest_iu_ops_var5(), FLA_Eig_gest_nl_ops_var4(), FLA_Eig_gest_nl_ops_var5(), FLA_Eig_gest_nu_ops_var4(), FLA_Eig_gest_nu_ops_var5(), FLA_Lyap_h_ops_var4(), and FLA_Lyap_n_ops_var4().

14 {
15  bl1_ssyr2( uplo,
16  m,
17  alpha,
18  x, incx,
19  y, incy,
20  a, a_rs, a_cs );
21 }
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)
Definition: bl1_syr2.c:13

◆ bl1_zher2()

void bl1_zher2 ( uplo1_t  uplo,
conj1_t  conj,
int  m,
dcomplex alpha,
dcomplex x,
int  incx,
dcomplex y,
int  incy,
dcomplex a,
int  a_rs,
int  a_cs 
)

References bl1_is_conj(), bl1_is_row_storage(), bl1_zallocv(), bl1_zcopyv(), bl1_zcreate_contigmr(), bl1_zero_dim1(), bl1_zfree(), bl1_zfree_saved_contigm(), bl1_zher2_blas(), and BLIS1_CONJUGATE.

Referenced by FLA_Eig_gest_il_opz_var4(), FLA_Eig_gest_il_opz_var5(), FLA_Eig_gest_iu_opz_var4(), FLA_Eig_gest_iu_opz_var5(), FLA_Eig_gest_nl_opz_var4(), FLA_Eig_gest_nl_opz_var5(), FLA_Eig_gest_nu_opz_var4(), FLA_Eig_gest_nu_opz_var5(), FLA_Her2_external(), FLA_Her2c_external(), FLA_Lyap_h_opz_var4(), FLA_Lyap_n_opz_var4(), FLA_Tridiag_UT_l_step_ofz_var2(), FLA_Tridiag_UT_l_step_opz_var1(), and FLA_Tridiag_UT_l_step_opz_var2().

122 {
123  int m_save = m;
124  dcomplex* a_save = a;
125  int a_rs_save = a_rs;
126  int a_cs_save = a_cs;
127  dcomplex* x_conj;
128  dcomplex* y_conj;
129  int incx_conj;
130  int incy_conj;
131  int lda, inca;
132 
133  // Return early if possible.
134  if ( bl1_zero_dim1( m ) ) return;
135 
136  // If necessary, allocate, initialize, and use a temporary contiguous
137  // copy of the matrix rather than the original matrix.
138  bl1_zcreate_contigmr( uplo,
139  m,
140  m,
141  a_save, a_rs_save, a_cs_save,
142  &a, &a_rs, &a_cs );
143 
144  // Initialize with values assuming column-major storage.
145  lda = a_cs;
146  inca = a_rs;
147 
148  // If A is a row-major matrix, then we can use the underlying column-major
149  // BLAS implementation by fiddling with the parameters.
150  if ( bl1_is_row_storage( a_rs, a_cs ) )
151  {
152  bl1_swap_ints( lda, inca );
153  bl1_toggle_uplo( uplo );
154  bl1_toggle_conj( conj );
155  }
156 
157  // Initialize with values assuming no conjugation of ( x * y' ) or
158  // ( y * x' ).
159  x_conj = x;
160  incx_conj = incx;
161  y_conj = y;
162  incy_conj = incy;
163 
164  // We want to handle the case where ( x * y' ) and ( y * x' ) are
165  // conjugated, but without explicitly conjugating the matrices. To do
166  // so, we leverage the fact that computing the products conj( x * y' )
167  // and conj( y * x' ) is equivalent to computing ( conj(x) * conj(y)' )
168  // and ( conj(y) * conj(x)' ), respectively.
169  if ( bl1_is_conj( conj ) )
170  {
171  x_conj = bl1_zallocv( m );
172  incx_conj = 1;
173 
174  y_conj = bl1_zallocv( m );
175  incy_conj = 1;
176 
178  m,
179  x, incx,
180  x_conj, incx_conj );
181 
183  m,
184  y, incy,
185  y_conj, incy_conj );
186  }
187 
188  bl1_zher2_blas( uplo,
189  m,
190  alpha,
191  x_conj, incx_conj,
192  y_conj, incy_conj,
193  a, lda );
194 
195  // Free the temporary conjugated x and y vectors.
196  if ( bl1_is_conj( conj ) )
197  {
198  bl1_zfree( x_conj );
199  bl1_zfree( y_conj );
200  }
201 
202  // Free the temporary contiguous matrix.
203  bl1_zfree_saved_contigm( m_save,
204  m_save,
205  a_save, a_rs_save, a_cs_save,
206  &a, &a_rs, &a_cs );
207 }
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
int bl1_is_conj(conj1_t conj)
Definition: bl1_is.c:42
void bl1_zher2_blas(uplo1_t uplo, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int lda)
Definition: bl1_her2.c:240
void bl1_zfree(dcomplex *p)
Definition: bl1_free.c:45
Definition: blis_type_defs.h:82
int bl1_zero_dim1(int m)
Definition: bl1_is.c:113
int bl1_is_row_storage(int rs, int cs)
Definition: bl1_is.c:95
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
dcomplex * bl1_zallocv(unsigned int n_elem)
Definition: bl1_allocv.c:45
void bl1_zcopyv(conj1_t conj, int m, dcomplex *x, int incx, dcomplex *y, int incy)
Definition: bl1_copyv.c:63
Definition: blis_type_defs.h:137

◆ bl1_zher2_blas()

void bl1_zher2_blas ( uplo1_t  uplo,
int  m,
dcomplex alpha,
dcomplex x,
int  incx,
dcomplex y,
int  incy,
dcomplex a,
int  lda 
)

References bl1_param_map_to_netlib_uplo(), cblas_zher2(), CblasColMajor, and F77_zher2().

Referenced by bl1_zher2().

241 {
242 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
243  enum CBLAS_ORDER cblas_order = CblasColMajor;
244  enum CBLAS_UPLO cblas_uplo;
245 
246  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
247 
248  cblas_zher2( cblas_order,
249  cblas_uplo,
250  m,
251  alpha,
252  x, incx,
253  y, incy,
254  a, lda );
255 #else
256  char blas_uplo;
257 
258  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
259 
260  F77_zher2( &blas_uplo,
261  &m,
262  alpha,
263  x, &incx,
264  y, &incy,
265  a, &lda );
266 #endif
267 }
CBLAS_ORDER
Definition: blis_prototypes_cblas.h:17
void F77_zher2(char *uplo, int *n, dcomplex *alpha, dcomplex *x, int *incx, dcomplex *y, int *incy, dcomplex *a, int *lda)
CBLAS_UPLO
Definition: blis_prototypes_cblas.h:19
Definition: blis_prototypes_cblas.h:17
void bl1_param_map_to_netlib_uplo(uplo1_t blis_uplo, void *blas_uplo)
Definition: bl1_param_map.c:47
void cblas_zher2(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const void *alpha, const void *X, const int incX, const void *Y, const int incY, void *A, const int lda)