FLA_Misc.c File Reference

(r)


Functions

FLA_Bool FLA_Obj_is_int (FLA_Obj A)
FLA_Bool FLA_Obj_is_floating_point (FLA_Obj A)
FLA_Bool FLA_Obj_is_constant (FLA_Obj A)
FLA_Bool FLA_Obj_is_real (FLA_Obj A)
FLA_Bool FLA_Obj_is_complex (FLA_Obj A)
FLA_Bool FLA_Obj_is_single_precision (FLA_Obj A)
FLA_Bool FLA_Obj_is_double_precision (FLA_Obj A)
FLA_Bool FLA_Obj_is_scalar (FLA_Obj A)
FLA_Bool FLA_Obj_is_vector (FLA_Obj A)
FLA_Bool FLA_Obj_has_zero_dim (FLA_Obj A)
FLA_Bool FLA_Obj_is_conformal_to (FLA_Trans trans, FLA_Obj A, FLA_Obj B)
FLA_Bool FLA_Obj_is (FLA_Obj A, FLA_Obj B)
void FLA_F2C() fla_obj_is_f (F_INT *A, F_INT *B, F_INT *IERROR)
FLA_Bool FLA_Obj_equals (FLA_Obj A, FLA_Obj B)
void FLA_F2C() fla_obj_equals_f (F_INT *A, F_INT *B, F_INT *IERROR)
FLA_Error FLA_Obj_set_to_scalar (FLA_Obj alpha, FLA_Obj A)
void FLA_F2C() fla_obj_set_to_scalar_f (F_INT *alpha, F_INT *A, F_INT *IERROR)
FLA_Error FLA_Obj_set_diagonal_to_scalar (FLA_Obj alpha, FLA_Obj A)
void FLA_F2C() fla_obj_set_diagonal_to_scalar_f (F_INT *alpha, F_INT *A, F_INT *IERROR)
FLA_Error FLA_Obj_set_to_identity (FLA_Obj A)
void FLA_F2C() fla_obj_set_to_identity_f (F_INT *A, F_INT *IERROR)
FLA_Error FLA_Obj_add_to_diagonal (void *diag_value, FLA_Obj A)
void FLA_F2C() fla_obj_add_to_diagonal_f (F_INT *value, F_INT *A, F_INT *IERROR)
FLA_Error FLA_Obj_shift_diagonal (FLA_Obj sigma, FLA_Obj A)
void FLA_F2C() fla_obj_shift_diagonal_f (F_INT *sigma, F_INT *A, F_INT *IERROR)
FLA_Error FLA_Obj_scale_diagonal (FLA_Obj alpha, FLA_Obj A)
void FLA_F2C() fla_obj_scale_diagonal_f (F_INT *alpha, F_INT *A, F_INT *IERROR)
FLA_Error FLA_Obj_show (char *s1, FLA_Obj A, char *format, char *s2)
void FLA_F2C() fla_obj_show_f (F_INT *s1, F_INT *A, F_INT *format, F_INT *s2, F_INT *IERROR)
FLA_Error FLA_Copy_submatrix_to_global (FLA_Trans trans, dim_t m, dim_t n, void *A_buffer, dim_t ldim, dim_t i, dim_t j, FLA_Obj B)
FLA_Error FLA_Copy_global_to_submatrix (FLA_Trans trans, dim_t i, dim_t j, FLA_Obj A, dim_t m, dim_t n, void *B_buffer, dim_t ldim)
FLA_Error FLA_Axpy_submatrix_to_global (FLA_Trans trans, FLA_Obj alpha, dim_t m, dim_t n, void *X_buffer, dim_t ldim, dim_t i, dim_t j, FLA_Obj Y)
FLA_Error FLA_Axpy_global_to_submatrix (FLA_Trans trans, FLA_Obj alpha, dim_t i, dim_t j, FLA_Obj X, dim_t m, dim_t n, void *Y_buffer, dim_t ldim)

Function Documentation

FLA_Error FLA_Axpy_global_to_submatrix ( FLA_Trans  trans,
FLA_Obj  alpha,
dim_t  i,
dim_t  j,
FLA_Obj  X,
dim_t  m,
dim_t  n,
void *  Y_buffer,
dim_t  ldim 
)

References FLA_Axpy_global_to_submatrix_check(), FLA_Axpyt_external(), FLA_Check_error_level(), FLA_Obj_attach_buffer(), FLA_Obj_create_without_buffer(), FLA_Obj_datatype(), FLA_Obj_free_without_buffer(), and FLA_Part_2x2().

01157 {
01158   FLA_Obj  Y;
01159   FLA_Obj  XTL, XTR, 
01160            XBL, Xij;
01161 
01162   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
01163     FLA_Axpy_global_to_submatrix_check( trans, alpha, i, j, X, m, n, Y_buffer, ldim );
01164 
01165   FLA_Part_2x2( X,  &XTL, &XTR,
01166                     &XBL, &Xij,     i, j, FLA_TL );
01167 
01168   FLA_Obj_create_without_buffer( FLA_Obj_datatype( X ), m, n, &Y );
01169   FLA_Obj_attach_buffer( Y_buffer, ldim, &Y );
01170 
01171   FLA_Axpyt_external( trans, alpha, Xij, Y );
01172 
01173   FLA_Obj_free_without_buffer( &Y );
01174 
01175   return FLA_SUCCESS;
01176 }

FLA_Error FLA_Axpy_submatrix_to_global ( FLA_Trans  trans,
FLA_Obj  alpha,
dim_t  m,
dim_t  n,
void *  X_buffer,
dim_t  ldim,
dim_t  i,
dim_t  j,
FLA_Obj  Y 
)

References FLA_Axpy_submatrix_to_global_check(), FLA_Axpyt_external(), FLA_Check_error_level(), FLA_Obj_attach_buffer(), FLA_Obj_create_without_buffer(), FLA_Obj_datatype(), FLA_Obj_free_without_buffer(), and FLA_Part_2x2().

