libflame revision_anchor
Functions
bli_her2.c File Reference

(r)

Functions

void bli_sher2 (char uplo, char conj, int m, float *alpha, float *x, int incx, float *y, int incy, float *a, int a_rs, int a_cs)
void bli_dher2 (char uplo, char conj, int m, double *alpha, double *x, int incx, double *y, int incy, double *a, int a_rs, int a_cs)
void bli_cher2 (char uplo, char conj, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int a_rs, int a_cs)
void bli_zher2 (char uplo, char conj, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int a_rs, int a_cs)
void bli_cher2_blas (char uplo, int m, scomplex *alpha, scomplex *x, int incx, scomplex *y, int incy, scomplex *a, int lda)
void bli_zher2_blas (char uplo, int m, dcomplex *alpha, dcomplex *x, int incx, dcomplex *y, int incy, dcomplex *a, int lda)

Function Documentation

void bli_cher2 ( char  uplo,
char  conj,
int  m,
scomplex alpha,
scomplex x,
int  incx,
scomplex y,
int  incy,
scomplex a,
int  a_rs,
int  a_cs 
)

References bli_callocv(), bli_ccopyv(), bli_ccreate_contigmr(), bli_cfree(), bli_cfree_saved_contigm(), bli_cher2_blas(), bli_is_conj(), bli_is_row_storage(), and bli_zero_dim1().

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().

{
    int       m_save    = m;
    scomplex* a_save    = a;
    int       a_rs_save = a_rs;
    int       a_cs_save = a_cs;
    scomplex* x_conj;
    scomplex* y_conj;
    int       incx_conj;
    int       incy_conj;
    int       lda, inca;

    // Return early if possible.
    if ( bli_zero_dim1( m ) ) return;

    // If necessary, allocate, initialize, and use a temporary contiguous
    // copy of the matrix rather than the original matrix.
    bli_ccreate_contigmr( uplo,
                          m,
                          m,
                          a_save, a_rs_save, a_cs_save,
                          &a,     &a_rs,     &a_cs );

    // Initialize with values assuming column-major storage.
    lda  = a_cs;
    inca = a_rs;

    // If A is a row-major matrix, then we can use the underlying column-major
    // BLAS implementation by fiddling with the parameters.
    if ( bli_is_row_storage( a_rs, a_cs ) )
    {
        bli_swap_ints( lda, inca );
        bli_toggle_uplo( uplo );
        bli_toggle_conj( conj );
    }

    // Initialize with values assuming no conjugation of ( x * y' ) or
    // ( y * x' ).
    x_conj    = x;
    incx_conj = incx;
    y_conj    = y;
    incy_conj = incy;

    // We want to handle the case where ( x * y' ) and ( y * x' ) are
    // conjugated, but without explicitly conjugating the matrices. To do
    // so, we leverage the fact that computing the products conj( x * y' )
    // and conj( y * x' ) is equivalent to computing ( conj(x) * conj(y)' )
    // and ( conj(y) * conj(x)' ), respectively.
    if ( bli_is_conj( conj ) )
    {
        x_conj    = bli_callocv( m );
        incx_conj = 1;

        y_conj    = bli_callocv( m );
        incy_conj = 1;

        bli_ccopyv( BLIS_CONJUGATE,
                    m,
                    x,      incx,
                    x_conj, incx_conj );

        bli_ccopyv( BLIS_CONJUGATE,
                    m,
                    y,      incy,
                    y_conj, incy_conj );
    }

    bli_cher2_blas( uplo,
                    m,
                    alpha,
                    x_conj, incx_conj,
                    y_conj, incy_conj,
                    a,      lda );

    // Free the temporary conjugated x and y vectors.
    if ( bli_is_conj( conj ) )
    {
        bli_cfree( x_conj );
        bli_cfree( y_conj );
    }

    // Free the temporary contiguous matrix.
    bli_cfree_saved_contigm( m_save,
                             m_save,
                             a_save, a_rs_save, a_cs_save,
                             &a,     &a_rs,     &a_cs );
}
void bli_cher2_blas ( char  uplo,
int  m,
scomplex alpha,
scomplex x,
int  incx,
scomplex y,
int  incy,
scomplex a,
int  lda 
)

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

Referenced by bli_cher2().

