libflame  revision_anchor
Functions
bl1_hemv.c File Reference

(r)

Functions

void bl1_shemv (uplo1_t uplo, conj1_t conj, int m, float *alpha, float *a, int a_rs, int a_cs, float *x, int incx, float *beta, float *y, int incy)
 
void bl1_dhemv (uplo1_t uplo, conj1_t conj, int m, double *alpha, double *a, int a_rs, int a_cs, double *x, int incx, double *beta, double *y, int incy)
 
void bl1_chemv (uplo1_t uplo, conj1_t conj, int m, scomplex *alpha, scomplex *a, int a_rs, int a_cs, scomplex *x, int incx, scomplex *beta, scomplex *y, int incy)
 
void bl1_zhemv (uplo1_t uplo, conj1_t conj, int m, dcomplex *alpha, dcomplex *a, int a_rs, int a_cs, dcomplex *x, int incx, dcomplex *beta, dcomplex *y, int incy)
 
void bl1_chemv_blas (uplo1_t uplo, int m, scomplex *alpha, scomplex *a, int lda, scomplex *x, int incx, scomplex *beta, scomplex *y, int incy)
 
void bl1_zhemv_blas (uplo1_t uplo, int m, dcomplex *alpha, dcomplex *a, int lda, dcomplex *x, int incx, dcomplex *beta, dcomplex *y, int incy)
 

Function Documentation

◆ bl1_chemv()

void bl1_chemv ( uplo1_t  uplo,
conj1_t  conj,
int  m,
scomplex alpha,
scomplex a,
int  a_rs,
int  a_cs,
scomplex x,
int  incx,
scomplex beta,
scomplex y,
int  incy 
)
36 {
37  scomplex* a_save = a;
38  int a_rs_save = a_rs;
39  int a_cs_save = a_cs;
40  scomplex zero = bl1_c0();
41  scomplex one = bl1_c1();
42  scomplex* x_conj;
43  scomplex* ax;
44  int lda, inca;
45  int incx_conj;
46  int incax;
47 
48  // Return early if possible.
49  if ( bl1_zero_dim1( m ) ) return;
50 
51  // If necessary, allocate, initialize, and use a temporary contiguous
52  // copy of the matrix rather than the original matrix.
54  m,
55  m,
56  a_save, a_rs_save, a_cs_save,
57  &a, &a_rs, &a_cs );
58 
59  // Initialize with values assuming column-major storage.
60  lda = a_cs;
61  inca = a_rs;
62 
63  // If A is a row-major matrix, then we can use the underlying column-major
64  // BLAS implementation by fiddling with the parameters.
65  if ( bl1_is_row_storage( a_rs, a_cs ) )
66  {
67  bl1_swap_ints( lda, inca );
68  bl1_toggle_uplo( uplo );
69  bl1_toggle_conj( conj );
70  }
71 
72  // We want to handle the case where A is conjugated, but without
73  // explicitly or conjugating A. To do so, we leverage the fact that
74  // computing the product conj(A) * x is equivalent to computing
75  // conj( A * conj(x) ).
76  if ( bl1_is_conj( conj ) )
77  {
78  // We need a temporary vector so we can create a conjugated copy of x.
79  x_conj = bl1_callocv( m );
80  incx_conj = 1;
81 
83  m,
84  x, incx,
85  x_conj, incx_conj );
86 
87  // We need a temporary vector for the product A * conj(x), which is
88  // conformal to y (and x).
89  ax = bl1_callocv( m );
90  incax = 1;
91 
92  // Compute A * conj(x) where x is the temporary copy of x created above.
93  bl1_chemv_blas( uplo,
94  m,
95  &one,
96  a, lda,
97  x_conj, incx_conj,
98  &zero,
99  ax, incax );
100 
101  // Scale y by beta.
103  m,
104  beta,
105  y, incy );
106 
107  // And finally, accumulate alpha * conj( A * conj(x) ) into y.
109  m,
110  alpha,
111  ax, incax,
112  y, incy);
113 
114  // Free the temporary vectors for x and Ax.
115  bl1_cfree( x_conj );
116  bl1_cfree( ax );
117  }
118  else // noconj
119  {
120  bl1_chemv_blas( uplo,
121  m,
122  alpha,
123  a, lda,
124  x, incx,
125  beta,
126  y, incy );
127  }
128 
129  // Free the temporary contiguous matrix.
130  bl1_cfree_contigm( a_save, a_rs_save, a_cs_save,
131  &a, &a_rs, &a_cs );
132 }
void bl1_caxpyv(conj1_t conj, int n, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy)
Definition: bl1_axpyv.c:29
void bl1_ccopyv(conj1_t conj, int m, scomplex *x, int incx, scomplex *y, int incy)
Definition: bl1_copyv.c:49
void bl1_chemv_blas(uplo1_t uplo, int m, scomplex *alpha, scomplex *a, int lda, scomplex *x, int incx, scomplex *beta, scomplex *y, int incy)
Definition: bl1_hemv.c:235
void bl1_cscalv(conj1_t conj, int n, scomplex *alpha, scomplex *x, int incx)
Definition: bl1_scalv.c:46
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
int bl1_is_conj(conj1_t conj)
Definition: bl1_is.c:42
void bl1_cfree_contigm(scomplex *a_save, int a_rs_save, int a_cs_save, scomplex **a, int *a_rs, int *a_cs)
Definition: bl1_free_contigm.c:45
scomplex bl1_c1(void)
Definition: bl1_constants.c:61
void bl1_cfree(scomplex *p)
Definition: bl1_free.c:40
scomplex bl1_c0(void)
Definition: bl1_constants.c:125
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
scomplex * bl1_callocv(unsigned int n_elem)
Definition: bl1_allocv.c:40
@ BLIS1_CONJUGATE
Definition: blis_type_defs.h:82
@ BLIS1_NO_CONJUGATE
Definition: blis_type_defs.h:81
Definition: blis_type_defs.h:133