01128 {
01129   FLA_Obj  X;
01130   FLA_Obj  YTL, YTR, 
01131            YBL, Yij;
01132 
01133   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
01134     FLA_Axpy_submatrix_to_global_check( trans, alpha, m, n, X_buffer, ldim, i, j, Y );
01135 
01136   FLA_Part_2x2( Y,  &YTL, &YTR,
01137                     &YBL, &Yij,     i, j, FLA_TL );
01138 
01139   FLA_Obj_create_without_buffer( FLA_Obj_datatype( Y ), m, n, &X );
01140   FLA_Obj_attach_buffer( X_buffer, ldim, &X );
01141 
01142   FLA_Axpyt_external( trans, alpha, X, Yij );
01143 
01144   FLA_Obj_free_without_buffer( &X );
01145 
01146   return FLA_SUCCESS;
01147 }

FLA_Error FLA_Copy_global_to_submatrix ( FLA_Trans  trans,
dim_t  i,
dim_t  j,
FLA_Obj  A,
dim_t  m,
dim_t  n,
void *  B_buffer,
dim_t  ldim 
)

References FLA_Check_error_level(), FLA_Copy_global_to_submatrix_check(), FLA_Copyt_external(), FLA_Obj_attach_buffer(), FLA_Obj_create_without_buffer(), FLA_Obj_datatype(), FLA_Obj_free_without_buffer(), and FLA_Part_2x2().

01099 {
01100   FLA_Obj  B;
01101   FLA_Obj  ATL, ATR, 
01102            ABL, Aij;
01103 
01104   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
01105     FLA_Copy_global_to_submatrix_check( trans, i, j, A, m, n, B_buffer, ldim );
01106 
01107   FLA_Part_2x2( A,  &ATL, &ATR,
01108                     &ABL, &Aij,     i, j, FLA_TL );
01109 
01110   FLA_Obj_create_without_buffer( FLA_Obj_datatype( A ), m, n, &B );
01111   FLA_Obj_attach_buffer( B_buffer, ldim, &B );
01112 
01113   FLA_Copyt_external( trans, Aij, B );
01114 
01115   FLA_Obj_free_without_buffer( &B );
01116 
01117   return FLA_SUCCESS;
01118 }

FLA_Error FLA_Copy_submatrix_to_global ( FLA_Trans  trans,
dim_t  m,
dim_t  n,
void *  A_buffer,
dim_t  ldim,
dim_t  i,
dim_t  j,
FLA_Obj  B 
)

References FLA_Check_error_level(), FLA_Copy_submatrix_to_global_check(), FLA_Copyt_external(), FLA_Obj_attach_buffer(), FLA_Obj_create_without_buffer(), FLA_Obj_datatype(), FLA_Obj_free_without_buffer(), and FLA_Part_2x2().

01070 {
01071   FLA_Obj  A;
01072   FLA_Obj  BTL, BTR, 
01073            BBL, Bij;
01074 
01075   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
01076     FLA_Copy_submatrix_to_global_check( trans, m, n, A_buffer, ldim, i, j, B );
01077 
01078   FLA_Part_2x2( B,  &BTL, &BTR,
01079                     &BBL, &Bij,     i, j, FLA_TL );
01080 
01081   FLA_Obj_create_without_buffer( FLA_Obj_datatype( B ), m, n, &A );
01082   FLA_Obj_attach_buffer( A_buffer, ldim, &A );
01083 
01084   FLA_Copyt_external( trans, A, Bij );
01085 
01086   FLA_Obj_free_without_buffer( &A );
01087 
01088   return FLA_SUCCESS;
01089 }

FLA_Error FLA_Obj_add_to_diagonal ( void *  diag_value,
FLA_Obj  A 
)

References FLA_Check_error_level(), FLA_Obj_add_to_diagonal_check(), FLA_Obj_datatype(), FLA_Obj_ldim(), FLA_Obj_min_dim(), dcomplex::imag, scomplex::imag, dcomplex::real, and scomplex::real.

Referenced by fla_obj_add_to_diagonal_f().

00643 {
00644   FLA_Datatype datatype;
00645   dim_t        i, n, ldim;
00646 
00647   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00648     FLA_Obj_add_to_diagonal_check( diag_value, A );
00649 
00650   datatype = FLA_Obj_datatype( A );
00651   ldim     = FLA_Obj_ldim( A );
00652   n        = FLA_Obj_min_dim( A );
00653 
00654   switch ( datatype ){
00655 
00656   case FLA_FLOAT:
00657   {
00658     float *buff_A    = ( float * ) FLA_FLOAT_PTR( A );
00659     float *value_ptr = ( float * ) diag_value;
00660 
00661     for ( i = 0; i < n; i++ )
00662       buff_A[ i*ldim + i ] += *value_ptr;
00663 
00664     break;
00665   }
00666 
00667   case FLA_DOUBLE:
00668   {
00669     double *buff_A    = ( double * ) FLA_DOUBLE_PTR( A );
00670     double *value_ptr = ( double * ) diag_value;
00671 
00672     for ( i = 0; i < n; i++ )
00673       buff_A[ i*ldim + i ] += *value_ptr;
00674 
00675     break;
00676   }
00677 
00678   case FLA_COMPLEX:
00679   {
00680     scomplex *buff_A    = ( scomplex * ) FLA_COMPLEX_PTR( A );
00681     scomplex *value_ptr = ( scomplex * ) diag_value;
00682 
00683     for ( i = 0; i < n; i++ )
00684     {
00685       buff_A[ i*ldim + i ].real += value_ptr->real;
00686       buff_A[ i*ldim + i ].imag += value_ptr->imag;
00687     }
00688 
00689     break;
00690   }
00691 
00692   case FLA_DOUBLE_COMPLEX:
00693   {
00694     dcomplex *buff_A    = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00695     dcomplex *value_ptr = ( dcomplex * ) diag_value;
00696 
00697     for ( i = 0; i < n; i++ )
00698     {
00699       buff_A[ i*ldim + i ].real += value_ptr->real;
00700       buff_A[ i*ldim + i ].imag += value_ptr->imag;
00701     }
00702 
00703     break;
00704   }
00705 
00706   }
00707 
00708   return FLA_SUCCESS;
00709 }

