libflame  12600
Functions
FLA_Amax_external.c File Reference

(r12600)

Functions

FLA_Error FLA_Amax_external (FLA_Obj x, FLA_Obj index)

Function Documentation

References bl1_camax(), bl1_damax(), bl1_samax(), bl1_zamax(), FLA_Amax_check(), FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_vector_dim(), and FLA_Obj_vector_inc().

Referenced by FLA_Amax(), FLA_LU_piv_unb_var3(), FLA_LU_piv_unb_var3b(), FLA_LU_piv_unb_var4(), FLA_LU_piv_unb_var5(), FLA_QR_UT_piv_unb_var1(), and FLA_QR_UT_piv_unb_var2().

{
  FLA_Datatype datatype;
  int          num_elem;
  int          inc_x;
  int         *buff_index;

  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING ) 
    FLA_Amax_check( x, index );

  buff_index = ( int * ) FLA_INT_PTR( index );

  if ( FLA_Obj_has_zero_dim( x ) )
  {
    *buff_index = 0;
    return FLA_SUCCESS;
  }

  datatype = FLA_Obj_datatype( x );

  inc_x    = FLA_Obj_vector_inc( x );
  num_elem = FLA_Obj_vector_dim( x );


  switch ( datatype ){

  case FLA_FLOAT:
  {
    float* buff_x = ( float * ) FLA_FLOAT_PTR( x );

    bl1_samax( num_elem,
               buff_x, inc_x,
               buff_index );

    break;
  }
  
  case FLA_DOUBLE:
  {
    double* buff_x = ( double * ) FLA_DOUBLE_PTR( x );

    bl1_damax( num_elem,
               buff_x, inc_x,
               buff_index );

    break;
  }
  
  case FLA_COMPLEX:
  {
    scomplex* buff_x = ( scomplex * ) FLA_COMPLEX_PTR( x );

    bl1_camax( num_elem,
               buff_x, inc_x,
               buff_index );

    break;
  }

  case FLA_DOUBLE_COMPLEX:
  {
    dcomplex* buff_x = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( x );

    bl1_zamax( num_elem,
               buff_x, inc_x,
               buff_index );

    break;
  }

  }

  return FLA_SUCCESS;
}