libflame revision_anchor
|
Functions | |
void | bli_ssyr2k (char uplo, char trans, int m, int k, float *alpha, float *a, int a_rs, int a_cs, float *b, int b_rs, int b_cs, float *beta, float *c, int c_rs, int c_cs) |
void | bli_dsyr2k (char uplo, char trans, int m, int k, double *alpha, double *a, int a_rs, int a_cs, double *b, int b_rs, int b_cs, double *beta, double *c, int c_rs, int c_cs) |
void | bli_csyr2k (char uplo, char trans, int m, int k, scomplex *alpha, scomplex *a, int a_rs, int a_cs, scomplex *b, int b_rs, int b_cs, scomplex *beta, scomplex *c, int c_rs, int c_cs) |
void | bli_zsyr2k (char uplo, char trans, int m, int k, dcomplex *alpha, dcomplex *a, int a_rs, int a_cs, dcomplex *b, int b_rs, int b_cs, dcomplex *beta, dcomplex *c, int c_rs, int c_cs) |
void | bli_ssyr2k_blas (char uplo, char trans, int m, int k, float *alpha, float *a, int lda, float *b, int ldb, float *beta, float *c, int ldc) |
void | bli_dsyr2k_blas (char uplo, char trans, int m, int k, double *alpha, double *a, int lda, double *b, int ldb, double *beta, double *c, int ldc) |
void | bli_csyr2k_blas (char uplo, char trans, int m, int k, scomplex *alpha, scomplex *a, int lda, scomplex *b, int ldb, scomplex *beta, scomplex *c, int ldc) |
void | bli_zsyr2k_blas (char uplo, char trans, int m, int k, dcomplex *alpha, dcomplex *a, int lda, dcomplex *b, int ldb, dcomplex *beta, dcomplex *c, int ldc) |
void bli_csyr2k | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
scomplex * | alpha, | ||
scomplex * | a, | ||
int | a_rs, | ||
int | a_cs, | ||
scomplex * | b, | ||
int | b_rs, | ||
int | b_cs, | ||
scomplex * | beta, | ||
scomplex * | c, | ||
int | c_rs, | ||
int | c_cs | ||
) |
References bli_callocm(), bli_ccopymt(), bli_ccreate_contigmr(), bli_ccreate_contigmt(), bli_cfree(), bli_cfree_contigm(), bli_cfree_saved_contigmr(), bli_csyr2k_blas(), bli_does_trans(), bli_is_col_storage(), and bli_zero_dim2().
Referenced by FLA_Syr2k_external().
{ char uplo_save = uplo; int m_save = m; scomplex* a_save = a; scomplex* b_save = b; scomplex* c_save = c; int a_rs_save = a_rs; int a_cs_save = a_cs; int b_rs_save = b_rs; int b_cs_save = b_cs; int c_rs_save = c_rs; int c_cs_save = c_cs; scomplex* a_copy; scomplex* b_copy; int lda, inca; int ldb, incb; int ldc, incc; int lda_copy, inca_copy; int ldb_copy, incb_copy; int syr2k_needs_copya = FALSE; int syr2k_needs_copyb = FALSE; // Return early if possible. if ( bli_zero_dim2( m, k ) ) return; // If necessary, allocate, initialize, and use a temporary contiguous // copy of each matrix rather than the original matrices. bli_ccreate_contigmt( trans, m, k, a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_ccreate_contigmt( trans, m, k, b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_ccreate_contigmr( uplo, m, m, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); // Initialize with values assuming column-major storage. lda = a_cs; inca = a_rs; ldb = b_cs; incb = b_rs; ldc = c_cs; incc = c_rs; // Adjust the parameters based on the storage of each matrix. if ( bli_is_col_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_r' + B_r * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copyb = TRUE; } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_c' + B_c * A_r' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copya = TRUE; } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_r' + B_r * A_r' // requested operation: uplo( C_c ) += conj( A_c' * B_c + B_c' * A_c ) bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_trans( trans ); } } } else // if ( bli_is_row_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_c' + B_c * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_r' + B_r * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copyb = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_c' + B_c * A_r' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copya = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_r' + B_r * A_r' // requested operation: ~uplo( C_c ) += A_c' * B_c + B_c' * A_c bli_swap_ints( ldc, incc ); bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_uplo( uplo ); bli_toggle_trans( trans ); } } } a_copy = a; lda_copy = lda; inca_copy = inca; // There are two cases where we need to copy A column-major storage. // We handle those two cases here. if ( syr2k_needs_copya ) { int m_a; int n_a; // Determine the dimensions of A according to the value of trans. We // need this in order to set the leading dimension of the copy of A. if ( bli_does_trans( trans ) ) { m_a = k; n_a = m; } else { m_a = m; n_a = k; } // We need a temporary matrix to hold a column-major copy of A. a_copy = bli_callocm( m, k ); lda_copy = m_a; inca_copy = 1; // Copy the contents of A into A_copy. bli_ccopymt( BLIS_NO_TRANSPOSE, m_a, n_a, a, inca, lda, a_copy, inca_copy, lda_copy ); } b_copy = b; ldb_copy = ldb; incb_copy = incb; // There are two cases where we need to copy B column-major storage. // We handle those two cases here. if ( syr2k_needs_copyb ) { int m_b; int n_b; // Determine the dimensions of B according to the value of trans. We // need this in order to set the leading dimension of the copy of B. if ( bli_does_trans( trans ) ) { m_b = k; n_b = m; } else { m_b = m; n_b = k; } // We need a temporary matrix to hold a column-major copy of B. b_copy = bli_callocm( m, k ); ldb_copy = m_b; incb_copy = 1; // Copy the contents of B into B_copy. bli_ccopymt( BLIS_NO_TRANSPOSE, m_b, n_b, b, incb, ldb, b_copy, incb_copy, ldb_copy ); } bli_csyr2k_blas( uplo, trans, m, k, alpha, a_copy, lda_copy, b_copy, ldb_copy, beta, c, ldc ); if ( syr2k_needs_copya ) bli_cfree( a_copy ); if ( syr2k_needs_copyb ) bli_cfree( b_copy ); // Free any temporary contiguous matrices, copying the result back to // the original matrix. bli_cfree_contigm( a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_cfree_contigm( b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_cfree_saved_contigmr( uplo_save, m_save, m_save, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); }
void bli_csyr2k_blas | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
scomplex * | alpha, | ||
scomplex * | a, | ||
int | lda, | ||
scomplex * | b, | ||
int | ldb, | ||
scomplex * | beta, | ||
scomplex * | c, | ||
int | ldc | ||
) |
References bli_is_conjtrans(), bli_param_map_to_netlib_trans(), bli_param_map_to_netlib_uplo(), cblas_csyr2k(), CblasColMajor, and F77_csyr2k().
Referenced by bli_csyr2k().
{ // BLAS doesn't recognize the conjugate-transposition constant for syr2k, // so we have to map it down to regular transposition. if ( bli_is_conjtrans( trans ) ) trans = BLIS_TRANSPOSE; #ifdef BLIS_ENABLE_CBLAS_INTERFACES enum CBLAS_ORDER cblas_order = CblasColMajor; enum CBLAS_UPLO cblas_uplo; enum CBLAS_TRANSPOSE cblas_trans; bli_param_map_to_netlib_uplo( uplo, &cblas_uplo ); bli_param_map_to_netlib_trans( trans, &cblas_trans ); cblas_csyr2k( cblas_order, cblas_uplo, cblas_trans, m, k, alpha, a, lda, b, ldb, beta, c, ldc ); #else char blas_uplo; char blas_trans; bli_param_map_to_netlib_uplo( uplo, &blas_uplo ); bli_param_map_to_netlib_trans( trans, &blas_trans ); F77_csyr2k( &blas_uplo, &blas_trans, &m, &k, alpha, a, &lda, b, &ldb, beta, c, &ldc ); #endif }
void bli_dsyr2k | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
double * | alpha, | ||
double * | a, | ||
int | a_rs, | ||
int | a_cs, | ||
double * | b, | ||
int | b_rs, | ||
int | b_cs, | ||
double * | beta, | ||
double * | c, | ||
int | c_rs, | ||
int | c_cs | ||
) |
References bli_dallocm(), bli_dcopymt(), bli_dcreate_contigmr(), bli_dcreate_contigmt(), bli_dfree(), bli_dfree_contigm(), bli_dfree_saved_contigmr(), bli_does_trans(), bli_dsyr2k_blas(), bli_is_col_storage(), and bli_zero_dim2().
Referenced by bli_dher2k(), FLA_Her2k_external(), and FLA_Syr2k_external().
{ char uplo_save = uplo; int m_save = m; double* a_save = a; double* b_save = b; double* c_save = c; int a_rs_save = a_rs; int a_cs_save = a_cs; int b_rs_save = b_rs; int b_cs_save = b_cs; int c_rs_save = c_rs; int c_cs_save = c_cs; double* a_copy; double* b_copy; int lda, inca; int ldb, incb; int ldc, incc; int lda_copy, inca_copy; int ldb_copy, incb_copy; int syr2k_needs_copya = FALSE; int syr2k_needs_copyb = FALSE; // Return early if possible. if ( bli_zero_dim2( m, k ) ) return; // If necessary, allocate, initialize, and use a temporary contiguous // copy of each matrix rather than the original matrices. bli_dcreate_contigmt( trans, m, k, a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_dcreate_contigmt( trans, m, k, b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_dcreate_contigmr( uplo, m, m, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); // Initialize with values assuming column-major storage. lda = a_cs; inca = a_rs; ldb = b_cs; incb = b_rs; ldc = c_cs; incc = c_rs; // Adjust the parameters based on the storage of each matrix. if ( bli_is_col_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_r' + B_r * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copyb = TRUE; } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_c' + B_c * A_r' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copya = TRUE; } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_r' + B_r * A_r' // requested operation: uplo( C_c ) += conj( A_c' * B_c + B_c' * A_c ) bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_trans( trans ); } } } else // if ( bli_is_row_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_c' + B_c * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_r' + B_r * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copyb = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_c' + B_c * A_r' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copya = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_r' + B_r * A_r' // requested operation: ~uplo( C_c ) += A_c' * B_c + B_c' * A_c bli_swap_ints( ldc, incc ); bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_uplo( uplo ); bli_toggle_trans( trans ); } } } a_copy = a; lda_copy = lda; inca_copy = inca; // There are two cases where we need to copy A column-major storage. // We handle those two cases here. if ( syr2k_needs_copya ) { int m_a; int n_a; // Determine the dimensions of A according to the value of trans. We // need this in order to set the leading dimension of the copy of A. if ( bli_does_trans( trans ) ) { m_a = k; n_a = m; } else { m_a = m; n_a = k; } // We need a temporary matrix to hold a column-major copy of A. a_copy = bli_dallocm( m, k ); lda_copy = m_a; inca_copy = 1; // Copy the contents of A into A_copy. bli_dcopymt( BLIS_NO_TRANSPOSE, m_a, n_a, a, inca, lda, a_copy, inca_copy, lda_copy ); } b_copy = b; ldb_copy = ldb; incb_copy = incb; // There are two cases where we need to copy B column-major storage. // We handle those two cases here. if ( syr2k_needs_copyb ) { int m_b; int n_b; // Determine the dimensions of B according to the value of trans. We // need this in order to set the leading dimension of the copy of B. if ( bli_does_trans( trans ) ) { m_b = k; n_b = m; } else { m_b = m; n_b = k; } // We need a temporary matrix to hold a column-major copy of B. b_copy = bli_dallocm( m, k ); ldb_copy = m_b; incb_copy = 1; // Copy the contents of B into B_copy. bli_dcopymt( BLIS_NO_TRANSPOSE, m_b, n_b, b, incb, ldb, b_copy, incb_copy, ldb_copy ); } bli_dsyr2k_blas( uplo, trans, m, k, alpha, a_copy, lda_copy, b_copy, ldb_copy, beta, c, ldc ); if ( syr2k_needs_copya ) bli_dfree( a_copy ); if ( syr2k_needs_copyb ) bli_dfree( b_copy ); // Free any temporary contiguous matrices, copying the result back to // the original matrix. bli_dfree_contigm( a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_dfree_contigm( b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_dfree_saved_contigmr( uplo_save, m_save, m_save, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); }
void bli_dsyr2k_blas | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
double * | alpha, | ||
double * | a, | ||
int | lda, | ||
double * | b, | ||
int | ldb, | ||
double * | beta, | ||
double * | c, | ||
int | ldc | ||
) |
References bli_is_conjtrans(), bli_param_map_to_netlib_trans(), bli_param_map_to_netlib_uplo(), cblas_dsyr2k(), CblasColMajor, and F77_dsyr2k().
Referenced by bli_dsyr2k().
{ // BLAS doesn't recognize the conjugate-transposition constant for syr2k, // so we have to map it down to regular transposition. if ( bli_is_conjtrans( trans ) ) trans = BLIS_TRANSPOSE; #ifdef BLIS_ENABLE_CBLAS_INTERFACES enum CBLAS_ORDER cblas_order = CblasColMajor; enum CBLAS_UPLO cblas_uplo; enum CBLAS_TRANSPOSE cblas_trans; bli_param_map_to_netlib_uplo( uplo, &cblas_uplo ); bli_param_map_to_netlib_trans( trans, &cblas_trans ); cblas_dsyr2k( cblas_order, cblas_uplo, cblas_trans, m, k, *alpha, a, lda, b, ldb, *beta, c, ldc ); #else char blas_uplo; char blas_trans; bli_param_map_to_netlib_uplo( uplo, &blas_uplo ); bli_param_map_to_netlib_trans( trans, &blas_trans ); F77_dsyr2k( &blas_uplo, &blas_trans, &m, &k, alpha, a, &lda, b, &ldb, beta, c, &ldc ); #endif }
void bli_ssyr2k | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
float * | alpha, | ||
float * | a, | ||
int | a_rs, | ||
int | a_cs, | ||
float * | b, | ||
int | b_rs, | ||
int | b_cs, | ||
float * | beta, | ||
float * | c, | ||
int | c_rs, | ||
int | c_cs | ||
) |
References bli_does_trans(), bli_is_col_storage(), bli_sallocm(), bli_scopymt(), bli_screate_contigmr(), bli_screate_contigmt(), bli_sfree(), bli_sfree_contigm(), bli_sfree_saved_contigmr(), bli_ssyr2k_blas(), and bli_zero_dim2().
Referenced by bli_sher2k(), FLA_Her2k_external(), and FLA_Syr2k_external().
{ char uplo_save = uplo; int m_save = m; float* a_save = a; float* b_save = b; float* c_save = c; int a_rs_save = a_rs; int a_cs_save = a_cs; int b_rs_save = b_rs; int b_cs_save = b_cs; int c_rs_save = c_rs; int c_cs_save = c_cs; float* a_copy; float* b_copy; int lda, inca; int ldb, incb; int ldc, incc; int lda_copy, inca_copy; int ldb_copy, incb_copy; int syr2k_needs_copya = FALSE; int syr2k_needs_copyb = FALSE; // Return early if possible. if ( bli_zero_dim2( m, k ) ) return; // If necessary, allocate, initialize, and use a temporary contiguous // copy of each matrix rather than the original matrices. bli_screate_contigmt( trans, m, k, a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_screate_contigmt( trans, m, k, b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_screate_contigmr( uplo, m, m, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); // Initialize with values assuming column-major storage. lda = a_cs; inca = a_rs; ldb = b_cs; incb = b_rs; ldc = c_cs; incc = c_rs; // Adjust the parameters based on the storage of each matrix. if ( bli_is_col_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_r' + B_r * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copyb = TRUE; } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_c' + B_c * A_r' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copya = TRUE; } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_r' + B_r * A_r' // requested operation: uplo( C_c ) += conj( A_c' * B_c + B_c' * A_c ) bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_trans( trans ); } } } else // if ( bli_is_row_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_c' + B_c * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_r' + B_r * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copyb = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_c' + B_c * A_r' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copya = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_r' + B_r * A_r' // requested operation: ~uplo( C_c ) += A_c' * B_c + B_c' * A_c bli_swap_ints( ldc, incc ); bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_uplo( uplo ); bli_toggle_trans( trans ); } } } a_copy = a; lda_copy = lda; inca_copy = inca; // There are two cases where we need to copy A column-major storage. // We handle those two cases here. if ( syr2k_needs_copya ) { int m_a; int n_a; // Determine the dimensions of A according to the value of trans. We // need this in order to set the leading dimension of the copy of A. if ( bli_does_trans( trans ) ) { m_a = k; n_a = m; } else { m_a = m; n_a = k; } // We need a temporary matrix to hold a column-major copy of A. a_copy = bli_sallocm( m, k ); lda_copy = m_a; inca_copy = 1; // Copy the contents of A into A_copy. bli_scopymt( BLIS_NO_TRANSPOSE, m_a, n_a, a, inca, lda, a_copy, inca_copy, lda_copy ); } b_copy = b; ldb_copy = ldb; incb_copy = incb; // There are two cases where we need to copy B column-major storage. // We handle those two cases here. if ( syr2k_needs_copyb ) { int m_b; int n_b; // Determine the dimensions of B according to the value of trans. We // need this in order to set the leading dimension of the copy of B. if ( bli_does_trans( trans ) ) { m_b = k; n_b = m; } else { m_b = m; n_b = k; } // We need a temporary matrix to hold a column-major copy of B. b_copy = bli_sallocm( m, k ); ldb_copy = m_b; incb_copy = 1; // Copy the contents of B into B_copy. bli_scopymt( BLIS_NO_TRANSPOSE, m_b, n_b, b, incb, ldb, b_copy, incb_copy, ldb_copy ); } bli_ssyr2k_blas( uplo, trans, m, k, alpha, a_copy, lda_copy, b_copy, ldb_copy, beta, c, ldc ); if ( syr2k_needs_copya ) bli_sfree( a_copy ); if ( syr2k_needs_copyb ) bli_sfree( b_copy ); // Free any temporary contiguous matrices, copying the result back to // the original matrix. bli_sfree_contigm( a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_sfree_contigm( b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_sfree_saved_contigmr( uplo_save, m_save, m_save, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); }
void bli_ssyr2k_blas | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
float * | alpha, | ||
float * | a, | ||
int | lda, | ||
float * | b, | ||
int | ldb, | ||
float * | beta, | ||
float * | c, | ||
int | ldc | ||
) |
References bli_is_conjtrans(), bli_param_map_to_netlib_trans(), bli_param_map_to_netlib_uplo(), cblas_ssyr2k(), CblasColMajor, and F77_ssyr2k().
Referenced by bli_ssyr2k().
{ // BLAS doesn't recognize the conjugate-transposition constant for syr2k, // so we have to map it down to regular transposition. if ( bli_is_conjtrans( trans ) ) trans = BLIS_TRANSPOSE; #ifdef BLIS_ENABLE_CBLAS_INTERFACES enum CBLAS_ORDER cblas_order = CblasColMajor; enum CBLAS_UPLO cblas_uplo; enum CBLAS_TRANSPOSE cblas_trans; bli_param_map_to_netlib_uplo( uplo, &cblas_uplo ); bli_param_map_to_netlib_trans( trans, &cblas_trans ); cblas_ssyr2k( cblas_order, cblas_uplo, cblas_trans, m, k, *alpha, a, lda, b, ldb, *beta, c, ldc ); #else char blas_uplo; char blas_trans; bli_param_map_to_netlib_uplo( uplo, &blas_uplo ); bli_param_map_to_netlib_trans( trans, &blas_trans ); F77_ssyr2k( &blas_uplo, &blas_trans, &m, &k, alpha, a, &lda, b, &ldb, beta, c, &ldc ); #endif }
void bli_zsyr2k | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
dcomplex * | alpha, | ||
dcomplex * | a, | ||
int | a_rs, | ||
int | a_cs, | ||
dcomplex * | b, | ||
int | b_rs, | ||
int | b_cs, | ||
dcomplex * | beta, | ||
dcomplex * | c, | ||
int | c_rs, | ||
int | c_cs | ||
) |
References bli_does_trans(), bli_is_col_storage(), bli_zallocm(), bli_zcopymt(), bli_zcreate_contigmr(), bli_zcreate_contigmt(), bli_zero_dim2(), bli_zfree(), bli_zfree_contigm(), bli_zfree_saved_contigmr(), and bli_zsyr2k_blas().
Referenced by FLA_Syr2k_external().
{ char uplo_save = uplo; int m_save = m; dcomplex* a_save = a; dcomplex* b_save = b; dcomplex* c_save = c; int a_rs_save = a_rs; int a_cs_save = a_cs; int b_rs_save = b_rs; int b_cs_save = b_cs; int c_rs_save = c_rs; int c_cs_save = c_cs; dcomplex* a_copy; dcomplex* b_copy; int lda, inca; int ldb, incb; int ldc, incc; int lda_copy, inca_copy; int ldb_copy, incb_copy; int syr2k_needs_copya = FALSE; int syr2k_needs_copyb = FALSE; // Return early if possible. if ( bli_zero_dim2( m, k ) ) return; // If necessary, allocate, initialize, and use a temporary contiguous // copy of each matrix rather than the original matrices. bli_zcreate_contigmt( trans, m, k, a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_zcreate_contigmt( trans, m, k, b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_zcreate_contigmr( uplo, m, m, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); // Initialize with values assuming column-major storage. lda = a_cs; inca = a_rs; ldb = b_cs; incb = b_rs; ldc = c_cs; incc = c_rs; // Adjust the parameters based on the storage of each matrix. if ( bli_is_col_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_c * B_r' + B_r * A_c' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copyb = TRUE; } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_c' + B_c * A_r' // requested operation: uplo( C_c ) += A_c * B_c' + B_c * A_c' syr2k_needs_copya = TRUE; } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_c ) += A_r * B_r' + B_r * A_r' // requested operation: uplo( C_c ) += conj( A_c' * B_c + B_c' * A_c ) bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_trans( trans ); } } } else // if ( bli_is_row_storage( c_rs, c_cs ) ) { if ( bli_is_col_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_c' + B_c * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_c * B_r' + B_r * A_c' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copyb = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } } else // if ( bli_is_row_storage( a_rs, a_cs ) ) { if ( bli_is_col_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_c' + B_c * A_r' // requested operation: ~uplo( C_c ) += conj( A_c * B_c' + B_c * A_c' ) syr2k_needs_copya = TRUE; bli_swap_ints( ldc, incc ); bli_toggle_uplo( uplo ); } else // if ( bli_is_row_storage( b_rs, b_cs ) ) { // requested operation: uplo( C_r ) += A_r * B_r' + B_r * A_r' // requested operation: ~uplo( C_c ) += A_c' * B_c + B_c' * A_c bli_swap_ints( ldc, incc ); bli_swap_ints( lda, inca ); bli_swap_ints( ldb, incb ); bli_toggle_uplo( uplo ); bli_toggle_trans( trans ); } } } a_copy = a; lda_copy = lda; inca_copy = inca; // There are two cases where we need to copy A column-major storage. // We handle those two cases here. if ( syr2k_needs_copya ) { int m_a; int n_a; // Determine the dimensions of A according to the value of trans. We // need this in order to set the leading dimension of the copy of A. if ( bli_does_trans( trans ) ) { m_a = k; n_a = m; } else { m_a = m; n_a = k; } // We need a temporary matrix to hold a column-major copy of A. a_copy = bli_zallocm( m, k ); lda_copy = m_a; inca_copy = 1; // Copy the contents of A into A_copy. bli_zcopymt( BLIS_NO_TRANSPOSE, m_a, n_a, a, inca, lda, a_copy, inca_copy, lda_copy ); } b_copy = b; ldb_copy = ldb; incb_copy = incb; // There are two cases where we need to copy B column-major storage. // We handle those two cases here. if ( syr2k_needs_copyb ) { int m_b; int n_b; // Determine the dimensions of B according to the value of trans. We // need this in order to set the leading dimension of the copy of B. if ( bli_does_trans( trans ) ) { m_b = k; n_b = m; } else { m_b = m; n_b = k; } // We need a temporary matrix to hold a column-major copy of B. b_copy = bli_zallocm( m, k ); ldb_copy = m_b; incb_copy = 1; // Copy the contents of B into B_copy. bli_zcopymt( BLIS_NO_TRANSPOSE, m_b, n_b, b, incb, ldb, b_copy, incb_copy, ldb_copy ); } bli_zsyr2k_blas( uplo, trans, m, k, alpha, a_copy, lda_copy, b_copy, ldb_copy, beta, c, ldc ); if ( syr2k_needs_copya ) bli_zfree( a_copy ); if ( syr2k_needs_copyb ) bli_zfree( b_copy ); // Free any temporary contiguous matrices, copying the result back to // the original matrix. bli_zfree_contigm( a_save, a_rs_save, a_cs_save, &a, &a_rs, &a_cs ); bli_zfree_contigm( b_save, b_rs_save, b_cs_save, &b, &b_rs, &b_cs ); bli_zfree_saved_contigmr( uplo_save, m_save, m_save, c_save, c_rs_save, c_cs_save, &c, &c_rs, &c_cs ); }
void bli_zsyr2k_blas | ( | char | uplo, |
char | trans, | ||
int | m, | ||
int | k, | ||
dcomplex * | alpha, | ||
dcomplex * | a, | ||
int | lda, | ||
dcomplex * | b, | ||
int | ldb, | ||
dcomplex * | beta, | ||
dcomplex * | c, | ||
int | ldc | ||
) |
References bli_is_conjtrans(), bli_param_map_to_netlib_trans(), bli_param_map_to_netlib_uplo(), cblas_zsyr2k(), CblasColMajor, and F77_zsyr2k().
Referenced by bli_zsyr2k().
{ // BLAS doesn't recognize the conjugate-transposition constant for syr2k, // so we have to map it down to regular transposition. if ( bli_is_conjtrans( trans ) ) trans = BLIS_TRANSPOSE; #ifdef BLIS_ENABLE_CBLAS_INTERFACES enum CBLAS_ORDER cblas_order = CblasColMajor; enum CBLAS_UPLO cblas_uplo; enum CBLAS_TRANSPOSE cblas_trans; bli_param_map_to_netlib_uplo( uplo, &cblas_uplo ); bli_param_map_to_netlib_trans( trans, &cblas_trans ); cblas_zsyr2k( cblas_order, cblas_uplo, cblas_trans, m, k, alpha, a, lda, b, ldb, beta, c, ldc ); #else char blas_uplo; char blas_trans; bli_param_map_to_netlib_uplo( uplo, &blas_uplo ); bli_param_map_to_netlib_trans( trans, &blas_trans ); F77_zsyr2k( &blas_uplo, &blas_trans, &m, &k, alpha, a, &lda, b, &ldb, beta, c, &ldc ); #endif }