void FLA_F2C() fla_obj_add_to_diagonal_f ( F_INT *  value,
F_INT *  A,
F_INT *  IERROR 
)

References FLA_Obj_add_to_diagonal().

00713 {
00714   *IERROR = FLA_Obj_add_to_diagonal(  ( ( void    * ) value ),
00715                                      *( ( FLA_Obj * ) A     ) );
00716 }

FLA_Bool FLA_Obj_equals ( FLA_Obj  A,
FLA_Obj  B 
)

References FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_equals_check(), FLA_Obj_ldim(), FLA_Obj_length(), and FLA_Obj_width().

Referenced by FLA_Axpys_external(), FLA_Check_divide_by_zero(), FLA_Inv_scal_external(), FLA_Inv_scalc_external(), fla_obj_equals_f(), FLA_Scal_external(), and FLA_Scalc_external().

00301 {
00302   FLA_Datatype datatype_A;
00303   FLA_Datatype datatype_B;
00304   FLA_Datatype datatype;
00305   dim_t        m, n, ldim_A, ldim_B;
00306   dim_t        i, j;
00307 
00308   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00309     FLA_Obj_equals_check( A, B );
00310 
00311   m      = FLA_Obj_length( A );
00312   n      = FLA_Obj_width( A );
00313   ldim_A = FLA_Obj_ldim( A );
00314   ldim_B = FLA_Obj_ldim( B );
00315 
00316   datatype_A = FLA_Obj_datatype( A );
00317   datatype_B = FLA_Obj_datatype( B );
00318 
00319   // If A is a non-FLA_CONSTANT object, then we should proceed based on the
00320   // value of datatype_A. In such a situation, either datatype_B is an exact
00321   // match and we're fine, or datatype_B is FLA_CONSTANT, in which case we're
00322   // also covered since FLA_CONSTANT encompassas all numerical types.
00323   // If A is an FLA_CONSTANT object, then we should proceed based on the value
00324   // of datatype_B. In this case, datatype_B is either a non-FLA_CONSTANT type,
00325   // which mirrors the second sub-case above, or datatype_B is FLA_CONSTANT,
00326   // in which case both types are FLA_CONSTANT and therefore we have to handle
00327   // that case. Only if both are FLA_CONSTANTs does the FLA_CONSTANT case
00328   // statement below execute.
00329   if ( datatype_A != FLA_CONSTANT )
00330     datatype = datatype_A;
00331   else
00332     datatype = datatype_B;
00333 
00334   switch ( datatype ){
00335 
00336   case FLA_CONSTANT:
00337   {
00338     // If both objects are FLA_CONSTANTs, then it doesn't matter which datatype
00339     // macro we use, as long as we use the same one for both A and B.
00340     int *buff_A = ( int * ) FLA_INT_PTR( A );
00341     int *buff_B = ( int * ) FLA_INT_PTR( B );
00342 
00343     for ( j = 0; j < n; j++ )
00344       for ( i = 0; i < m; i++ )
00345         if ( buff_A[ j * ldim_A + i ] != 
00346              buff_B[ j * ldim_B + i ] )
00347           return FALSE;
00348 
00349     break;
00350   }
00351 
00352   case FLA_INT:
00353   {
00354     int *buff_A = ( int * ) FLA_INT_PTR( A );
00355     int *buff_B = ( int * ) FLA_INT_PTR( B );
00356 
00357     for ( j = 0; j < n; j++ )
00358       for ( i = 0; i < m; i++ )
00359         if ( buff_A[ j * ldim_A + i ] != 
00360              buff_B[ j * ldim_B + i ] )
00361         {
00362           return FALSE;
00363         }
00364 
00365     break;
00366   }
00367 
00368   case FLA_FLOAT:
00369   {
00370     float *buff_A = ( float * ) FLA_FLOAT_PTR( A );
00371     float *buff_B = ( float * ) FLA_FLOAT_PTR( B );
00372 
00373     for ( j = 0; j < n; j++ )
00374       for ( i = 0; i < m; i++ )
00375         if ( buff_A[ j * ldim_A + i ] != 
00376              buff_B[ j * ldim_B + i ] )
00377         {
00378           return FALSE;
00379         }
00380 
00381     break;
00382   }
00383 
00384   case FLA_DOUBLE:
00385   {
00386     double *buff_A = ( double * ) FLA_DOUBLE_PTR( A );
00387     double *buff_B = ( double * ) FLA_DOUBLE_PTR( B );
00388 
00389     for ( j = 0; j < n; j++ )
00390       for ( i = 0; i < m; i++ )
00391         if ( buff_A[ j * ldim_A + i ] != 
00392              buff_B[ j * ldim_B + i ] )
00393         {
00394           return FALSE;
00395         }
00396 
00397     break;
00398   }
00399 
00400   case FLA_COMPLEX:
00401   {
00402     scomplex *buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A );
00403     scomplex *buff_B = ( scomplex * ) FLA_COMPLEX_PTR( B );
00404 
00405     for ( j = 0; j < n; j++ )
00406       for ( i = 0; i < m; i++ )
00407         if ( buff_A[ j * ldim_A + i ].real != buff_B[ j * ldim_B + i ].real ||
00408              buff_A[ j * ldim_A + i ].imag != buff_B[ j * ldim_B + i ].imag )
00409         {
00410           return FALSE;
00411         }
00412 
00413     break;
00414   }
00415 
00416   case FLA_DOUBLE_COMPLEX:
00417   {
00418     dcomplex *buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00419     dcomplex *buff_B = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( B );
00420 
00421     for ( j = 0; j < n; j++ )
00422       for ( i = 0; i < m; i++ )
00423         if ( buff_A[ j * ldim_A + i ].real != buff_B[ j * ldim_B + i ].real ||
00424              buff_A[ j * ldim_A + i ].imag != buff_B[ j * ldim_B + i ].imag )
00425         {
00426           return FALSE;
00427         }
00428 
00429     break;
00430   }
00431 
00432   }
00433 
00434   return TRUE;
00435 }

