libflame  revision_anchor
Functions
FLA_UDdate_UT.h File Reference

(r)

Go to the source code of this file.

Functions

FLA_Error FLA_UDdate_UT (FLA_Obj R, FLA_Obj C, FLA_Obj D, FLA_Obj T)
FLA_Error FLA_UDdate_UT_internal (FLA_Obj R, FLA_Obj C, FLA_Obj D, FLA_Obj T, fla_uddateut_t *cntl)
FLA_Error FLA_UDdate_UT_create_T (FLA_Obj R, FLA_Obj *T)
FLA_Error FLA_UDdate_UT_update_rhs (FLA_Obj T, FLA_Obj bR, FLA_Obj C, FLA_Obj bC, FLA_Obj D, FLA_Obj bD)
FLA_Error FLA_UDdate_UT_solve (FLA_Obj R, FLA_Obj bR, FLA_Obj x)

Function Documentation

References FLA_Check_error_level(), FLA_UDdate_UT_check(), and FLA_UDdate_UT_internal().

{
  FLA_Error r_val;

  // Check parameters.
  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
    FLA_UDdate_UT_check( R, C, D, T );

  // Invoke the _internal() back-end with the standard control tree.
  r_val = FLA_UDdate_UT_internal( R, C, D, T, fla_uddateut_cntl_leaf );

  return r_val;
}

References FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_row_stride(), FLA_Obj_width(), and FLA_Query_blocksize().

{
  FLA_Datatype datatype;
  dim_t        b_alg, k;
  dim_t        rs_T, cs_T;

  // Query the datatype of R.
  datatype = FLA_Obj_datatype( R );

  // Query the blocksize from the library.
  b_alg = FLA_Query_blocksize( datatype, FLA_DIMENSION_MIN );

  // We want the width of R, which is the same as that of C and D. Also,
  // R should be square, so we could grab either dimension.
  k = FLA_Obj_width( R );

  // Figure out whether T should be row-major or column-major.
  if ( FLA_Obj_row_stride( R ) == 1 )
  {
    rs_T = 1;
    cs_T = b_alg;
  }
  else // if ( FLA_Obj_col_stride( R ) == 1 )
  {
    rs_T = k;
    cs_T = 1;
  }

  // Create a b_alg x k matrix to hold the block Householder transforms that
  // will be accumulated within the UDdate operation algorithm.
  FLA_Obj_create( datatype, b_alg, k, rs_T, cs_T, T );

  return FLA_SUCCESS;
}

References FLA_Check_error_level(), FLA_Obj_elemtype(), FLA_UDdate_UT_blk_var1(), FLA_UDdate_UT_blk_var2(), FLA_UDdate_UT_internal(), FLA_UDdate_UT_internal_check(), FLA_UDdate_UT_opt_var1(), FLA_UDdate_UT_unb_var1(), fla_uddateut_cntl_leaf, and FLASH_Queue_get_enabled().

Referenced by FLA_UDdate_UT(), FLA_UDdate_UT_blk_var1(), FLA_UDdate_UT_blk_var2(), FLA_UDdate_UT_inc_blk_var1(), FLA_UDdate_UT_internal(), and FLA_UDdate_UT_task().