References bl1_c0(), bl1_c1(), bl1_callocv(), bl1_caxpyv(), bl1_ccopyv(), bl1_ccreate_contigmr(), bl1_cfree(), bl1_cfree_contigm(), bl1_chemv_blas(), bl1_cscalv(), bl1_is_conj(), bl1_is_row_storage(), bl1_zero_dim1(), BLIS1_CONJUGATE, and BLIS1_NO_CONJUGATE.

Referenced by FLA_Eig_gest_il_opc_var1(), FLA_Eig_gest_il_opc_var2(), FLA_Eig_gest_iu_opc_var1(), FLA_Eig_gest_iu_opc_var2(), FLA_Eig_gest_nl_opc_var1(), FLA_Eig_gest_nl_opc_var2(), FLA_Eig_gest_nu_opc_var1(), FLA_Eig_gest_nu_opc_var2(), FLA_Hemv_external(), FLA_Hemvc_external(), FLA_Lyap_h_opc_var1(), FLA_Lyap_n_opc_var1(), FLA_Tridiag_UT_l_step_ofc_var2(), FLA_Tridiag_UT_l_step_ofc_var3(), FLA_Tridiag_UT_l_step_opc_var1(), FLA_Tridiag_UT_l_step_opc_var2(), and FLA_Tridiag_UT_l_step_opc_var3().

◆ bl1_chemv_blas()

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

References bl1_param_map_to_netlib_uplo(), cblas_chemv(), CblasColMajor, and F77_chemv().

Referenced by bl1_chemv().

◆ bl1_dhemv()

void bl1_dhemv ( uplo1_t  uplo,
conj1_t  conj,
int  m,
double *  alpha,
double *  a,
int  a_rs,
int  a_cs,
double *  x,
int  incx,
double *  beta,
double *  y,
int  incy 
)
25 {
26  bl1_dsymv( uplo,
27  m,
28  alpha,
29  a, a_rs, a_cs,
30  x, incx,
31  beta,
32  y, incy );
33 }
void bl1_dsymv(uplo1_t uplo, int m, double *alpha, double *a, int a_rs, int a_cs, double *x, int incx, double *beta, double *y, int incy)
Definition: bl1_symv.c:56

References bl1_dsymv().

Referenced by FLA_Eig_gest_il_opd_var1(), FLA_Eig_gest_il_opd_var2(), FLA_Eig_gest_iu_opd_var1(), FLA_Eig_gest_iu_opd_var2(), FLA_Eig_gest_nl_opd_var1(), FLA_Eig_gest_nl_opd_var2(), FLA_Eig_gest_nu_opd_var1(), FLA_Eig_gest_nu_opd_var2(), FLA_Lyap_h_opd_var1(), and FLA_Lyap_n_opd_var1().

