本文整理汇总了C++中FLA_Obj_length函数的典型用法代码示例。如果您正苦于以下问题:C++ FLA_Obj_length函数的具体用法?C++ FLA_Obj_length怎么用?C++ FLA_Obj_length使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLA_Obj_length函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FLA_LU_nopiv_opt_var2
FLA_Error FLA_LU_nopiv_opt_var2( FLA_Obj A )
{
FLA_Datatype datatype;
int m_A, n_A;
int rs_A, cs_A;
datatype = FLA_Obj_datatype( A );
m_A = FLA_Obj_length( A );
n_A = FLA_Obj_width( A );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
switch ( datatype )
{
case FLA_FLOAT:
{
float* buff_A = FLA_FLOAT_PTR( A );
FLA_LU_nopiv_ops_var2( m_A,
n_A,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE:
{
double* buff_A = FLA_DOUBLE_PTR( A );
FLA_LU_nopiv_opd_var2( m_A,
n_A,
buff_A, rs_A, cs_A );
break;
}
case FLA_COMPLEX:
{
scomplex* buff_A = FLA_COMPLEX_PTR( A );
FLA_LU_nopiv_opc_var2( m_A,
n_A,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE_COMPLEX:
{
dcomplex* buff_A = FLA_DOUBLE_COMPLEX_PTR( A );
FLA_LU_nopiv_opz_var2( m_A,
n_A,
buff_A, rs_A, cs_A );
break;
}
}
return FLA_SUCCESS;
}
示例2: FLA_Tridiag_UT_l_step_opt_var2
FLA_Error FLA_Tridiag_UT_l_step_opt_var2( FLA_Obj A, FLA_Obj T )
{
FLA_Datatype datatype;
int m_A, m_T;
int rs_A, cs_A;
int rs_T, cs_T;
datatype = FLA_Obj_datatype( A );
m_A = FLA_Obj_length( A );
m_T = FLA_Obj_length( T );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
rs_T = FLA_Obj_row_stride( T );
cs_T = FLA_Obj_col_stride( T );
switch ( datatype )
{
case FLA_FLOAT:
{
float* buff_A = FLA_FLOAT_PTR( A );
float* buff_T = FLA_FLOAT_PTR( T );
FLA_Tridiag_UT_l_step_ops_var2( m_A,
m_T,
buff_A, rs_A, cs_A,
buff_T, rs_T, cs_T );
break;
}
case FLA_DOUBLE:
{
double* buff_A = FLA_DOUBLE_PTR( A );
double* buff_T = FLA_DOUBLE_PTR( T );
FLA_Tridiag_UT_l_step_opd_var2( m_A,
m_T,
buff_A, rs_A, cs_A,
buff_T, rs_T, cs_T );
break;
}
case FLA_COMPLEX:
{
scomplex* buff_A = FLA_COMPLEX_PTR( A );
scomplex* buff_T = FLA_COMPLEX_PTR( T );
FLA_Tridiag_UT_l_step_opc_var2( m_A,
m_T,
buff_A, rs_A, cs_A,
buff_T, rs_T, cs_T );
break;
}
case FLA_DOUBLE_COMPLEX:
{
dcomplex* buff_A = FLA_DOUBLE_COMPLEX_PTR( A );
dcomplex* buff_T = FLA_DOUBLE_COMPLEX_PTR( T );
FLA_Tridiag_UT_l_step_opz_var2( m_A,
m_T,
buff_A, rs_A, cs_A,
buff_T, rs_T, cs_T );
break;
}
}
return FLA_SUCCESS;
}
示例3: FLA_Obj_equals
FLA_Bool FLA_Obj_equals( FLA_Obj A, FLA_Obj B )
{
FLA_Datatype datatype_A;
FLA_Datatype datatype_B;
FLA_Datatype datatype;
dim_t m, n;
dim_t rs_A, cs_A;
dim_t rs_B, cs_B;
dim_t i, j;
if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
FLA_Obj_equals_check( A, B );
m = FLA_Obj_length( A );
n = FLA_Obj_width( A );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
rs_B = FLA_Obj_row_stride( B );
cs_B = FLA_Obj_col_stride( B );
datatype_A = FLA_Obj_datatype( A );
datatype_B = FLA_Obj_datatype( B );
// If A is a non-FLA_CONSTANT object, then we should proceed based on the
// value of datatype_A. In such a situation, either datatype_B is an exact
// match and we're fine, or datatype_B is FLA_CONSTANT, in which case we're
// also covered since FLA_CONSTANT encompassas all numerical types.
// If A is an FLA_CONSTANT object, then we should proceed based on the value
// of datatype_B. In this case, datatype_B is either a non-FLA_CONSTANT type,
// which mirrors the second sub-case above, or datatype_B is FLA_CONSTANT,
// in which case both types are FLA_CONSTANT and therefore we have to handle
// that case. Only if both are FLA_CONSTANTs does the FLA_CONSTANT case
// statement below execute.
if ( datatype_A != FLA_CONSTANT )
datatype = datatype_A;
else
datatype = datatype_B;
switch ( datatype )
{
case FLA_CONSTANT:
{
// We require ALL floating-point fields to be the same.
float* buffs_A = ( float * ) FLA_FLOAT_PTR( A );
float* buffs_B = ( float * ) FLA_FLOAT_PTR( B );
double* buffd_A = ( double * ) FLA_DOUBLE_PTR( A );
double* buffd_B = ( double * ) FLA_DOUBLE_PTR( B );
scomplex* buffc_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
scomplex* buffc_B = ( scomplex * ) FLA_COMPLEX_PTR( B );
dcomplex* buffz_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
dcomplex* buffz_B = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( B );
if ( *buffs_A != *buffs_B ||
*buffd_A != *buffd_B ||
buffc_A->real != buffc_B->real ||
buffc_A->imag != buffc_B->imag ||
buffz_A->real != buffz_B->real ||
buffz_A->imag != buffz_B->imag )
{
return FALSE;
}
break;
}
case FLA_INT:
{
int *buff_A = ( int * ) FLA_INT_PTR( A );
int *buff_B = ( int * ) FLA_INT_PTR( B );
for ( j = 0; j < n; j++ )
for ( i = 0; i < m; i++ )
if ( buff_A[ j * cs_A + i * rs_A ] !=
buff_B[ j * cs_B + i * rs_B ] )
{
return FALSE;
}
break;
}
case FLA_FLOAT:
{
float *buff_A = ( float * ) FLA_FLOAT_PTR( A );
float *buff_B = ( float * ) FLA_FLOAT_PTR( B );
for ( j = 0; j < n; j++ )
for ( i = 0; i < m; i++ )
if ( buff_A[ j * cs_A + i * rs_A ] !=
buff_B[ j * cs_B + i * rs_B ] )
{
return FALSE;
}
break;
}
case FLA_DOUBLE:
{
double *buff_A = ( double * ) FLA_DOUBLE_PTR( A );
//.........这里部分代码省略.........
示例4: FLA_Syr2k_ln_blk_var4
FLA_Error FLA_Syr2k_ln_blk_var4( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C, fla_syr2k_t* cntl )
{
FLA_Obj AT, A0,
AB, A1,
A2;
FLA_Obj BT, B0,
BB, B1,
B2;
FLA_Obj CTL, CTR, C00, C01, C02,
CBL, CBR, C10, C11, C12,
C20, C21, C22;
dim_t b;
FLA_Scalr_internal( FLA_LOWER_TRIANGULAR, beta, C,
FLA_Cntl_sub_scalr( cntl ) );
FLA_Part_2x1( A, &AT,
&AB, 0, FLA_TOP );
FLA_Part_2x1( B, &BT,
&BB, 0, FLA_TOP );
FLA_Part_2x2( C, &CTL, &CTR,
&CBL, &CBR, 0, 0, FLA_TL );
while ( FLA_Obj_length( AT ) < FLA_Obj_length( A ) ){
b = FLA_Determine_blocksize( AB, FLA_BOTTOM, FLA_Cntl_blocksize( cntl ) );
FLA_Repart_2x1_to_3x1( AT, &A0,
/* ** */ /* ** */
&A1,
AB, &A2, b, FLA_BOTTOM );
FLA_Repart_2x1_to_3x1( BT, &B0,
/* ** */ /* ** */
&B1,
BB, &B2, b, FLA_BOTTOM );
FLA_Repart_2x2_to_3x3( CTL, /**/ CTR, &C00, /**/ &C01, &C02,
/* ************* */ /* ******************** */
&C10, /**/ &C11, &C12,
CBL, /**/ CBR, &C20, /**/ &C21, &C22,
b, b, FLA_BR );
/*------------------------------------------------------------*/
/* C21 = C21 + A2 * B1' */
FLA_Gemm_internal( FLA_NO_TRANSPOSE, FLA_TRANSPOSE,
alpha, A2, B1, FLA_ONE, C21,
FLA_Cntl_sub_gemm1( cntl ) );
/* C21 = C21 + B2 * A1' */
FLA_Gemm_internal( FLA_NO_TRANSPOSE, FLA_TRANSPOSE,
alpha, B2, A1, FLA_ONE, C21,
FLA_Cntl_sub_gemm2( cntl ) );
/* C11 = C11 + A1 * B1' + B1 * A1' */
FLA_Syr2k_internal( FLA_LOWER_TRIANGULAR, FLA_NO_TRANSPOSE,
alpha, A1, B1, FLA_ONE, C11,
FLA_Cntl_sub_syr2k( cntl ) );
/*------------------------------------------------------------*/
FLA_Cont_with_3x1_to_2x1( &AT, A0,
A1,
/* ** */ /* ** */
&AB, A2, FLA_TOP );
FLA_Cont_with_3x1_to_2x1( &BT, B0,
B1,
/* ** */ /* ** */
&BB, B2, FLA_TOP );
FLA_Cont_with_3x3_to_2x2( &CTL, /**/ &CTR, C00, C01, /**/ C02,
C10, C11, /**/ C12,
/* ************** */ /* ****************** */
&CBL, /**/ &CBR, C20, C21, /**/ C22,
FLA_TL );
}
return FLA_SUCCESS;
}
示例5: FLA_Symm_ll_unb_var2
FLA_Error FLA_Symm_ll_unb_var2( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C )
{
FLA_Obj ATL, ATR, A00, a01, A02,
ABL, ABR, a10t, alpha11, a12t,
A20, a21, A22;
FLA_Obj BT, B0,
BB, b1t,
B2;
FLA_Obj CT, C0,
CB, c1t,
C2;
FLA_Scal_external( beta, C );
FLA_Part_2x2( A, &ATL, &ATR,
&ABL, &ABR, 0, 0, FLA_TL );
FLA_Part_2x1( B, &BT,
&BB, 0, FLA_TOP );
FLA_Part_2x1( C, &CT,
&CB, 0, FLA_TOP );
while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){
FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02,
/* ************* */ /* ************************** */
&a10t, /**/ &alpha11, &a12t,
ABL, /**/ ABR, &A20, /**/ &a21, &A22,
1, 1, FLA_BR );
FLA_Repart_2x1_to_3x1( BT, &B0,
/* ** */ /* ** */
&b1t,
BB, &B2, 1, FLA_BOTTOM );
FLA_Repart_2x1_to_3x1( CT, &C0,
/* ** */ /* ** */
&c1t,
CB, &C2, 1, FLA_BOTTOM );
/*------------------------------------------------------------*/
/* c1t = c1t + a10t * B0 */
/* c1t' = c1t' + B0' * a10t' */
FLA_Gemv_external( FLA_TRANSPOSE, alpha, B0, a10t, FLA_ONE, c1t );
/* c1t = c1t + a21' * B2 */
/* c1t' = c1t' + B2' * a21 */
FLA_Gemv_external( FLA_TRANSPOSE, alpha, B2, a21, FLA_ONE, c1t );
/* c1t = c1t + alpha11 * b1t */
FLA_Axpys_external( alpha, alpha11, b1t, FLA_ONE, c1t );
/*------------------------------------------------------------*/
FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02,
a10t, alpha11, /**/ a12t,
/* ************** */ /* ************************ */
&ABL, /**/ &ABR, A20, a21, /**/ A22,
FLA_TL );
FLA_Cont_with_3x1_to_2x1( &BT, B0,
b1t,
/* ** */ /* ** */
&BB, B2, FLA_TOP );
FLA_Cont_with_3x1_to_2x1( &CT, C0,
c1t,
/* ** */ /* ** */
&CB, C2, FLA_TOP );
}
return FLA_SUCCESS;
}
示例6: FLA_Apply_G_rf_asm_var1
FLA_Error FLA_Apply_G_rf_asm_var1( FLA_Obj G, FLA_Obj A )
/*
Apply k sets of Givens rotations to a matrix A from the right,
where each set takes the form:
A := A ( G(n-1,k) ... G(1,k) G(0,k) )'
= A G(0,k)' G(1,k)' ... G(n-1,k)'
where Gik is the ith Givens rotation formed from the kth set,
stored in the (i,k) entries of of G:
Gik = / gamma_ik -sigma_ik \
\ sigma_ik gamma_ik /
This variant iterates naively and applies rotations to two columns
at a time.
-FGVZ
*/
{
FLA_Datatype datatype;
int k_G, m_A, n_A;
int rs_G, cs_G;
int rs_A, cs_A;
datatype = FLA_Obj_datatype( A );
k_G = FLA_Obj_width( G );
m_A = FLA_Obj_length( A );
n_A = FLA_Obj_width( A );
rs_G = FLA_Obj_row_stride( G );
cs_G = FLA_Obj_col_stride( G );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
switch ( datatype )
{
case FLA_FLOAT:
{
scomplex* buff_G = ( scomplex* ) FLA_COMPLEX_PTR( G );
float* buff_A = ( float* ) FLA_FLOAT_PTR( A );
FLA_Apply_G_rf_ass_var1( k_G,
m_A,
n_A,
buff_G, rs_G, cs_G,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE:
{
dcomplex* buff_G = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( G );
double* buff_A = ( double* ) FLA_DOUBLE_PTR( A );
FLA_Apply_G_rf_asd_var1( k_G,
m_A,
n_A,
buff_G, rs_G, cs_G,
buff_A, rs_A, cs_A );
break;
}
case FLA_COMPLEX:
{
scomplex* buff_G = ( scomplex* ) FLA_COMPLEX_PTR( G );
scomplex* buff_A = ( scomplex* ) FLA_COMPLEX_PTR( A );
FLA_Apply_G_rf_asc_var1( k_G,
m_A,
n_A,
buff_G, rs_G, cs_G,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE_COMPLEX:
{
dcomplex* buff_G = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( G );
dcomplex* buff_A = ( dcomplex* ) FLA_DOUBLE_COMPLEX_PTR( A );
FLA_Apply_G_rf_asz_var1( k_G,
m_A,
n_A,
buff_G, rs_G, cs_G,
buff_A, rs_A, cs_A );
break;
}
}
return FLA_SUCCESS;
}
示例7: FLA_Hevd_lv_var4_components
FLA_Error FLA_Hevd_lv_var4_components( dim_t n_iter_max, FLA_Obj A, FLA_Obj l, dim_t k_accum, dim_t b_alg,
double* dtime_tred, double* dtime_tevd, double* dtime_appq )
{
FLA_Error r_val = FLA_SUCCESS;
FLA_Uplo uplo = FLA_LOWER_TRIANGULAR;
FLA_Datatype dt;
FLA_Datatype dt_real;
FLA_Datatype dt_comp;
FLA_Obj T, r, d, e, G, R, W;
FLA_Obj d0, e0, ls, pu;
dim_t mn_A;
dim_t n_G = k_accum;
double dtime_temp;
mn_A = FLA_Obj_length( A );
dt = FLA_Obj_datatype( A );
dt_real = FLA_Obj_datatype_proj_to_real( A );
dt_comp = FLA_Obj_datatype_proj_to_complex( A );
*dtime_tred = 1;
*dtime_tevd = 1;
*dtime_appq = 1;
// If the matrix is a scalar, then the EVD is easy.
if ( mn_A == 1 )
{
FLA_Copy( A, l );
FLA_Set( FLA_ONE, A );
return FLA_SUCCESS;
}
// Create a matrix to hold block Householder transformations.
FLA_Tridiag_UT_create_T( A, &T );
// Create a vector to hold the realifying scalars.
FLA_Obj_create( dt, mn_A, 1, 0, 0, &r );
// Create vectors to hold the diagonal and sub-diagonal.
FLA_Obj_create( dt_real, mn_A, 1, 0, 0, &d );
FLA_Obj_create( dt_real, mn_A-1, 1, 0, 0, &e );
FLA_Obj_create( dt_real, mn_A, 1, 0, 0, &d0 );
FLA_Obj_create( dt_real, mn_A-1, 1, 0, 0, &e0 );
FLA_Obj_create( dt_real, mn_A, 1, 0, 0, &pu );
FLA_Obj_create( FLA_INT, mn_A, 1, 0, 0, &ls );
FLA_Obj_create( dt_comp, mn_A-1, n_G, 0, 0, &G );
FLA_Obj_create( dt_real, mn_A, mn_A, 0, 0, &R );
FLA_Obj_create( dt, mn_A, mn_A, 0, 0, &W );
dtime_temp = FLA_Clock();
{
// Reduce the matrix to tridiagonal form.
FLA_Tridiag_UT( uplo, A, T );
}
*dtime_tred = FLA_Clock() - dtime_temp;
// Apply scalars to rotate elements on the sub-diagonal to the real domain.
FLA_Tridiag_UT_realify( uplo, A, r );
// Extract the diagonal and sub-diagonal from A.
FLA_Tridiag_UT_extract_diagonals( uplo, A, d, e );
dtime_temp = FLA_Clock();
{
// Form Q, overwriting A.
FLA_Tridiag_UT_form_Q( uplo, A, T );
}
*dtime_appq = FLA_Clock() - dtime_temp;
// Apply the scalars in r to Q.
FLA_Apply_diag_matrix( FLA_RIGHT, FLA_CONJUGATE, r, A );
// Find the eigenvalues only.
FLA_Copy( d, d0 ); FLA_Copy( e, e0 );
//r_val = FLA_Tevd_n_opt_var1( n_iter_max, d0, e0, G, A );
{
int info;
double* buff_d = FLA_DOUBLE_PTR( d0 );
double* buff_e = FLA_DOUBLE_PTR( e0 );
dsterf_( &mn_A, buff_d, buff_e, &info );
}
FLA_Sort( FLA_FORWARD, d0 );
FLA_Set( FLA_ZERO, ls );
FLA_Set( FLA_ZERO, pu );
dtime_temp = FLA_Clock();
{
// Perform an eigenvalue decomposition on the tridiagonal matrix.
r_val = FLA_Tevd_v_opt_var4( n_iter_max, d, e, d0, ls, pu, G, R, W, A, b_alg );
}
*dtime_tevd = FLA_Clock() - dtime_temp;
// Copy the converged eigenvalues to the output vector.
FLA_Copy( d, l );
// Sort the eigenvalues and eigenvectors in ascending order.
FLA_Sort_evd( FLA_FORWARD, l, A );
FLA_Obj_free( &T );
FLA_Obj_free( &r );
//.........这里部分代码省略.........
示例8: FLA_Bidiag_blk_external
FLA_Error FLA_Bidiag_blk_external( FLA_Obj A, FLA_Obj tu, FLA_Obj tv )
{
int info = 0;
#ifdef FLA_ENABLE_EXTERNAL_LAPACK_INTERFACES
FLA_Datatype datatype;
int m_A, n_A, cs_A;
int min_m_n, max_m_n;
int lwork;
FLA_Obj d, e, work_obj;
if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
FLA_Bidiag_check( A, tu, tv );
if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
datatype = FLA_Obj_datatype( A );
m_A = FLA_Obj_length( A );
n_A = FLA_Obj_width( A );
min_m_n = FLA_Obj_min_dim( A );
max_m_n = FLA_Obj_max_dim( A );
cs_A = FLA_Obj_col_stride( A );
FLA_Obj_create( FLA_Obj_datatype_proj_to_real( A ), min_m_n, 1, 0, 0, &d );
FLA_Obj_create( FLA_Obj_datatype_proj_to_real( A ), min_m_n - 1, 1, 0, 0, &e );
lwork = (m_A + n_A) * FLA_Query_blocksize( datatype, FLA_DIMENSION_MIN );
FLA_Obj_create( datatype, lwork, 1, 0, 0, &work_obj );
switch( datatype ){
case FLA_FLOAT:
{
float* buff_A = ( float * ) FLA_FLOAT_PTR( A );
float* buff_d = ( float * ) FLA_FLOAT_PTR( d );
float* buff_e = ( float * ) FLA_FLOAT_PTR( e );
float* buff_tu = ( float * ) FLA_FLOAT_PTR( tu );
float* buff_tv = ( float * ) FLA_FLOAT_PTR( tv );
float* buff_work = ( float * ) FLA_FLOAT_PTR( work_obj );
F77_sgebrd( &m_A,
&n_A,
buff_A, &cs_A,
buff_d,
buff_e,
buff_tu,
buff_tv,
buff_work,
&lwork,
&info );
break;
}
case FLA_DOUBLE:
{
double* buff_A = ( double * ) FLA_DOUBLE_PTR( A );
double* buff_d = ( double * ) FLA_DOUBLE_PTR( d );
double* buff_e = ( double * ) FLA_DOUBLE_PTR( e );
double* buff_tu = ( double * ) FLA_DOUBLE_PTR( tu );
double* buff_tv = ( double * ) FLA_DOUBLE_PTR( tv );
double* buff_work = ( double * ) FLA_DOUBLE_PTR( work_obj );
F77_dgebrd( &m_A,
&n_A,
buff_A, &cs_A,
buff_d,
buff_e,
buff_tu,
buff_tv,
buff_work,
&lwork,
&info );
break;
}
case FLA_COMPLEX:
{
scomplex* buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
float* buff_d = ( float * ) FLA_FLOAT_PTR( d );
float* buff_e = ( float * ) FLA_FLOAT_PTR( e );
scomplex* buff_tu = ( scomplex * ) FLA_COMPLEX_PTR( tu );
scomplex* buff_tv = ( scomplex * ) FLA_COMPLEX_PTR( tv );
scomplex* buff_work = ( scomplex * ) FLA_COMPLEX_PTR( work_obj );
F77_cgebrd( &m_A,
&n_A,
buff_A, &cs_A,
buff_d,
buff_e,
buff_tu,
buff_tv,
buff_work,
&lwork,
&info );
break;
}
//.........这里部分代码省略.........
示例9: FLA_Svd_uv_var2_components
FLA_Error FLA_Svd_uv_var2_components( dim_t n_iter_max, dim_t k_accum, dim_t b_alg,
FLA_Obj A, FLA_Obj s, FLA_Obj U, FLA_Obj V,
double* dtime_bred, double* dtime_bsvd, double* dtime_appq,
double* dtime_qrfa, double* dtime_gemm )
{
FLA_Error r_val = FLA_SUCCESS;
FLA_Datatype dt;
FLA_Datatype dt_real;
FLA_Datatype dt_comp;
FLA_Obj T, S, rL, rR, d, e, G, H, RG, RH, W;
dim_t m_A, n_A;
dim_t min_m_n;
dim_t n_GH;
double crossover_ratio = 17.0 / 9.0;
double dtime_temp;
n_GH = k_accum;
m_A = FLA_Obj_length( A );
n_A = FLA_Obj_width( A );
min_m_n = FLA_Obj_min_dim( A );
dt = FLA_Obj_datatype( A );
dt_real = FLA_Obj_datatype_proj_to_real( A );
dt_comp = FLA_Obj_datatype_proj_to_complex( A );
// If the matrix is a scalar, then the SVD is easy.
if ( min_m_n == 1 )
{
FLA_Copy( A, s );
FLA_Set_to_identity( U );
FLA_Set_to_identity( V );
return FLA_SUCCESS;
}
// Create matrices to hold block Householder transformations.
FLA_Bidiag_UT_create_T( A, &T, &S );
// Create vectors to hold the realifying scalars.
FLA_Obj_create( dt, min_m_n, 1, 0, 0, &rL );
FLA_Obj_create( dt, min_m_n, 1, 0, 0, &rR );
// Create vectors to hold the diagonal and sub-diagonal.
FLA_Obj_create( dt_real, min_m_n, 1, 0, 0, &d );
FLA_Obj_create( dt_real, min_m_n-1, 1, 0, 0, &e );
// Create matrices to hold the left and right Givens scalars.
FLA_Obj_create( dt_comp, min_m_n-1, n_GH, 0, 0, &G );
FLA_Obj_create( dt_comp, min_m_n-1, n_GH, 0, 0, &H );
// Create matrices to hold the left and right Givens matrices.
FLA_Obj_create( dt_real, min_m_n, min_m_n, 0, 0, &RG );
FLA_Obj_create( dt_real, min_m_n, min_m_n, 0, 0, &RH );
FLA_Obj_create( dt, m_A, n_A, 0, 0, &W );
if ( m_A >= n_A )
{
if ( m_A < crossover_ratio * n_A )
{
dtime_temp = FLA_Clock();
{
// Reduce the matrix to bidiagonal form.
// Apply scalars to rotate elements on the sub-diagonal to the real domain.
// Extract the diagonal and sub-diagonal from A.
FLA_Bidiag_UT( A, T, S );
FLA_Bidiag_UT_realify( A, rL, rR );
FLA_Bidiag_UT_extract_diagonals( A, d, e );
}
*dtime_bred = FLA_Clock() - dtime_temp;
dtime_temp = FLA_Clock();
{
// Form U and V.
FLA_Bidiag_UT_form_U( A, T, U );
FLA_Bidiag_UT_form_V( A, S, V );
}
*dtime_appq = FLA_Clock() - dtime_temp;
// Apply the realifying scalars in rL and rR to U and V, respectively.
{
FLA_Obj UL, UR;
FLA_Obj VL, VR;
FLA_Part_1x2( U, &UL, &UR, min_m_n, FLA_LEFT );
FLA_Part_1x2( V, &VL, &VR, min_m_n, FLA_LEFT );
FLA_Apply_diag_matrix( FLA_RIGHT, FLA_CONJUGATE, rL, UL );
FLA_Apply_diag_matrix( FLA_RIGHT, FLA_NO_CONJUGATE, rR, VL );
}
dtime_temp = FLA_Clock();
{
// Perform a singular value decomposition on the bidiagonal matrix.
r_val = FLA_Bsvd_v_opt_var2( n_iter_max, d, e, G, H, RG, RH, W, U, V, b_alg );
}
*dtime_bsvd = FLA_Clock() - dtime_temp;
}
else // if ( crossover_ratio * n_A <= m_A )
{
FLA_Obj TQ, R;
//.........这里部分代码省略.........
示例10: FLA_Her_external
FLA_Error FLA_Her_external( FLA_Uplo uplo, FLA_Obj alpha, FLA_Obj x, FLA_Obj A )
{
FLA_Datatype datatype;
int m_A;
int rs_A, cs_A;
int inc_x;
uplo_t blis_uplo;
conj_t blis_conj;
if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
FLA_Her_check( uplo, alpha, x, A );
if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
datatype = FLA_Obj_datatype( A );
m_A = FLA_Obj_length( A );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
inc_x = FLA_Obj_vector_inc( x );
FLA_Param_map_flame_to_blis_uplo( uplo, &blis_uplo );
FLA_Param_map_flame_to_blis_conj( FLA_NO_CONJUGATE, &blis_conj );
switch( datatype ) {
case FLA_FLOAT:
{
float *buff_A = ( float * ) FLA_FLOAT_PTR( A );
float *buff_x = ( float * ) FLA_FLOAT_PTR( x );
float *buff_alpha = ( float * ) FLA_FLOAT_PTR( alpha );
bli_ssyr( blis_uplo,
m_A,
buff_alpha,
buff_x, inc_x,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE:
{
double *buff_A = ( double * ) FLA_DOUBLE_PTR( A );
double *buff_x = ( double * ) FLA_DOUBLE_PTR( x );
double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( alpha );
bli_dsyr( blis_uplo,
m_A,
buff_alpha,
buff_x, inc_x,
buff_A, rs_A, cs_A );
break;
}
case FLA_COMPLEX:
{
scomplex *buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
scomplex *buff_x = ( scomplex * ) FLA_COMPLEX_PTR( x );
float *buff_alpha = ( float * ) FLA_FLOAT_PTR( alpha );
bli_cher( blis_uplo,
blis_conj,
m_A,
buff_alpha,
buff_x, inc_x,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE_COMPLEX:
{
dcomplex *buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
dcomplex *buff_x = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( x );
double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( alpha );
bli_zher( blis_uplo,
blis_conj,
m_A,
buff_alpha,
buff_x, inc_x,
buff_A, rs_A, cs_A );
break;
}
}
return FLA_SUCCESS;
}
示例11: FLA_Copy_external
FLA_Error FLA_Copy_external( FLA_Obj A, FLA_Obj B )
{
FLA_Datatype dt_A;
FLA_Datatype dt_B;
int m_B, n_B;
int rs_A, cs_A;
int rs_B, cs_B;
trans_t blis_trans;
if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
FLA_Copy_check( A, B );
if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
dt_A = FLA_Obj_datatype( A );
dt_B = FLA_Obj_datatype( B );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
m_B = FLA_Obj_length( B );
n_B = FLA_Obj_width( B );
rs_B = FLA_Obj_row_stride( B );
cs_B = FLA_Obj_col_stride( B );
if ( FLA_Obj_is_conformal_to( FLA_NO_TRANSPOSE, A, B ) )
FLA_Param_map_flame_to_blis_trans( FLA_NO_TRANSPOSE, &blis_trans );
else // if ( FLA_Obj_is_conformal_to( FLA_TRANSPOSE, A, B ) )
FLA_Param_map_flame_to_blis_trans( FLA_TRANSPOSE, &blis_trans );
// If A is of type FLA_CONSTANT, then we have to proceed based on the
// datatype of B.
if ( dt_A == FLA_CONSTANT )
{
if ( dt_B == FLA_FLOAT )
{
float *buff_A = ( float * ) FLA_FLOAT_PTR( A );
float *buff_B = ( float * ) FLA_FLOAT_PTR( B );
bli_scopymt( blis_trans,
m_B,
n_B,
buff_A, rs_A, cs_A,
buff_B, rs_B, cs_B );
}
else if ( dt_B == FLA_DOUBLE )
{
double *buff_A = ( double * ) FLA_DOUBLE_PTR( A );
double *buff_B = ( double * ) FLA_DOUBLE_PTR( B );
bli_dcopymt( blis_trans,
m_B,
n_B,
buff_A, rs_A, cs_A,
buff_B, rs_B, cs_B );
}
else if ( dt_B == FLA_COMPLEX )
{
scomplex *buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
scomplex *buff_B = ( scomplex * ) FLA_COMPLEX_PTR( B );
bli_ccopymt( blis_trans,
m_B,
n_B,
buff_A, rs_A, cs_A,
buff_B, rs_B, cs_B );
}
else if ( dt_B == FLA_DOUBLE_COMPLEX )
{
dcomplex *buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
dcomplex *buff_B = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( B );
bli_zcopymt( blis_trans,
m_B,
n_B,
buff_A, rs_A, cs_A,
buff_B, rs_B, cs_B );
}
}
else if ( dt_A == FLA_INT )
{
int* buff_A = ( int * ) FLA_INT_PTR( A );
int* buff_B = ( int * ) FLA_INT_PTR( B );
bli_icopymt( blis_trans,
m_B,
n_B,
buff_A, rs_A, cs_A,
buff_B, rs_B, cs_B );
}
else if ( dt_A == FLA_FLOAT )
{
float *buff_A = ( float * ) FLA_FLOAT_PTR( A );
if ( dt_B == FLA_FLOAT )
{
float *buff_B = ( float * ) FLA_FLOAT_PTR( B );
bli_scopymt( blis_trans,
m_B,
//.........这里部分代码省略.........
示例12: FLA_Symm_ru_unb_var5
FLA_Error FLA_Symm_ru_unb_var5( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C )
{
FLA_Obj ATL, ATR, A00, a01, A02,
ABL, ABR, a10t, alpha11, a12t,
A20, a21, A22;
FLA_Obj BL, BR, B0, b1t, B2;
FLA_Obj CL, CR, C0, c1t, C2;
FLA_Scal_external( beta, C );
FLA_Part_2x2( A, &ATL, &ATR,
&ABL, &ABR, 0, 0, FLA_BR );
FLA_Part_1x2( B, &BL, &BR, 0, FLA_RIGHT );
FLA_Part_1x2( C, &CL, &CR, 0, FLA_RIGHT );
while ( FLA_Obj_length( ABR ) < FLA_Obj_length( A ) ){
FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, &a01, /**/ &A02,
&a10t, &alpha11, /**/ &a12t,
/* ************* */ /* ************************** */
ABL, /**/ ABR, &A20, &a21, /**/ &A22,
1, 1, FLA_TL );
FLA_Repart_1x2_to_1x3( BL, /**/ BR, &B0, &b1t, /**/ &B2,
1, FLA_LEFT );
FLA_Repart_1x2_to_1x3( CL, /**/ CR, &C0, &c1t, /**/ &C2,
1, FLA_LEFT );
/*------------------------------------------------------------*/
/* c1t = c1t + b1t * alpha11 */
FLA_Axpys_external( alpha, alpha11, b1t, FLA_ONE, c1t );
/* c1t = c1t + B2 * a12t' */
FLA_Gemv_external( FLA_NO_TRANSPOSE, alpha, B2, a12t, FLA_ONE, c1t );
/* C2 = C2 + b1t * a12t */
FLA_Ger_external( alpha, b1t, a12t, C2 );
/*------------------------------------------------------------*/
FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, /**/ a01, A02,
/* ************** */ /* ************************ */
a10t, /**/ alpha11, a12t,
&ABL, /**/ &ABR, A20, /**/ a21, A22,
FLA_BR );
FLA_Cont_with_1x3_to_1x2( &BL, /**/ &BR, B0, /**/ b1t, B2,
FLA_RIGHT );
FLA_Cont_with_1x3_to_1x2( &CL, /**/ &CR, C0, /**/ c1t, C2,
FLA_RIGHT );
}
return FLA_SUCCESS;
}
示例13: FLA_Fused_Gerc2_opt_var1
FLA_Error FLA_Fused_Gerc2_opt_var1( FLA_Obj alpha, FLA_Obj u, FLA_Obj y, FLA_Obj z, FLA_Obj v, FLA_Obj A )
{
/*
Effective computation:
A = A + alpha * ( u * y' + z * v' );
*/
FLA_Datatype datatype;
int m_A, n_A;
int rs_A, cs_A;
int inc_u, inc_y, inc_z, inc_v;
datatype = FLA_Obj_datatype( A );
m_A = FLA_Obj_length( A );
n_A = FLA_Obj_width( A );
rs_A = FLA_Obj_row_stride( A );
cs_A = FLA_Obj_col_stride( A );
inc_u = FLA_Obj_vector_inc( u );
inc_y = FLA_Obj_vector_inc( y );
inc_z = FLA_Obj_vector_inc( z );
inc_v = FLA_Obj_vector_inc( v );
switch ( datatype )
{
case FLA_FLOAT:
{
float* buff_A = FLA_FLOAT_PTR( A );
float* buff_u = FLA_FLOAT_PTR( u );
float* buff_y = FLA_FLOAT_PTR( y );
float* buff_z = FLA_FLOAT_PTR( z );
float* buff_v = FLA_FLOAT_PTR( v );
float* buff_alpha = FLA_FLOAT_PTR( alpha );
FLA_Fused_Gerc2_ops_var1( m_A,
n_A,
buff_alpha,
buff_u, inc_u,
buff_y, inc_y,
buff_z, inc_z,
buff_v, inc_v,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE:
{
double* buff_A = FLA_DOUBLE_PTR( A );
double* buff_u = FLA_DOUBLE_PTR( u );
double* buff_y = FLA_DOUBLE_PTR( y );
double* buff_z = FLA_DOUBLE_PTR( z );
double* buff_v = FLA_DOUBLE_PTR( v );
double* buff_alpha = FLA_DOUBLE_PTR( alpha );
FLA_Fused_Gerc2_opd_var1( m_A,
n_A,
buff_alpha,
buff_u, inc_u,
buff_y, inc_y,
buff_z, inc_z,
buff_v, inc_v,
buff_A, rs_A, cs_A );
break;
}
case FLA_COMPLEX:
{
scomplex* buff_A = FLA_COMPLEX_PTR( A );
scomplex* buff_u = FLA_COMPLEX_PTR( u );
scomplex* buff_y = FLA_COMPLEX_PTR( y );
scomplex* buff_z = FLA_COMPLEX_PTR( z );
scomplex* buff_v = FLA_COMPLEX_PTR( v );
scomplex* buff_alpha = FLA_COMPLEX_PTR( alpha );
FLA_Fused_Gerc2_opc_var1( m_A,
n_A,
buff_alpha,
buff_u, inc_u,
buff_y, inc_y,
buff_z, inc_z,
buff_v, inc_v,
buff_A, rs_A, cs_A );
break;
}
case FLA_DOUBLE_COMPLEX:
{
dcomplex* buff_A = FLA_DOUBLE_COMPLEX_PTR( A );
dcomplex* buff_u = FLA_DOUBLE_COMPLEX_PTR( u );
dcomplex* buff_y = FLA_DOUBLE_COMPLEX_PTR( y );
dcomplex* buff_z = FLA_DOUBLE_COMPLEX_PTR( z );
dcomplex* buff_v = FLA_DOUBLE_COMPLEX_PTR( v );
dcomplex* buff_alpha = FLA_DOUBLE_COMPLEX_PTR( alpha );
FLA_Fused_Gerc2_opz_var1( m_A,
//.........这里部分代码省略.........
示例14: FLA_Hemm_lu_blk_var6
FLA_Error FLA_Hemm_lu_blk_var6( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C, fla_hemm_t* cntl )
{
FLA_Obj ATL, ATR, A00, A01, A02,
ABL, ABR, A10, A11, A12,
A20, A21, A22;
FLA_Obj BT, B0,
BB, B1,
B2;
FLA_Obj CT, C0,
CB, C1,
C2;
dim_t b;
FLA_Scal_internal( beta, C,
FLA_Cntl_sub_scal( cntl ) );
FLA_Part_2x2( A, &ATL, &ATR,
&ABL, &ABR, 0, 0, FLA_BR );
FLA_Part_2x1( B, &BT,
&BB, 0, FLA_BOTTOM );
FLA_Part_2x1( C, &CT,
&CB, 0, FLA_BOTTOM );
while ( FLA_Obj_length( ABR ) < FLA_Obj_length( A ) ){
b = FLA_Determine_blocksize( ATL, FLA_TL, FLA_Cntl_blocksize( cntl ) );
FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, &A01, /**/ &A02,
&A10, &A11, /**/ &A12,
/* ************* */ /* ******************** */
ABL, /**/ ABR, &A20, &A21, /**/ &A22,
b, b, FLA_TL );
FLA_Repart_2x1_to_3x1( BT, &B0,
&B1,
/* ** */ /* ** */
BB, &B2, b, FLA_TOP );
FLA_Repart_2x1_to_3x1( CT, &C0,
&C1,
/* ** */ /* ** */
CB, &C2, b, FLA_TOP );
/*------------------------------------------------------------*/
/* C1 = C1 + A01' * B0 */
FLA_Gemm_internal( FLA_CONJ_TRANSPOSE, FLA_NO_TRANSPOSE,
alpha, A01, B0, FLA_ONE, C1,
FLA_Cntl_sub_gemm1( cntl ) );
/* C1 = C1 + A11 * B1 */
FLA_Hemm_internal( FLA_LEFT, FLA_UPPER_TRIANGULAR,
alpha, A11, B1, FLA_ONE, C1,
FLA_Cntl_sub_hemm( cntl ) );
/* C1 = C1 + A12 * B2 */
FLA_Gemm_internal( FLA_NO_TRANSPOSE, FLA_NO_TRANSPOSE,
alpha, A12, B2, FLA_ONE, C1,
FLA_Cntl_sub_gemm2( cntl ) );
/*------------------------------------------------------------*/
FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, /**/ A01, A02,
/* ************** */ /* ****************** */
A10, /**/ A11, A12,
&ABL, /**/ &ABR, A20, /**/ A21, A22,
FLA_BR );
FLA_Cont_with_3x1_to_2x1( &BT, B0,
/* ** */ /* ** */
B1,
&BB, B2, FLA_BOTTOM );
FLA_Cont_with_3x1_to_2x1( &CT, C0,
/* ** */ /* ** */
C1,
&CB, C2, FLA_BOTTOM );
}
return FLA_SUCCESS;
}
示例15: FLA_Symm_ru_blk_var4
FLA_Error FLA_Symm_ru_blk_var4( FLA_Obj alpha, FLA_Obj A, FLA_Obj B, FLA_Obj beta, FLA_Obj C, fla_symm_t* cntl )
{
FLA_Obj ATL, ATR, A00, A01, A02,
ABL, ABR, A10, A11, A12,
A20, A21, A22;
FLA_Obj BL, BR, B0, B1, B2;
FLA_Obj CL, CR, C0, C1, C2;
dim_t b;
FLA_Scal_internal( beta, C,
FLA_Cntl_sub_scal( cntl ) );
FLA_Part_2x2( A, &ATL, &ATR,
&ABL, &ABR, 0, 0, FLA_TL );
FLA_Part_1x2( B, &BL, &BR, 0, FLA_LEFT );
FLA_Part_1x2( C, &CL, &CR, 0, FLA_LEFT );
while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){
b = FLA_Determine_blocksize( ABR, FLA_BR, FLA_Cntl_blocksize( cntl ) );
FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &A01, &A02,
/* ************* */ /* ******************** */
&A10, /**/ &A11, &A12,
ABL, /**/ ABR, &A20, /**/ &A21, &A22,
b, b, FLA_BR );
FLA_Repart_1x2_to_1x3( BL, /**/ BR, &B0, /**/ &B1, &B2,
b, FLA_RIGHT );
FLA_Repart_1x2_to_1x3( CL, /**/ CR, &C0, /**/ &C1, &C2,
b, FLA_RIGHT );
/*------------------------------------------------------------*/
/* C0 = C0 + B1 * A01' */
FLA_Gemm_internal( FLA_NO_TRANSPOSE, FLA_TRANSPOSE,
alpha, B1, A01, FLA_ONE, C0,
FLA_Cntl_sub_gemm1( cntl ) );
/* C1 = C1 + B1 * A11 */
FLA_Symm_internal( FLA_RIGHT, FLA_UPPER_TRIANGULAR,
alpha, A11, B1, FLA_ONE, C1,
FLA_Cntl_sub_symm( cntl ) );
/* C2 = C2 + B1 * A12 */
FLA_Gemm_internal( FLA_NO_TRANSPOSE, FLA_NO_TRANSPOSE,
alpha, B1, A12, FLA_ONE, C2,
FLA_Cntl_sub_gemm2( cntl ) );
/*------------------------------------------------------------*/
FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, A01, /**/ A02,
A10, A11, /**/ A12,
/* ************** */ /* ****************** */
&ABL, /**/ &ABR, A20, A21, /**/ A22,
FLA_TL );
FLA_Cont_with_1x3_to_1x2( &BL, /**/ &BR, B0, B1, /**/ B2,
FLA_LEFT );
FLA_Cont_with_1x3_to_1x2( &CL, /**/ &CR, C0, C1, /**/ C2,
FLA_LEFT );
}
return FLA_SUCCESS;
}