libflame  revision_anchor
Functions
bl1_her.c File Reference

(r)

Functions

void bl1_sher (uplo1_t uplo, conj1_t conj, int m, float *alpha, float *x, int incx, float *a, int a_rs, int a_cs)
 
void bl1_dher (uplo1_t uplo, conj1_t conj, int m, double *alpha, double *x, int incx, double *a, int a_rs, int a_cs)
 
void bl1_cher (uplo1_t uplo, conj1_t conj, int m, float *alpha, scomplex *x, int incx, scomplex *a, int a_rs, int a_cs)
 
void bl1_zher (uplo1_t uplo, conj1_t conj, int m, double *alpha, dcomplex *x, int incx, dcomplex *a, int a_rs, int a_cs)
 
void bl1_cher_blas (uplo1_t uplo, int m, float *alpha, scomplex *x, int incx, scomplex *a, int lda)
 
void bl1_zher_blas (uplo1_t uplo, int m, double *alpha, dcomplex *x, int incx, dcomplex *a, int lda)
 

Function Documentation

◆ bl1_cher()

void bl1_cher ( uplo1_t  uplo,
conj1_t  conj,
int  m,
float *  alpha,
scomplex x,
int  incx,
scomplex a,
int  a_rs,
int  a_cs 
)

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

Referenced by FLA_Chol_l_opc_var3(), FLA_Chol_u_opc_var3(), FLA_Her_external(), FLA_Herc_external(), FLA_Ttmm_l_opc_var1(), and FLA_Ttmm_u_opc_var1().

32 {
33  int m_save = m;
34  scomplex* a_save = a;
35  int a_rs_save = a_rs;
36  int a_cs_save = a_cs;
37  scomplex* x_conj;
38  int incx_conj;
39  int lda, inca;
40 
41  // Return early if possible.
42  if ( bl1_zero_dim1( m ) ) return;
43 
44  // If necessary, allocate, initialize, and use a temporary contiguous
45  // copy of the matrix rather than the original matrix.
47  m,
48  m,
49  a_save, a_rs_save, a_cs_save,
50  &a, &a_rs, &a_cs );
51 
52  // Initialize with values assuming column-major storage.
53  lda = a_cs;
54  inca = a_rs;
55 
56  // If A is a row-major matrix, then we can use the underlying column-major
57  // BLAS implementation by fiddling with the parameters.
58  if ( bl1_is_row_storage( a_rs, a_cs ) )
59  {
60  bl1_swap_ints( lda, inca );
61  bl1_toggle_uplo( uplo );
62  bl1_toggle_conj( conj );
63  }
64 
65  // Initialize with values assuming no conjugation of ( x * x' ).
66  x_conj = x;
67  incx_conj = incx;
68 
69  // We want to handle the case where ( x * x' ) is conjugated, but
70  // without explicitly conjugating the matrix. To do so, we leverage
71  // the fact that computing the product conj( x * x' ) is equivalent
72  // to computing ( conj(x) * conj(x)' ), since ( x * x' ) is Hermitian.
73  if ( bl1_is_conj( conj ) )
74  {
75  x_conj = bl1_callocv( m );
76  incx_conj = 1;
77 
79  m,
80  x, incx,
81  x_conj, incx_conj );
82  }
83 
84  bl1_cher_blas( uplo,
85  m,
86  alpha,
87  x_conj, incx_conj,
88  a, lda );
89 
90  // Free the temporary conjugated x vector.
91  if ( bl1_is_conj( conj ) )
92  bl1_cfree( x_conj );
93 
94  // Free the temporary contiguous matrix.
96  m_save,
97  a_save, a_rs_save, a_cs_save,
98  &a, &a_rs, &a_cs );
99 }
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
void bl1_cher_blas(uplo1_t uplo, int m, float *alpha, scomplex *x, int incx, scomplex *a, int lda)
Definition: bl1_her.c:173
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_ccopyv(conj1_t conj, int m, scomplex *x, int incx, scomplex *y, int incy)
Definition: bl1_copyv.c:49

◆ bl1_cher_blas()

void bl1_cher_blas ( uplo1_t  uplo,
int  m,
float *  alpha,
scomplex x,
int  incx,
scomplex a,
int  lda 
)

References bl1_param_map_to_netlib_uplo(), cblas_cher(), CblasColMajor, and F77_cher().

Referenced by bl1_cher().