◆ bl1_shemv()

void bl1_shemv ( uplo1_t  uplo,
conj1_t  conj,
int  m,
float *  alpha,
float *  a,
int  a_rs,
int  a_cs,
float *  x,
int  incx,
float *  beta,
float *  y,
int  incy 
)
14 {
15  bl1_ssymv( uplo,
16  m,
17  alpha,
18  a, a_rs, a_cs,
19  x, incx,
20  beta,
21  y, incy );
22 }
void bl1_ssymv(uplo1_t uplo, int m, float *alpha, float *a, int a_rs, int a_cs, float *x, int incx, float *beta, float *y, int incy)
Definition: bl1_symv.c:13

References bl1_ssymv().

Referenced by FLA_Eig_gest_il_ops_var1(), FLA_Eig_gest_il_ops_var2(), FLA_Eig_gest_iu_ops_var1(), FLA_Eig_gest_iu_ops_var2(), FLA_Eig_gest_nl_ops_var1(), FLA_Eig_gest_nl_ops_var2(), FLA_Eig_gest_nu_ops_var1(), FLA_Eig_gest_nu_ops_var2(), FLA_Lyap_h_ops_var1(), and FLA_Lyap_n_ops_var1().

◆ bl1_zhemv()

void bl1_zhemv ( uplo1_t  uplo,
conj1_t  conj,
int  m,
dcomplex alpha,
dcomplex a,
int  a_rs,
int  a_cs,
dcomplex x,
int  incx,
dcomplex beta,
dcomplex y,
int  incy 
)
135 {
136  dcomplex* a_save = a;
137  int a_rs_save = a_rs;
138  int a_cs_save = a_cs;
139  dcomplex zero = bl1_z0();
140  dcomplex one = bl1_z1();
141  dcomplex* x_conj;
142  dcomplex* ax;
143  int lda, inca;
144  int incx_conj;
145  int incax;
146 
147  // Return early if possible.
148  if ( bl1_zero_dim1( m ) ) return;
149 
150  // If necessary, allocate, initialize, and use a temporary contiguous
151  // copy of the matrix rather than the original matrix.
152  bl1_zcreate_contigmr( uplo,
153  m,
154  m,
155  a_save, a_rs_save, a_cs_save,
156  &a, &a_rs, &a_cs );
157 
158  // Initialize with values assuming column-major storage.
159  lda = a_cs;
160  inca = a_rs;
161 
162  // If A is a row-major matrix, then we can use the underlying column-major
163  // BLAS implementation by fiddling with the parameters.
164  if ( bl1_is_row_storage( a_rs, a_cs ) )
165  {
166  bl1_swap_ints( lda, inca );
167  bl1_toggle_uplo( uplo );
168  bl1_toggle_conj( conj );
169  }
170 
171  // We want to handle the case where A is conjugated, but without
172  // explicitly or conjugating A. To do so, we leverage the fact that
173  // computing the product conj(A) * x is equivalent to computing
174  // conj( A * conj(x) ).
175  if ( bl1_is_conj( conj ) )
176  {
177  // We need a temporary vector so we can create a conjugated copy of x.
178  x_conj = bl1_zallocv( m );
179  incx_conj = 1;
180 
182  m,
183  x, incx,
184  x_conj, incx_conj );
185 
186  // We need a temporary vector for the product A * conj(x), which is
187  // conformal to y (and x).
188  ax = bl1_zallocv( m );
189  incax = 1;
190 
191  // Compute A * conj(x) where x is the temporary copy of x created above.
192  bl1_zhemv_blas( uplo,
193  m,
194  &one,
195  a, lda,
196  x_conj, incx_conj,
197  &zero,
198  ax, incax );
199 
200  // Scale y by beta.
202  m,
203  beta,
204  y, incy );
205 
206  // And finally, accumulate alpha * conj( A * conj(x) ) into y.
208  m,
209  alpha,
210  ax, incax,
211  y, incy);
212 
213  // Free the temporary vectors for x and Ax.
214  bl1_zfree( x_conj );
215  bl1_zfree( ax );
216  }
217  else // noconj
218  {
219  bl1_zhemv_blas( uplo,
220  m,
221  alpha,
222  a, lda,
223  x, incx,
224  beta,
225  y, incy );
226  }
227 
228  // Free the temporary contiguous matrix.
229  bl1_zfree_contigm( a_save, a_rs_save, a_cs_save,
230  &a, &a_rs, &a_cs );
231 }
void bl1_zaxpyv(conj1_t conj, int n, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy)
Definition: bl1_axpyv.c:60
void bl1_zcopyv(conj1_t conj, int m, dcomplex *x, int incx, dcomplex *y, int incy)
Definition: bl1_copyv.c:63
void bl1_zhemv_blas(uplo1_t uplo, int m, dcomplex *alpha, dcomplex *a, int lda, dcomplex *x, int incx, dcomplex *beta, dcomplex *y, int incy)
Definition: bl1_hemv.c:266
void bl1_zscalv(conj1_t conj, int n, dcomplex *alpha, dcomplex *x, int incx)
Definition: bl1_scalv.c:72
dcomplex bl1_z0(void)
Definition: bl1_constants.c:133
dcomplex * bl1_zallocv(unsigned int n_elem)
Definition: bl1_allocv.c:45
dcomplex bl1_z1(void)
Definition: bl1_constants.c:69
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(dcomplex *p)
Definition: bl1_free.c:45
void bl1_zfree_contigm(dcomplex *a_save, int a_rs_save, int a_cs_save, dcomplex **a, int *a_rs, int *a_cs)
Definition: bl1_free_contigm.c:61
Definition: blis_type_defs.h:138