{
    FLA_Error r_val = FLA_SUCCESS;
    
    if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
        FLA_UDdate_UT_internal_check( R, C, D, T, cntl );

    if      ( FLA_Cntl_matrix_type( cntl ) == FLA_HIER &&
              FLA_Obj_elemtype( R ) == FLA_MATRIX &&
              FLA_Cntl_variant( cntl ) == FLA_SUBPROBLEM )
    {
        // Recurse
        r_val = FLA_UDdate_UT_internal( *FLASH_OBJ_PTR_AT( R ),
                                        *FLASH_OBJ_PTR_AT( C ),
                                        *FLASH_OBJ_PTR_AT( D ),
                                        *FLASH_OBJ_PTR_AT( T ),
                                        flash_uddateut_cntl );
    }
    else if ( FLA_Cntl_matrix_type( cntl ) == FLA_HIER &&
              FLA_Obj_elemtype( R ) == FLA_SCALAR &&
              FLASH_Queue_get_enabled( ) )
    {
        // Enqueue
        ENQUEUE_FLASH_UDdate_UT( R, C, D, T, cntl );
    }
    else
    {
        if ( FLA_Cntl_matrix_type( cntl ) == FLA_HIER &&
             FLA_Obj_elemtype( R ) == FLA_SCALAR &&
             !FLASH_Queue_get_enabled( ) )
        {
            // Execute leaf.
            cntl = fla_uddateut_cntl_leaf;
        }

        if      ( FLA_Cntl_variant( cntl ) == FLA_UNBLOCKED_VARIANT1 )
        {
            r_val = FLA_UDdate_UT_unb_var1( R, C, D, T );
        }
        else if ( FLA_Cntl_variant( cntl ) == FLA_UNB_OPT_VARIANT1 )
        {
            r_val = FLA_UDdate_UT_opt_var1( R, C, D, T );
        }
        else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT1 )
        {
            r_val = FLA_UDdate_UT_blk_var1( R, C, D, T, cntl );
        }
        else if ( FLA_Cntl_variant( cntl ) == FLA_BLOCKED_VARIANT2 )
        {
            r_val = FLA_UDdate_UT_blk_var2( R, C, D, T, cntl );
        }
        else
        {
            FLA_Check_error_code( FLA_NOT_YET_IMPLEMENTED );
        }
    }

    return r_val;
}

References FLA_Check_error_level(), FLA_Copy_external(), FLA_ONE, FLA_Trsm_external(), and FLA_UDdate_UT_solve_check().

{
    // Check parameters.
    if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
        FLA_UDdate_UT_solve_check( R, bR, x );

    // Copy the contents of bR to x so that after the triangular solve, the
    // solution resides in x (and bR is preserved).
    FLA_Copy_external( bR, x );
    
    // Perform a triangular solve with R the right-hand side.
    FLA_Trsm_external( FLA_LEFT, FLA_UPPER_TRIANGULAR,
                       FLA_NO_TRANSPOSE, FLA_NONUNIT_DIAG,
                       FLA_ONE, R, x );

    return FLA_SUCCESS;
}

References FLA_Apply_QUD_UT(), FLA_Apply_QUD_UT_create_workspace(), FLA_Check_error_level(), FLA_Obj_create_copy_of(), FLA_Obj_free(), and FLA_UDdate_UT_update_rhs_check().

{
    FLA_Obj W;
    FLA_Obj bC_copy;
    FLA_Obj bD_copy;

    // Check parameters.
    if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
        FLA_UDdate_UT_update_rhs_check( T, bR, C, bC, D, bD );

    // Create workspace according to the algorithmic blocksize (length of T)
    // and the number of right-hand sides.
    FLA_Apply_QUD_UT_create_workspace( T, bR, &W );
    
    // Make temporary copies of the bC and bD right-hand side objects so we
    // don't destory their original contents.
    FLA_Obj_create_copy_of( FLA_NO_TRANSPOSE, bC, &bC_copy );
    FLA_Obj_create_copy_of( FLA_NO_TRANSPOSE, bD, &bD_copy );

    // Apply the updowndating Q' to the right-hand sides.
    FLA_Apply_QUD_UT( FLA_LEFT, FLA_CONJ_TRANSPOSE, FLA_FORWARD, FLA_COLUMNWISE,
                      T, W,
                         bR,
                      C, bC_copy,
                      D, bD_copy );

    // Free the temporary objects.
    FLA_Obj_free( &bC_copy );
    FLA_Obj_free( &bD_copy );

    // Free the workspace object.
    FLA_Obj_free( &W );

    return FLA_SUCCESS;
}