libflame revision_anchor
Functions | Variables
FLASH_QR_UT.c File Reference

(r)

Functions

FLA_Error FLASH_QR_UT (FLA_Obj A, FLA_Obj TW)

Variables

fla_qrut_tflash_qrut_cntl
fla_qrut_tfla_qrut_cntl_leaf

Function Documentation

FLA_Error FLASH_QR_UT ( FLA_Obj  A,
FLA_Obj  TW 
)

References FLA_Abort(), FLA_Check_error_level(), FLA_Print_message(), FLA_QR_UT_check(), FLA_QR_UT_internal(), FLASH_Obj_depth(), FLASH_Obj_scalar_length_tl(), FLASH_Obj_scalar_min_dim(), FLASH_Obj_scalar_width_tl(), FLASH_Queue_begin(), and FLASH_Queue_end().

{
  FLA_Error r_val;
  dim_t     b_alg, b_flash;

  // Check parameters.
  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
    FLA_QR_UT_check( A, TW );

  // *** The current hierarchical QR_UT algorithm assumes that the matrix
  // has a hierarchical depth of 1. We check for that here, because we
  //  anticipate that we'll use a more general algorithm in the future, and
  // we don't want to forget to remove the constraint. ***
  if ( FLASH_Obj_depth( A ) != 1 )
  {
    FLA_Print_message( "FLASH_QR_UT() currently only supports matrices of depth 1",
                       __FILE__, __LINE__ );
    FLA_Abort();
  }

  // Inspect the length of TTL to get the blocksize used by the QR
  // factorization, which will be our inner blocksize for Apply_Q_UT.
  b_alg   = FLASH_Obj_scalar_length_tl( TW );
  b_flash = FLASH_Obj_scalar_width_tl( TW );

  // The traditional (non-incremental) QR_UT algorithm-by-blocks requires
  // that the algorithmic blocksize be equal to the storage blocksize.
  if ( b_alg != b_flash )
  {
    FLA_Print_message( "FLASH_QR_UT() requires that b_alg == b_store",
                       __FILE__, __LINE__ );
    FLA_Abort();
  }

  // The traditional (non-incremental) QR_UT algorithm-by-blocks requires
  // that min_dim(A) % b_flash == 0.
  if ( FLASH_Obj_scalar_min_dim( A ) % b_flash != 0 )
  {
    FLA_Print_message( "FLASH_QR_UT() requires that min_dim( A ) %% b_store == 0",
                       __FILE__, __LINE__ );
    FLA_Abort();
  }

  // Begin a parallel region.
  FLASH_Queue_begin();

  // Invoke FLA_QR_UT_internal() with hierarchical control tree.
  r_val = FLA_QR_UT_internal( A, TW, flash_qrut_cntl );

  // End the parallel region.
  FLASH_Queue_end();

  return r_val;
}

Variable Documentation