void FLA_F2C() fla_obj_equals_f ( F_INT *  A,
F_INT *  B,
F_INT *  IERROR 
)

References FLA_Obj_equals().

00439 {
00440   *IERROR = FLA_Obj_equals( *( ( FLA_Obj * ) A ),
00441                             *( ( FLA_Obj * ) B ) );
00442 }

FLA_Bool FLA_Obj_has_zero_dim ( FLA_Obj  A  ) 

References FLA_Obj_length(), and FLA_Obj_width().

Referenced by FLA_Apply_househ2_UT(), FLA_Apply_househ2_UT_opt(), FLA_Apply_Q_blk_external(), FLA_Apply_Q_unb_external(), FLA_Asum_external(), FLA_Axpy_external(), FLA_Check_pivot_index_range(), FLA_Chol_blk_external(), FLA_Chol_unb_external(), FLA_Conjugate(), FLA_Copy_external(), FLA_Copyr_external(), FLA_Copyt_external(), FLA_Dot2cs_external(), FLA_Dot2s_external(), FLA_Dot_external(), FLA_Dotc_external(), FLA_Dotcs_external(), FLA_Dots_external(), FLA_Gemm_external(), FLA_Gemv_external(), FLA_Gemvc_external(), FLA_Ger_external(), FLA_Gerc_external(), FLA_Hemm_external(), FLA_Hemv_external(), FLA_Hemvc_external(), FLA_Her2_external(), FLA_Her2c_external(), FLA_Her2k_external(), FLA_Her_external(), FLA_Herc_external(), FLA_Herk_external(), FLA_Hess_blk_external(), FLA_Hess_unb_external(), FLA_Iamax_external(), FLA_Inv_scal_external(), FLA_Inv_scalc_external(), FLA_LQ_blk_external(), FLA_LQ_unb_external(), FLA_LQ_UT_blk_external(), FLA_LQ_UT_unb_external(), FLA_LU_nopiv_blk_external(), FLA_LU_nopiv_unb_external(), FLA_LU_piv_blk_external(), FLA_LU_piv_unb_external(), FLA_Nrm2_external(), FLA_QR_blk_external(), FLA_QR_unb_external(), FLA_QR_UT_blk_external(), FLA_QR_UT_unb_external(), FLA_SA_Apply_pivots(), FLA_SA_LU_unb(), FLA_Scal_external(), FLA_Scalc_external(), FLA_Scalr_external(), FLA_Swap_external(), FLA_Swap_rows(), FLA_Swapt_external(), FLA_Sylv_unb_external(), FLA_Symm_external(), FLA_Symv_external(), FLA_Syr2_external(), FLA_Syr2k_external(), FLA_Syr_external(), FLA_Syrk_external(), FLA_Trinv_blk_external(), FLA_Trinv_unb_external(), FLA_Trmm_external(), FLA_Trmv_external(), FLA_Trsm_external(), FLA_Trsv_external(), FLA_Ttmm_blk_external(), and FLA_Ttmm_unb_external().

00233 {
00234   FLA_Bool r_val = FALSE;
00235 
00236   if ( FLA_Obj_length( A ) == 0 || FLA_Obj_width( A ) == 0 )
00237     r_val = TRUE;
00238 
00239   return r_val;
00240 }

FLA_Bool FLA_Obj_is ( FLA_Obj  A,
FLA_Obj  B 
)

References FLA_Obj_view::base.

Referenced by FLA_Check_valid_isgn_value(), and fla_obj_is_f().

00277 {
00278   FLA_Bool r_val = FALSE;
00279 
00280   if ( A.base == B.base )
00281     r_val = TRUE;
00282 
00283   return r_val;
00284 }

FLA_Bool FLA_Obj_is_complex ( FLA_Obj  A  ) 

References FLA_Obj_datatype().

Referenced by FLA_Check_conj_and_datatype(), FLA_Check_conj_trans_and_datatype(), and FLA_Check_identical_object_precision().

00132 {
00133   FLA_Datatype datatype;
00134   FLA_Bool     r_val;
00135 
00136   datatype = FLA_Obj_datatype( A );
00137 
00138   if ( datatype == FLA_CONSTANT || datatype == FLA_COMPLEX || datatype == FLA_DOUBLE_COMPLEX )
00139     r_val = TRUE;
00140   else
00141     r_val = FALSE;
00142 
00143   return r_val;
00144 }

FLA_Bool FLA_Obj_is_conformal_to ( FLA_Trans  trans,
FLA_Obj  A,
FLA_Obj  B 
)

References FLA_Obj_length(), and FLA_Obj_width().

00250 {
00251   FLA_Bool r_val = FALSE;
00252 
00253   if ( trans == FLA_NO_TRANSPOSE || trans == FLA_CONJ_NO_TRANSPOSE )
00254   {
00255     if ( FLA_Obj_length( A ) != FLA_Obj_length( B ) ||
00256          FLA_Obj_width( A )  != FLA_Obj_width( B ) )
00257       r_val = TRUE;
00258   }
00259   else
00260   {
00261     if ( FLA_Obj_width( A )  != FLA_Obj_length( B ) ||
00262          FLA_Obj_length( A ) != FLA_Obj_width( B ) )
00263       r_val = TRUE;
00264   }
00265 
00266   return r_val;
00267 }

FLA_Bool FLA_Obj_is_constant ( FLA_Obj  A  ) 

References FLA_Obj_datatype().

