FLA_Conjugate.c File Reference

(r)


Functions

FLA_Error FLA_Conjugate (FLA_Obj A)
void FLA_F2C() fla_conjugate_f (F_INT *A, F_INT *IERROR)

Function Documentation

FLA_Error FLA_Conjugate ( FLA_Obj  A  ) 

References cblas_dscal(), cblas_sscal(), dscal(), FLA_Check_error_level(), FLA_Conjugate_check(), FLA_MINUS_ONE, FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_is_real(), FLA_Obj_is_vector(), FLA_Obj_ldim(), FLA_Obj_length(), FLA_Obj_vector_dim(), FLA_Obj_width(), and sscal().

Referenced by fla_conjugate_f(), FLA_Copyt_external(), and FLA_Swapt_external().

00036 {
00037   FLA_Datatype datatype;
00038   int          j, n_iter;
00039   int          num_elem;
00040   int          m_A, n_A, inc_A, ldim_A;
00041 
00042   if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING ) 
00043     FLA_Conjugate_check( A );
00044 
00045   if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS;
00046 
00047   if ( FLA_Obj_is_real( A ) ) return FLA_SUCCESS;
00048 
00049   datatype = FLA_Obj_datatype( A );
00050 
00051   m_A      = FLA_Obj_length( A );
00052   n_A      = FLA_Obj_width( A );
00053   ldim_A   = FLA_Obj_ldim( A );
00054 
00055   if ( FLA_Obj_is_vector( A ) )
00056   {
00057     inc_A    = ( m_A == 1 ? 2*ldim_A : 2 );
00058     n_iter   = 1;
00059     num_elem = FLA_Obj_vector_dim( A );
00060   }
00061   else
00062   {
00063     inc_A    = 2;
00064     n_iter   = n_A;
00065     num_elem = m_A;
00066   }
00067 
00068   switch ( datatype ){
00069 
00070   case FLA_COMPLEX:
00071   {
00072     float *buff_A     = ( float * ) FLA_COMPLEX_PTR( A );
00073     float *buff_alpha = ( float * ) FLA_FLOAT_PTR( FLA_MINUS_ONE );
00074 
00075     for ( j = 0; j < n_iter; ++j )
00076     {
00077 #ifdef FLA_ENABLE_CBLAS_INTERFACE
00078       cblas_sscal( num_elem,
00079                    *buff_alpha,
00080                    buff_A+1 + j*2*ldim_A, inc_A );
00081 #else
00082       FLA_C2F( sscal )( &num_elem,
00083                         buff_alpha,
00084                         buff_A+1 + j*2*ldim_A, &inc_A );
00085 #endif
00086     }
00087 
00088     break;
00089   }
00090 
00091   case FLA_DOUBLE_COMPLEX:
00092   { 
00093     double *buff_A     = ( double * ) FLA_DOUBLE_COMPLEX_PTR( A );
00094     double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( FLA_MINUS_ONE );
00095 
00096     for ( j = 0; j < n_iter; ++j )
00097     {
00098 #ifdef FLA_ENABLE_CBLAS_INTERFACE
00099       cblas_dscal( num_elem,
00100                    *buff_alpha,
00101                    buff_A+1 + j*2*ldim_A, inc_A );
00102 #else
00103       FLA_C2F( dscal )( &num_elem,
00104                         buff_alpha,
00105                         buff_A+1 + j*2*ldim_A, &inc_A );
00106 #endif
00107     }
00108 
00109     break;
00110   }
00111 
00112   }
00113   
00114   return FLA_SUCCESS;
00115 }

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

References FLA_Conjugate().

00119 {
00120   *IERROR = FLA_Conjugate( *( ( FLA_Obj * ) A ) );
00121 }


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