References bl1_is_conj(), bl1_is_row_storage(), bl1_z0(), bl1_z1(), bl1_zallocv(), bl1_zaxpyv(), bl1_zcopyv(), bl1_zcreate_contigmr(), bl1_zero_dim1(), bl1_zfree(), bl1_zfree_contigm(), bl1_zhemv_blas(), bl1_zscalv(), BLIS1_CONJUGATE, and BLIS1_NO_CONJUGATE.

Referenced by FLA_Eig_gest_il_opz_var1(), FLA_Eig_gest_il_opz_var2(), FLA_Eig_gest_iu_opz_var1(), FLA_Eig_gest_iu_opz_var2(), FLA_Eig_gest_nl_opz_var1(), FLA_Eig_gest_nl_opz_var2(), FLA_Eig_gest_nu_opz_var1(), FLA_Eig_gest_nu_opz_var2(), FLA_Hemv_external(), FLA_Hemvc_external(), FLA_Lyap_h_opz_var1(), FLA_Lyap_n_opz_var1(), FLA_Tridiag_UT_l_step_ofz_var2(), FLA_Tridiag_UT_l_step_ofz_var3(), FLA_Tridiag_UT_l_step_opz_var1(), FLA_Tridiag_UT_l_step_opz_var2(), and FLA_Tridiag_UT_l_step_opz_var3().

◆ bl1_zhemv_blas()

void bl1_zhemv_blas ( uplo1_t  uplo,
int  m,
dcomplex alpha,
dcomplex a,
int  lda,
dcomplex x,
int  incx,
dcomplex beta,
dcomplex y,
int  incy 
)
267 {
268 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
269  enum CBLAS_ORDER cblas_order = CblasColMajor;
270  enum CBLAS_UPLO cblas_uplo;
271 
272  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
273 
274  cblas_zhemv( cblas_order,
275  cblas_uplo,
276  m,
277  alpha,
278  a, lda,
279  x, incx,
280  beta,
281  y, incy );
282 #else
283  char blas_uplo;
284 
285  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
286 
287  F77_zhemv( &blas_uplo,
288  &m,
289  alpha,
290  a, &lda,
291  x, &incx,
292  beta,
293  y, &incy );
294 #endif
295 }
void F77_zhemv(char *uplo, int *n, dcomplex *alpha, dcomplex *a, int *lda, dcomplex *x, int *incx, dcomplex *beta, dcomplex *y, int *incy)
void cblas_zhemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY)

References bl1_param_map_to_netlib_uplo(), cblas_zhemv(), CblasColMajor, and F77_zhemv().

Referenced by bl1_zhemv().