00088 {
00089   FLA_Datatype datatype;
00090   FLA_Bool     r_val;
00091 
00092   datatype = FLA_Obj_datatype( A );
00093 
00094   if ( datatype == FLA_CONSTANT )
00095     r_val = TRUE;
00096   else
00097     r_val = FALSE;
00098 
00099   return r_val;
00100 }

FLA_Bool FLA_Obj_is_double_precision ( FLA_Obj  A  ) 

References FLA_Obj_datatype().

00176 {
00177   FLA_Datatype datatype;
00178   FLA_Bool     r_val;
00179 
00180   datatype = FLA_Obj_datatype( A );
00181 
00182   if ( datatype == FLA_CONSTANT || datatype == FLA_DOUBLE || datatype == FLA_DOUBLE_COMPLEX )
00183     r_val = TRUE;
00184   else
00185     r_val = FALSE;
00186 
00187   return r_val;
00188 }

void FLA_F2C() fla_obj_is_f ( F_INT *  A,
F_INT *  B,
F_INT *  IERROR 
)

References FLA_Obj_is().

00288 {
00289   *IERROR = FLA_Obj_is( *( ( FLA_Obj * ) A ),
00290                         *( ( FLA_Obj * ) B ) );
00291 }

FLA_Bool FLA_Obj_is_floating_point ( FLA_Obj  A  ) 

References FLA_Obj_datatype().

00065 {
00066   FLA_Datatype datatype;
00067   FLA_Bool     r_val;
00068 
00069   datatype = FLA_Obj_datatype( A );
00070 
00071   if ( datatype == FLA_FLOAT || datatype == FLA_COMPLEX ||
00072        datatype == FLA_DOUBLE || datatype == FLA_DOUBLE_COMPLEX )
00073     r_val = TRUE;
00074   else
00075     r_val = FALSE;
00076 
00077   return r_val;
00078 }

FLA_Bool FLA_Obj_is_int ( FLA_Obj  A  ) 

References FLA_Obj_datatype().

00043 {
00044   FLA_Datatype datatype;
00045   FLA_Bool     r_val;
00046 
00047   datatype = FLA_Obj_datatype( A );
00048 
00049   if ( datatype == FLA_INT )
00050     r_val = TRUE;
00051   else
00052     r_val = FALSE;
00053 
00054   return r_val;
00055 }

FLA_Bool FLA_Obj_is_real ( FLA_Obj  A  ) 

FLA_Bool FLA_Obj_is_scalar ( FLA_Obj  A  ) 

References FLA_Obj_length(), and FLA_Obj_width().

00198 {
00199   FLA_Bool r_val = FALSE;
00200 
00201   if ( FLA_Obj_length( A ) == 1 &&
00202        FLA_Obj_width( A ) == 1 )
00203     r_val = TRUE;
00204 
00205   return r_val;
00206 }

FLA_Bool FLA_Obj_is_single_precision ( FLA_Obj  A  ) 

References FLA_Obj_datatype().

00154 {
00155   FLA_Datatype datatype;
00156   FLA_Bool     r_val;
00157 
00158   datatype = FLA_Obj_datatype( A );
00159 
00160   if ( datatype == FLA_CONSTANT || datatype == FLA_FLOAT || datatype == FLA_COMPLEX )
00161     r_val = TRUE;
00162   else
00163     r_val = FALSE;
00164 
00165   return r_val;
00166 }

FLA_Bool FLA_Obj_is_vector ( FLA_Obj  A  ) 

FLA_Error FLA_Obj_scale_diagonal ( FLA_Obj  alpha,
FLA_Obj  A 
)

References FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_ldim(), FLA_Obj_min_dim(), FLA_Obj_scale_diagonal_check(), dcomplex::imag, scomplex::imag, dcomplex::real, and scomplex::real.

Referenced by fla_obj_scale_diagonal_f().

00837 {
00838   FLA_Datatype datatype_A;
00839   FLA_Datatype datatype_alpha;
00840   dim_t        i, min_m_n, ldim_A;
00841 
00842   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00843     FLA_Obj_scale_diagonal_check( alpha, A );
00844 
00845   ldim_A         = FLA_Obj_ldim( A );
00846   min_m_n        = FLA_Obj_min_dim( A );
00847   datatype_A     = FLA_Obj_datatype( A );
00848   datatype_alpha = FLA_Obj_datatype( alpha );
00849   
00850   switch( datatype_A ){
00851 
00852   case FLA_FLOAT:
00853   {
00854     float *buff_A     = ( float * ) FLA_FLOAT_PTR( A );
00855     float *buff_alpha = ( float * ) FLA_FLOAT_PTR( alpha );
00856 
00857     for ( i = 0; i < min_m_n; i++ )
00858       *( buff_A + i*ldim_A + i ) *= *buff_alpha;
00859 
00860     break;
00861   }
00862 
00863   case FLA_DOUBLE:
00864   {
00865     double *buff_A     = ( double * ) FLA_DOUBLE_PTR( A );
00866     double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( alpha );
00867 
00868     for ( i = 0; i < min_m_n; i++ )
00869       *( buff_A + i*ldim_A + i ) *= *buff_alpha;
00870 
00871     break;
00872   }
00873 
00874   case FLA_COMPLEX:
00875   {
00876     if ( datatype_alpha == FLA_COMPLEX )
00877     {
00878       scomplex *buff_A     = ( scomplex * ) FLA_COMPLEX_PTR( A );
00879       scomplex *buff_alpha = ( scomplex * ) FLA_COMPLEX_PTR( alpha );
00880   
00881       for ( i = 0; i < min_m_n; i++ )
00882       {
00883         ( buff_A + i*ldim_A + i )->real *= buff_alpha->real;
00884         ( buff_A + i*ldim_A + i )->imag *= buff_alpha->imag;
00885       }
00886     }
00887     else
00888     {
00889       scomplex *buff_A     = ( scomplex * ) FLA_COMPLEX_PTR( A );
00890       float    *buff_alpha = ( float    * ) FLA_FLOAT_PTR( alpha );
00891   
00892       for ( i = 0; i < min_m_n; i++ )
00893       {
00894         ( buff_A + i*ldim_A + i )->real *= *buff_alpha;
00895       }
00896     }
00897 
00898     break;
00899   }
00900 
00901   case FLA_DOUBLE_COMPLEX:
00902   {
00903     if ( datatype_alpha == FLA_DOUBLE_COMPLEX )
00904     {
00905       dcomplex *buff_A     = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00906       dcomplex *buff_alpha = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( alpha );
00907 
00908       for ( i = 0; i < min_m_n; i++ )
00909       {
00910         ( buff_A + i*ldim_A + i )->real *= buff_alpha->real;
00911         ( buff_A + i*ldim_A + i )->imag *= buff_alpha->imag;
00912       }
00913     }
00914     else
00915     {
00916       dcomplex *buff_A     = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00917       double   *buff_alpha = ( double   * ) FLA_DOUBLE_PTR( alpha );
00918 
00919       for ( i = 0; i < min_m_n; i++ )
00920       {
00921         ( buff_A + i*ldim_A + i )->real *= *buff_alpha;
00922       }
00923     }
00924 
00925     break;
00926   }
00927 
00928   }
00929 
00930   return FLA_SUCCESS;
00931 }