{
#ifdef BLIS_ENABLE_CBLAS_INTERFACES
    enum CBLAS_ORDER cblas_order = CblasColMajor;
    enum CBLAS_UPLO  cblas_uplo;

    bli_param_map_to_netlib_uplo( uplo, &cblas_uplo );

    cblas_cher2( cblas_order,
                 cblas_uplo,
                 m,
                 alpha,
                 x, incx,
                 y, incy,
                 a, lda );
#else
    char blas_uplo;

    bli_param_map_to_netlib_uplo( uplo, &blas_uplo );

    F77_cher2( &uplo,
               &m,
               alpha,
               x, &incx,
               y, &incy,
               a, &lda );
#endif
}
void bli_dher2 ( char  uplo,
char  conj,
int  m,
double *  alpha,
double *  x,
int  incx,
double *  y,
int  incy,
double *  a,
int  a_rs,
int  a_cs 
)
void bli_sher2 ( char  uplo,
char  conj,
int  m,
float *  alpha,
float *  x,
int  incx,
float *  y,
int  incy,
float *  a,
int  a_rs,
int  a_cs 
)
void bli_zher2 ( char  uplo,
char  conj,
int  m,
dcomplex alpha,
dcomplex x,
int  incx,
dcomplex y,
int  incy,
dcomplex a,
int  a_rs,
int  a_cs 
)

References bli_is_conj(), bli_is_row_storage(), bli_zallocv(), bli_zcopyv(), bli_zcreate_contigmr(), bli_zero_dim1(), bli_zfree(), bli_zfree_saved_contigm(), and bli_zher2_blas().

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().

{
    int       m_save    = m;
    dcomplex* a_save    = a;
    int       a_rs_save = a_rs;
    int       a_cs_save = a_cs;
    dcomplex* x_conj;
    dcomplex* y_conj;
    int       incx_conj;
    int       incy_conj;
    int       lda, inca;

    // Return early if possible.
    if ( bli_zero_dim1( m ) ) return;

    // If necessary, allocate, initialize, and use a temporary contiguous
    // copy of the matrix rather than the original matrix.
    bli_zcreate_contigmr( uplo,
                          m,
                          m,
                          a_save, a_rs_save, a_cs_save,
                          &a,     &a_rs,     &a_cs );

    // Initialize with values assuming column-major storage.
    lda  = a_cs;
    inca = a_rs;

    // If A is a row-major matrix, then we can use the underlying column-major
    // BLAS implementation by fiddling with the parameters.
    if ( bli_is_row_storage( a_rs, a_cs ) )
    {
        bli_swap_ints( lda, inca );
        bli_toggle_uplo( uplo );
        bli_toggle_conj( conj );
    }

    // Initialize with values assuming no conjugation of ( x * y' ) or
    // ( y * x' ).
    x_conj    = x;
    incx_conj = incx;
    y_conj    = y;
    incy_conj = incy;

    // We want to handle the case where ( x * y' ) and ( y * x' ) are
    // conjugated, but without explicitly conjugating the matrices. To do
    // so, we leverage the fact that computing the products conj( x * y' )
    // and conj( y * x' ) is equivalent to computing ( conj(x) * conj(y)' )
    // and ( conj(y) * conj(x)' ), respectively.
    if ( bli_is_conj( conj ) )
    {
        x_conj    = bli_zallocv( m );
        incx_conj = 1;

        y_conj    = bli_zallocv( m );
        incy_conj = 1;

        bli_zcopyv( BLIS_CONJUGATE,
                    m,
                    x,      incx,
                    x_conj, incx_conj );

        bli_zcopyv( BLIS_CONJUGATE,
                    m,
                    y,      incy,
                    y_conj, incy_conj );
    }

    bli_zher2_blas( uplo,
                    m,
                    alpha,
                    x_conj, incx_conj,
                    y_conj, incy_conj,
                    a,      lda );

    // Free the temporary conjugated x and y vectors.
    if ( bli_is_conj( conj ) )
    {
        bli_zfree( x_conj );
        bli_zfree( y_conj );
    }

    // Free the temporary contiguous matrix.
    bli_zfree_saved_contigm( m_save,
                             m_save,
                             a_save, a_rs_save, a_cs_save,
                             &a,     &a_rs,     &a_cs );
}
void bli_zher2_blas ( char  uplo,
int  m,
dcomplex alpha,
dcomplex x,
int  incx,
dcomplex y,
int  incy,
dcomplex a,
int  lda 
)

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

Referenced by bli_zher2().

{
#ifdef BLIS_ENABLE_CBLAS_INTERFACES
    enum CBLAS_ORDER cblas_order = CblasColMajor;
    enum CBLAS_UPLO  cblas_uplo;

    bli_param_map_to_netlib_uplo( uplo, &cblas_uplo );

    cblas_zher2( cblas_order,
                 cblas_uplo,
                 m,
                 alpha,
                 x, incx,
                 y, incy,
                 a, lda );
#else
    char blas_uplo;

    bli_param_map_to_netlib_uplo( uplo, &blas_uplo );

    F77_zher2( &uplo,
               &m,
               alpha,
               x, &incx,
               y, &incy,
               a, &lda );
#endif
}