libflame  revision_anchor
Functions
bli_axpymrt.c File Reference

(r)

Functions

void bli_saxpymrt (uplo_t uplo, trans_t trans, int m, int n, float *alpha, float *a, int a_rs, int a_cs, float *b, int b_rs, int b_cs)
void bli_daxpymrt (uplo_t uplo, trans_t trans, int m, int n, double *alpha, double *a, int a_rs, int a_cs, double *b, int b_rs, int b_cs)
void bli_caxpymrt (uplo_t uplo, trans_t trans, int m, int n, scomplex *alpha, scomplex *a, int a_rs, int a_cs, scomplex *b, int b_rs, int b_cs)
void bli_zaxpymrt (uplo_t uplo, trans_t trans, int m, int n, dcomplex *alpha, dcomplex *a, int a_rs, int a_cs, dcomplex *b, int b_rs, int b_cs)

Function Documentation

void bli_caxpymrt ( uplo_t  uplo,
trans_t  trans,
int  m,
int  n,
scomplex alpha,
scomplex a,
int  a_rs,
int  a_cs,
scomplex b,
int  b_rs,
int  b_cs 
)

References bli_caxpyv(), bli_does_trans(), bli_is_col_storage(), bli_is_lower(), bli_proj_trans_to_conj(), and bli_zero_dim2().

Referenced by bli_cher2k(), bli_cherk(), and FLA_Axpyrt_external().

{
    scomplex* a_begin;
    scomplex* b_begin;
    int       lda, inca;
    int       ldb, incb;
    int       n_iter;
    int       n_elem;
    int       n_elem_max;
    int       n_elem_is_descending;
    int       j;
    conj_t    conj;

    // Return early if possible.
    if ( bli_zero_dim2( m, n ) ) return;

    // Initialize variables based on storage format of B and value of uplo.
    if      ( bli_is_col_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = m;
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = TRUE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = n;
            n_elem_max = bli_min( m, n );
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = FALSE;
        }
    }
    else // if ( bli_is_row_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = m;
            n_elem_max = bli_min( m, n );
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = FALSE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = n;
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = TRUE;
        }
    }

    // Swap lda and inca if we're doing a transpose.
    if ( bli_does_trans( trans ) )
    {
        bli_swap_ints( lda, inca );
    }

    // Extract conj component from trans parameter.
    conj = bli_proj_trans_to_conj( trans );

    // Choose the loop based on whether n_elem will be shrinking or growing
    // with each iteration.
    if ( n_elem_is_descending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = n_elem_max - j;
            a_begin = a + j*lda + j*inca;
            b_begin = b + j*ldb + j*incb;
        
            bli_caxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
    else // if ( n_elem_is_ascending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = bli_min( j + 1, n_elem_max );
            a_begin = a + j*lda;
            b_begin = b + j*ldb;
        
            bli_caxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
}
void bli_daxpymrt ( uplo_t  uplo,
trans_t  trans,
int  m,
int  n,
double *  alpha,
double *  a,
int  a_rs,
int  a_cs,
double *  b,
int  b_rs,
int  b_cs 
)

References bli_daxpyv(), bli_does_trans(), bli_is_col_storage(), bli_is_lower(), bli_proj_trans_to_conj(), and bli_zero_dim2().

Referenced by FLA_Axpyrt_external().

{
    double*   a_begin;
    double*   b_begin;
    int       lda, inca;
    int       ldb, incb;
    int       n_iter;
    int       n_elem;
    int       n_elem_max;
    int       n_elem_is_descending;
    int       j;
    conj_t    conj;

    // Return early if possible.
    if ( bli_zero_dim2( m, n ) ) return;

    // Initialize variables based on storage format of B and value of uplo.
    if      ( bli_is_col_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = m;
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = TRUE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = n;
            n_elem_max = bli_min( m, n );
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = FALSE;
        }
    }
    else // if ( bli_is_row_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = m;
            n_elem_max = bli_min( m, n );
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = FALSE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = n;
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = TRUE;
        }
    }

    // Swap lda and inca if we're doing a transpose.
    if ( bli_does_trans( trans ) )
    {
        bli_swap_ints( lda, inca );
    }

    // Extract conj component from trans parameter.
    conj = bli_proj_trans_to_conj( trans );

    // Choose the loop based on whether n_elem will be shrinking or growing
    // with each iteration.
    if ( n_elem_is_descending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = n_elem_max - j;
            a_begin = a + j*lda + j*inca;
            b_begin = b + j*ldb + j*incb;
        
            bli_daxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
    else // if ( n_elem_is_ascending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = bli_min( j + 1, n_elem_max );
            a_begin = a + j*lda;
            b_begin = b + j*ldb;
        
            bli_daxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
}
void bli_saxpymrt ( uplo_t  uplo,
trans_t  trans,
int  m,
int  n,
float *  alpha,
float *  a,
int  a_rs,
int  a_cs,
float *  b,
int  b_rs,
int  b_cs 
)