void FLA_F2C() fla_obj_scale_diagonal_f ( F_INT *  alpha,
F_INT *  A,
F_INT *  IERROR 
)

References FLA_Obj_scale_diagonal().

00935 {
00936   *IERROR = FLA_Obj_scale_diagonal( *( ( FLA_Obj * ) alpha ), 
00937                                     *( ( FLA_Obj * ) A     ) );
00938 }

FLA_Error FLA_Obj_set_diagonal_to_scalar ( FLA_Obj  alpha,
FLA_Obj  A 
)

References FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_ldim(), FLA_Obj_min_dim(), FLA_Obj_set_diagonal_to_scalar_check(), dcomplex::imag, scomplex::imag, dcomplex::real, and scomplex::real.

Referenced by fla_obj_set_diagonal_to_scalar_f(), and FLA_Obj_set_to_identity().

00535 {
00536   FLA_Datatype datatype;
00537   dim_t        i, min_m_n, ldim;
00538 
00539   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00540     FLA_Obj_set_diagonal_to_scalar_check( alpha, A );
00541 
00542   datatype = FLA_Obj_datatype( A );
00543   ldim     = FLA_Obj_ldim( A );
00544   min_m_n  = FLA_Obj_min_dim( A );
00545 
00546   switch ( datatype ){
00547 
00548   case FLA_FLOAT:
00549   {
00550     float *buff_A     = ( float * ) FLA_FLOAT_PTR( A );
00551     float *buff_alpha = ( float * ) FLA_FLOAT_PTR( alpha );
00552 
00553     for ( i = 0; i < min_m_n; i++ )
00554       buff_A[ i*ldim + i ] = *buff_alpha;
00555 
00556     break;
00557   }
00558 
00559   case FLA_DOUBLE:
00560   {
00561     double *buff_A     = ( double * ) FLA_DOUBLE_PTR( A );
00562     double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( alpha );
00563 
00564     for ( i = 0; i < min_m_n; i++ )
00565       buff_A[ i*ldim + i ] = *buff_alpha;
00566 
00567     break;
00568   }
00569 
00570   case FLA_COMPLEX:
00571   {
00572     scomplex *buff_A     = ( scomplex * ) FLA_COMPLEX_PTR( A );
00573     scomplex *buff_alpha = ( scomplex * ) FLA_COMPLEX_PTR( alpha );
00574 
00575     for ( i = 0; i < min_m_n; i++ )
00576     {
00577       buff_A[ i*ldim + i ].real = buff_alpha->real;
00578       buff_A[ i*ldim + i ].imag = buff_alpha->imag;
00579     }
00580 
00581     break;
00582   }
00583 
00584   case FLA_DOUBLE_COMPLEX:
00585   {
00586     dcomplex *buff_A     = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00587     dcomplex *buff_alpha = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( alpha );
00588 
00589     for ( i = 0; i < min_m_n; i++ )
00590     {
00591       buff_A[ i*ldim + i ].real = buff_alpha->real;
00592       buff_A[ i*ldim + i ].imag = buff_alpha->imag;
00593     }
00594 
00595     break;
00596   }
00597 
00598   }
00599 
00600   return FLA_SUCCESS;
00601 }

void FLA_F2C() fla_obj_set_diagonal_to_scalar_f ( F_INT *  alpha,
F_INT *  A,
F_INT *  IERROR 
)

References FLA_Obj_set_diagonal_to_scalar().

00605 {
00606   *IERROR = FLA_Obj_set_diagonal_to_scalar( *( ( FLA_Obj * ) alpha ),
00607                                             *( ( FLA_Obj * ) A     ) );
00608 }

FLA_Error FLA_Obj_set_to_identity ( FLA_Obj  A  ) 

References FLA_Check_error_level(), FLA_Obj_set_diagonal_to_scalar(), FLA_Obj_set_to_identity_check(), FLA_Obj_set_to_scalar(), FLA_ONE, and FLA_ZERO.

Referenced by FLA_Form_perm_matrix(), and fla_obj_set_to_identity_f().

00618 {
00619   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00620     FLA_Obj_set_to_identity_check( A );
00621 
00622   FLA_Obj_set_to_scalar( FLA_ZERO, A );
00623 
00624   FLA_Obj_set_diagonal_to_scalar( FLA_ONE, A );
00625 
00626   return FLA_SUCCESS;
00627 }

void FLA_F2C() fla_obj_set_to_identity_f ( F_INT *  A,
F_INT *  IERROR 
)

References FLA_Obj_set_to_identity().