174 {
175 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
176  enum CBLAS_ORDER cblas_order = CblasColMajor;
177  enum CBLAS_UPLO cblas_uplo;
178 
179  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
180 
181  cblas_cher( cblas_order,
182  cblas_uplo,
183  m,
184  *alpha,
185  x, incx,
186  a, lda );
187 #else
188  char blas_uplo;
189 
190  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
191 
192  F77_cher( &blas_uplo,
193  &m,
194  alpha,
195  x, &incx,
196  a, &lda );
197 #endif
198 }
CBLAS_ORDER
Definition: blis_prototypes_cblas.h:17
CBLAS_UPLO
Definition: blis_prototypes_cblas.h:19
void cblas_cher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const float alpha, const void *X, const int incX, void *A, const int lda)
Definition: blis_prototypes_cblas.h:17
void F77_cher(char *uplo, int *n, float *alpha, scomplex *x, int *incx, scomplex *a, int *lda)
void bl1_param_map_to_netlib_uplo(uplo1_t blis_uplo, void *blas_uplo)
Definition: bl1_param_map.c:47

◆ bl1_dher()

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

References bl1_dsyr().

23 {
24  bl1_dsyr( uplo,
25  m,
26  alpha,
27  x, incx,
28  a, a_rs, a_cs );
29 }
void bl1_dsyr(uplo1_t uplo, int m, double *alpha, double *x, int incx, double *a, int a_rs, int a_cs)
Definition: bl1_syr.c:57

◆ bl1_sher()

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

References bl1_ssyr().

14 {
15  bl1_ssyr( uplo,
16  m,
17  alpha,
18  x, incx,
19  a, a_rs, a_cs );
20 }
void bl1_ssyr(uplo1_t uplo, int m, float *alpha, float *x, int incx, float *a, int a_rs, int a_cs)
Definition: bl1_syr.c:13

◆ bl1_zher()

void bl1_zher ( uplo1_t  uplo,
conj1_t  conj,
int  m,
double *  alpha,
dcomplex x,
int  incx,
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_zher_blas(), and BLIS1_CONJUGATE.

Referenced by FLA_Chol_l_opz_var3(), FLA_Chol_u_opz_var3(), FLA_Her_external(), FLA_Herc_external(), FLA_Ttmm_l_opz_var1(), and FLA_Ttmm_u_opz_var1().

102 {
103  int m_save = m;
104  dcomplex* a_save = a;
105  int a_rs_save = a_rs;
106  int a_cs_save = a_cs;
107  dcomplex* x_conj;
108  int incx_conj;
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_zcreate_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  bl1_toggle_conj( conj );
133  }
134 
135  // Initialize with values assuming no conjugation of ( x * x' ).
136  x_conj = x;
137  incx_conj = incx;
138 
139  // We want to handle the case where ( x * x' ) is conjugated, but
140  // without explicitly conjugating the matrix. To do so, we leverage
141  // the fact that computing the product conj( x * x' ) is equivalent
142  // to computing ( conj(x) * conj(x)' ), since ( x * x' ) is Hermitian.
143  if ( bl1_is_conj( conj ) )
144  {
145  x_conj = bl1_zallocv( m );
146  incx_conj = 1;
147 
149  m,
150  x, incx,
151  x_conj, incx_conj );
152  }
153 
154  bl1_zher_blas( uplo,
155  m,
156  alpha,
157  x_conj, incx_conj,
158  a, lda );
159 
160  // Free the temporary conjugated x vector.
161  if ( bl1_is_conj( conj ) )
162  bl1_zfree( x_conj );
163 
164  // Free the temporary contiguous matrix.
165  bl1_zfree_saved_contigm( m_save,
166  m_save,
167  a_save, a_rs_save, a_cs_save,
168  &a, &a_rs, &a_cs );
169 }
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_zher_blas(uplo1_t uplo, int m, double *alpha, dcomplex *x, int incx, dcomplex *a, int lda)
Definition: bl1_her.c:200
int bl1_is_conj(conj1_t conj)
Definition: bl1_is.c:42
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_zher_blas()

void bl1_zher_blas ( uplo1_t  uplo,
int  m,
double *  alpha,
dcomplex x,
int  incx,
dcomplex a,
int  lda 
)

References bl1_param_map_to_netlib_uplo(), cblas_zher(), CblasColMajor, and F77_zher().

Referenced by bl1_zher().

201 {
202 #ifdef BLIS1_ENABLE_CBLAS_INTERFACES
203  enum CBLAS_ORDER cblas_order = CblasColMajor;
204  enum CBLAS_UPLO cblas_uplo;
205 
206  bl1_param_map_to_netlib_uplo( uplo, &cblas_uplo );
207 
208  cblas_zher( cblas_order,
209  cblas_uplo,
210  m,
211  *alpha,
212  x, incx,
213  a, lda );
214 #else
215  char blas_uplo;
216 
217  bl1_param_map_to_netlib_uplo( uplo, &blas_uplo );
218 
219  F77_zher( &blas_uplo,
220  &m,
221  alpha,
222  x, &incx,
223  a, &lda );
224 #endif
225 }
CBLAS_ORDER
Definition: blis_prototypes_cblas.h:17
void cblas_zher(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const int N, const double alpha, const void *X, const int incX, void *A, const 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 F77_zher(char *uplo, int *n, double *alpha, dcomplex *x, int *incx, dcomplex *a, int *lda)