libflame  12600
Functions
FLA_Shift_pivots_to.c File Reference

(r12600)

Functions

FLA_Error FLA_Shift_pivots_to (FLA_Pivot_type ptype, FLA_Obj p)

Function Documentation

References FLA_Check_error_level(), FLA_Obj_length(), FLA_Obj_width(), and FLA_Shift_pivots_to_check().

Referenced by FLA_LU_piv_blk_external(), and FLA_LU_piv_unb_external().

{
  int  m_p, n_p;
  int* buff_p;
  int  i;

  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
    FLA_Shift_pivots_to_check( ptype, p );

  m_p    = FLA_Obj_length( p );
  n_p    = FLA_Obj_width( p );
  buff_p = FLA_INT_PTR( p );

  if ( m_p < 1 || n_p < 1 ) return FLA_SUCCESS;

  if ( ptype == FLA_LAPACK_PIVOTS )
  {
    // Shift FLAME pivots to LAPACK pivots.
    for ( i = 0; i < m_p; i++ )
      buff_p[ i ] += i + 1;
  }
  else
  {
    // Otherwise, shift LAPACK pivots back to FLAME.
    for ( i = 0; i < m_p; i++ )
      buff_p[ i ] -= i + 1;
  }

  return FLA_SUCCESS;
}