00631 {
00632   *IERROR = FLA_Obj_set_to_identity( *( ( FLA_Obj * ) A ) );
00633 }

FLA_Error FLA_Obj_set_to_scalar ( FLA_Obj  alpha,
FLA_Obj  A 
)

References FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_ldim(), FLA_Obj_length(), FLA_Obj_set_to_scalar_check(), and FLA_Obj_width().

Referenced by FLA_Asum_external(), FLA_Nrm2_external(), FLA_Obj_set_to_identity(), fla_obj_set_to_scalar_f(), FLA_QR_UT_UD_blk_var1(), FLA_Scal_external(), FLA_Scalc_external(), FLA_Sylv_unb_external(), and FLASH_Obj_set_to_scalar().

00452 {
00453   FLA_Datatype datatype;
00454   dim_t        m_A, n_A, ldim_A;
00455   dim_t        i, j;
00456 
00457   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00458     FLA_Obj_set_to_scalar_check( alpha, A );
00459 
00460   datatype = FLA_Obj_datatype( A );
00461   m_A      = FLA_Obj_length( A );
00462   n_A      = FLA_Obj_width( A );
00463   ldim_A   = FLA_Obj_ldim( A );
00464 
00465   switch ( datatype ){
00466 
00467   case FLA_FLOAT:
00468   {
00469     float *buff_A     = ( float * ) FLA_FLOAT_PTR( A );
00470     float *buff_alpha = ( float * ) FLA_FLOAT_PTR( alpha );
00471  
00472     for ( j = 0; j < n_A; j++ )
00473       for ( i = 0; i < m_A; i++ )
00474         buff_A[ j * ldim_A + i ] = *buff_alpha;
00475 
00476     break;
00477   }
00478 
00479   case FLA_DOUBLE:
00480   {
00481     double *buff_A     = ( double * ) FLA_DOUBLE_PTR( A );
00482     double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( alpha );
00483  
00484     for ( j = 0; j < n_A; j++ )
00485       for ( i = 0; i < m_A; i++ )
00486         buff_A[ j * ldim_A + i ] = *buff_alpha;
00487 
00488     break;
00489   }
00490 
00491   case FLA_COMPLEX:
00492   {
00493     scomplex *buff_A     = ( scomplex * ) FLA_COMPLEX_PTR( A );
00494     scomplex *buff_alpha = ( scomplex * ) FLA_COMPLEX_PTR( alpha );
00495  
00496     for ( j = 0; j < n_A; j++ )
00497       for ( i = 0; i < m_A; i++ )
00498         buff_A[ j * ldim_A + i ] = *buff_alpha;
00499 
00500     break;
00501   }
00502 
00503   case FLA_DOUBLE_COMPLEX:
00504   {
00505     dcomplex *buff_A     = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00506     dcomplex *buff_alpha = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( alpha );
00507  
00508     for ( j = 0; j < n_A; j++ )
00509       for ( i = 0; i < m_A; i++ )
00510         buff_A[ j * ldim_A + i ] = *buff_alpha;
00511 
00512     break;
00513   }
00514 
00515   }
00516 
00517   return FLA_SUCCESS;
00518 }

void FLA_F2C() fla_obj_set_to_scalar_f ( F_INT *  alpha,
F_INT *  A,
F_INT *  IERROR 
)

References FLA_Obj_set_to_scalar().

00522 {
00523   *IERROR = FLA_Obj_set_to_scalar( *( ( FLA_Obj * ) alpha ),
00524                                    *( ( FLA_Obj * ) A     ) );
00525 }

FLA_Error FLA_Obj_shift_diagonal ( FLA_Obj  sigma,
FLA_Obj  A 
)

References FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_ldim(), FLA_Obj_min_dim(), FLA_Obj_shift_diagonal_check(), dcomplex::imag, scomplex::imag, dcomplex::real, and scomplex::real.

Referenced by fla_obj_shift_diagonal_f(), and FLASH_Obj_shift_diagonal().

00726 {
00727   FLA_Datatype datatype_A;
00728   FLA_Datatype datatype_sigma;
00729   dim_t        i, min_m_n, ldim_A;
00730 
00731   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
00732     FLA_Obj_shift_diagonal_check( sigma, A );
00733 
00734   ldim_A         = FLA_Obj_ldim( A );
00735   min_m_n        = FLA_Obj_min_dim( A );
00736   datatype_A     = FLA_Obj_datatype( A );
00737   datatype_sigma = FLA_Obj_datatype( sigma );
00738   
00739   switch( datatype_A ){
00740 
00741   case FLA_FLOAT:
00742   {
00743     float *buff_A     = ( float * ) FLA_FLOAT_PTR( A );
00744     float *buff_sigma = ( float * ) FLA_FLOAT_PTR( sigma );
00745 
00746     for ( i = 0; i < min_m_n; i++ )
00747       *( buff_A + i*ldim_A + i ) += *buff_sigma;
00748 
00749     break;
00750   }
00751 
00752   case FLA_DOUBLE:
00753   {
00754     double *buff_A     = ( double * ) FLA_DOUBLE_PTR( A );
00755     double *buff_sigma = ( double * ) FLA_DOUBLE_PTR( sigma );
00756 
00757     for ( i = 0; i < min_m_n; i++ )
00758       *( buff_A + i*ldim_A + i ) += *buff_sigma;
00759 
00760     break;
00761   }
00762 
00763   case FLA_COMPLEX:
00764   {
00765     if ( datatype_sigma == FLA_COMPLEX )
00766     {
00767       scomplex *buff_A     = ( scomplex * ) FLA_COMPLEX_PTR( A );
00768       scomplex *buff_sigma = ( scomplex * ) FLA_COMPLEX_PTR( sigma );
00769   
00770       for ( i = 0; i < min_m_n; i++ )
00771       {
00772         ( buff_A + i*ldim_A + i )->real += buff_sigma->real;
00773         ( buff_A + i*ldim_A + i )->imag += buff_sigma->imag;
00774       }
00775     }
00776     else
00777     {
00778       scomplex *buff_A     = ( scomplex * ) FLA_COMPLEX_PTR( A );
00779       float    *buff_sigma = ( float    * ) FLA_FLOAT_PTR( sigma );
00780   
00781       for ( i = 0; i < min_m_n; i++ )
00782       {
00783         ( buff_A + i*ldim_A + i )->real += *buff_sigma;
00784       }
00785     }
00786 
00787     break;
00788   }
00789 
00790   case FLA_DOUBLE_COMPLEX:
00791   {
00792     if ( datatype_sigma == FLA_DOUBLE_COMPLEX )
00793     {
00794       dcomplex *buff_A     = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00795       dcomplex *buff_sigma = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( sigma );
00796 
00797       for ( i = 0; i < min_m_n; i++ )
00798       {
00799         ( buff_A + i*ldim_A + i )->real += buff_sigma->real;
00800         ( buff_A + i*ldim_A + i )->imag += buff_sigma->imag;
00801       }
00802     }
00803     else
00804     {
00805       dcomplex *buff_A     = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
00806       double   *buff_sigma = ( double   * ) FLA_DOUBLE_PTR( sigma );
00807 
00808       for ( i = 0; i < min_m_n; i++ )
00809       {
00810         ( buff_A + i*ldim_A + i )->real += *buff_sigma;
00811       }
00812     }
00813 
00814     break;
00815   }
00816 
00817   }
00818 
00819   return FLA_SUCCESS;
00820 }