References bli_does_trans(), bli_is_col_storage(), bli_is_lower(), bli_proj_trans_to_conj(), bli_saxpyv(), and bli_zero_dim2().

Referenced by FLA_Axpyrt_external().

{
    float*    a_begin;
    float*    b_begin;
    int       lda, inca;
    int       ldb, incb;
    int       n_iter;
    int       n_elem;
    int       n_elem_max;
    int       n_elem_is_descending;
    int       j;
    conj_t    conj;

    // Return early if possible.
    if ( bli_zero_dim2( m, n ) ) return;

    // Initialize variables based on storage format of B and value of uplo.
    if      ( bli_is_col_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = m;
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = TRUE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = n;
            n_elem_max = bli_min( m, n );
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = FALSE;
        }
    }
    else // if ( bli_is_row_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = m;
            n_elem_max = bli_min( m, n );
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = FALSE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = n;
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = TRUE;
        }
    }

    // Swap lda and inca if we're doing a transpose.
    if ( bli_does_trans( trans ) )
    {
        bli_swap_ints( lda, inca );
    }

    // Extract conj component from trans parameter.
    conj = bli_proj_trans_to_conj( trans );

    // Choose the loop based on whether n_elem will be shrinking or growing
    // with each iteration.
    if ( n_elem_is_descending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = n_elem_max - j;
            a_begin = a + j*lda + j*inca;
            b_begin = b + j*ldb + j*incb;
        
            bli_saxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
    else // if ( n_elem_is_ascending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = bli_min( j + 1, n_elem_max );
            a_begin = a + j*lda;
            b_begin = b + j*ldb;
        
            bli_saxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
}
void bli_zaxpymrt ( uplo_t  uplo,
trans_t  trans,
int  m,
int  n,
dcomplex alpha,
dcomplex a,
int  a_rs,
int  a_cs,
dcomplex b,
int  b_rs,
int  b_cs 
)

References bli_does_trans(), bli_is_col_storage(), bli_is_lower(), bli_proj_trans_to_conj(), bli_zaxpyv(), and bli_zero_dim2().

Referenced by bli_zher2k(), bli_zherk(), and FLA_Axpyrt_external().

{
    dcomplex* a_begin;
    dcomplex* b_begin;
    int       lda, inca;
    int       ldb, incb;
    int       n_iter;
    int       n_elem;
    int       n_elem_max;
    int       n_elem_is_descending;
    int       j;
    conj_t    conj;

    // Return early if possible.
    if ( bli_zero_dim2( m, n ) ) return;

    // Initialize variables based on storage format of B and value of uplo.
    if      ( bli_is_col_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = m;
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = TRUE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = n;
            n_elem_max = bli_min( m, n );
            lda        = a_cs;
            inca       = a_rs;
            ldb        = b_cs;
            incb       = b_rs;
            n_elem_is_descending = FALSE;
        }
    }
    else // if ( bli_is_row_storage( b_rs, b_cs ) )
    {
        if ( bli_is_lower( uplo ) )
        {
            n_iter     = m;
            n_elem_max = bli_min( m, n );
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = FALSE;
        }
        else // if ( bli_is_upper( uplo ) )
        {
            n_iter     = bli_min( m, n );
            n_elem_max = n;
            lda        = a_rs;
            inca       = a_cs;
            ldb        = b_rs;
            incb       = b_cs;
            n_elem_is_descending = TRUE;
        }
    }

    // Swap lda and inca if we're doing a transpose.
    if ( bli_does_trans( trans ) )
    {
        bli_swap_ints( lda, inca );
    }

    // Extract conj component from trans parameter.
    conj = bli_proj_trans_to_conj( trans );

    // Choose the loop based on whether n_elem will be shrinking or growing
    // with each iteration.
    if ( n_elem_is_descending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = n_elem_max - j;
            a_begin = a + j*lda + j*inca;
            b_begin = b + j*ldb + j*incb;
        
            bli_zaxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
    else // if ( n_elem_is_ascending )
    {
        for ( j = 0; j < n_iter; j++ )
        {
            n_elem  = bli_min( j + 1, n_elem_max );
            a_begin = a + j*lda;
            b_begin = b + j*ldb;
        
            bli_zaxpyv( conj,
                        n_elem,
                        alpha,
                        a_begin, inca,
                        b_begin, incb );
        }
    }
}