FLA_QR_UT_inc_create_U.c File Reference

(r)


Functions

FLA_Error FLA_QR_UT_inc_create_U_panel (FLA_Obj A, FLA_Obj *U)
FLA_Error FLA_QR_UT_inc_free_U_panel (FLA_Obj *U)
FLA_Error FLA_QR_UT_inc_create_U (FLA_Obj A, FLA_Obj *U)
FLA_Error FLA_QR_UT_inc_free_U (FLA_Obj U)

Function Documentation

FLA_Error FLA_QR_UT_inc_create_U ( FLA_Obj  A,
FLA_Obj U 
)

References FLASH_Obj_create_conf_to().

00114 {
00115     FLASH_Obj_create_conf_to( FLA_NO_TRANSPOSE, A, U );
00116 
00117     return FLA_SUCCESS;
00118 }

FLA_Error FLA_QR_UT_inc_create_U_panel ( FLA_Obj  A,
FLA_Obj U 
)

References FLA_Obj_datatype(), FLA_Obj_length(), FLA_Part_1x2(), FLA_Part_2x2(), FLASH_Obj_create(), and FLASH_Obj_scalar_length().

Referenced by FLASH_QR_UT_inc_opt1().

00036 {
00037     FLA_Datatype datatype;
00038     FLA_Obj      ATL,  ATR,
00039                  ABL,  ABR;
00040     dim_t        b_flash;
00041     dim_t        b_flash_last;
00042     dim_t        n_blocks_mn;
00043     dim_t        m_U, n_U;
00044 
00045     // Acquire the datatype of the matrix to be factored.
00046     datatype = FLA_Obj_datatype( A );
00047 
00048     // Acquire the storage blocksize of the top-left element.
00049     FLA_Part_2x2( A,   &ATL, &ATR,
00050                        &ABL, &ABR,     1, 1, FLA_TL );
00051 
00052     b_flash = FLASH_Obj_scalar_length( ATL );
00053 
00054     // Get the number of storage blocks in the m dimension of A (which
00055     // should be the same as the number of storage blocks in the n
00056     // dimension since A should be square).
00057     n_blocks_mn = FLA_Obj_length( A );
00058 
00059     // Compute the scalar length and width of U.
00060     m_U = b_flash;
00061     n_U = n_blocks_mn * b_flash;
00062 
00063     // Create U with storage blocksize of b_flash.
00064     FLASH_Obj_create( datatype, m_U, n_U, 1, &b_flash, U );
00065 
00066     // The last, bottom-right-most diagonal block of A might be smaller
00067     // than the other diagonal blocks. Compute the size of this block.
00068     b_flash_last = FLASH_Obj_scalar_length( A ) % b_flash;
00069 
00070     // If the remainder is zero, then A does not need its last block
00071     // shrunk and thus it is ready as-is. However, if b_flash_last is
00072     // non-zero, then we must manually adjust the size of the last block of
00073     // U. Note that we are not freeing and re-allocating memory, just
00074     // changing the size of the view into the last block.
00075 
00076     if ( b_flash_last > 0 )
00077     {
00078         FLA_Obj  UL,    UR;
00079         FLA_Obj  URTL,  URTR,
00080                  URBL,  URBR;
00081         FLA_Obj* UR_p;
00082 
00083         // Repartition U so we can access the last block object.
00084         FLA_Part_1x2( *U,   &UL, &UR,    1, FLA_RIGHT );
00085 
00086         // Dereference the 1x1 object reference to get a pointer to
00087         // the actual block object in U.
00088         UR_p = FLASH_OBJ_PTR_AT( UR );
00089 
00090         // Repartition the last block object so that URTL is the
00091         // correct size.
00092         FLA_Part_2x2( *UR_p,    &URTL, &URTR,
00093                                 &URBL, &URBR,     b_flash_last,
00094                                                   b_flash_last, FLA_TL );
00095 
00096         // Overwrite the original object pointed to by UR_p with the
00097         // corrected object URTL.
00098         *UR_p = URTL;
00099     }
00100 
00101     return FLA_SUCCESS;
00102 }

FLA_Error FLA_QR_UT_inc_free_U ( FLA_Obj  U  ) 

References FLA_Obj_free(), FLA_Obj_free_task(), and FLASH_Queue_get_enabled().

00121 {
00122     if ( FLASH_Queue_get_enabled() )
00123     {
00124         // Enqueue task.
00125         ENQUEUE_FLASH_Obj_free( *FLASH_OBJ_PTR_AT( U ),
00126                                 NULL );
00127 
00128         // Manually free the top level of the hierarchy that was
00129         // created in FLA_QR_UT_inc_create_U().
00130         FLA_Obj_free( &U );
00131     }
00132     else
00133     {
00134         // Execute task immediately.
00135         FLA_Obj_free_task( *FLASH_OBJ_PTR_AT( U ), 
00136                            NULL );
00137 
00138         // Manually free the top level of the hierarchy that was
00139         // created in FLA_QR_UT_inc_create_U().
00140         //FLA_Obj_free( &U );
00141     }
00142 
00143     return FLA_SUCCESS;
00144 }

FLA_Error FLA_QR_UT_inc_free_U_panel ( FLA_Obj U  ) 

References FLASH_Obj_free().

Referenced by FLASH_QR_UT_inc_opt1().

00105 {
00106     FLASH_Obj_free( U );
00107 
00108     return FLA_SUCCESS;
00109 }


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