void FLA_F2C() fla_obj_shift_diagonal_f ( F_INT *  sigma,
F_INT *  A,
F_INT *  IERROR 
)

References FLA_Obj_shift_diagonal().

00824 {
00825   *IERROR = FLA_Obj_shift_diagonal( *( ( FLA_Obj * ) sigma ), 
00826                                     *( ( FLA_Obj * ) A     ) );
00827 }

FLA_Error FLA_Obj_show ( char *  s1,
FLA_Obj  A,
char *  format,
char *  s2 
)

References FLA_Obj_datatype(), FLA_Obj_ldim(), FLA_Obj_length(), and FLA_Obj_width().

Referenced by fla_obj_show_f(), and FLASH_Obj_show().

00950 {
00951   FLA_Datatype datatype;
00952   dim_t        m, n, i, j, ldim;
00953 
00954   datatype = FLA_Obj_datatype( A );
00955   m        = FLA_Obj_length  ( A );
00956   n        = FLA_Obj_width   ( A );
00957   ldim     = FLA_Obj_ldim    ( A );
00958 
00959   printf( "%s\n", s1 );
00960 
00961   switch ( datatype ){
00962 
00963   case FLA_FLOAT:
00964   {
00965     float *buffer = ( float * ) FLA_FLOAT_PTR( A );
00966 
00967     for ( i = 0; i < m; i++ )
00968     {
00969       for ( j = 0; j < n; j++ )
00970       {
00971         printf( format, BUFFER( i, j, ldim ) );
00972         printf( " " );
00973       }
00974       printf( "\n" );
00975     }
00976     printf("%s\n", s2 );
00977     break;
00978   }
00979 
00980   case FLA_DOUBLE:
00981   {
00982     double *buffer = ( double * ) FLA_DOUBLE_PTR( A );
00983 
00984     for ( i = 0; i < m; i++ )
00985     {
00986       for ( j = 0; j < n; j++ )
00987       {
00988         printf( format, BUFFER( i, j, ldim ) );
00989         printf( " " );
00990       }
00991       printf( "\n" );
00992     }
00993     printf("%s\n", s2 );
00994     break;
00995   }
00996 
00997   case FLA_COMPLEX:
00998   {
00999     scomplex *buffer = ( scomplex * ) FLA_COMPLEX_PTR( A );
01000 
01001     for ( i = 0; i < m; i++ )
01002     {
01003       for ( j = 0; j < n; j++ )
01004       {
01005         printf( format, BUFFER(i,j,ldim).real, BUFFER(i,j,ldim).imag );
01006         printf( " " );
01007       }
01008       printf( "\n" );
01009     }
01010     printf("%s\n", s2 );
01011     break;
01012   }
01013 
01014   case FLA_DOUBLE_COMPLEX:
01015   {
01016     dcomplex *buffer = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A );
01017 
01018     for ( i = 0; i < m; i++ )
01019     {
01020       for ( j = 0; j < n; j++ )
01021       {
01022         printf( format, BUFFER(i,j,ldim).real, BUFFER(i,j,ldim).imag );
01023         printf( " " );
01024       }
01025       printf( "\n" );
01026     }
01027     printf("%s\n", s2 );
01028     break;
01029   }
01030 
01031   case FLA_INT:
01032   {
01033     int *buffer = ( int * ) FLA_INT_PTR( A );
01034 
01035     for ( i = 0; i < m; i++ )
01036     {
01037       for ( j = 0; j < n; j++ )
01038       {
01039         printf( format, BUFFER( i, j, ldim ) );
01040         printf( " " );
01041       }
01042       printf( "\n" );
01043     }
01044     printf("%s\n", s2 );
01045     break;
01046   }
01047 
01048   }
01049 
01050   return FLA_SUCCESS;
01051 }

void FLA_F2C() fla_obj_show_f ( F_INT *  s1,
F_INT *  A,
F_INT *  format,
F_INT *  s2,
F_INT *  IERROR 
)

References FLA_Obj_show().

01055 {
01056   *IERROR = FLA_Obj_show(  ( ( char    * ) s1     ), 
01057                           *( ( FLA_Obj * ) A      ), 
01058                            ( ( char    * ) format ), 
01059                            ( ( char    * ) s2     ) );
01060 }


Generated on Mon Jul 6 05:45:53 2009 for libflame by  doxygen 1.5.9