libflame  revision_anchor
Functions
FLA_Chol_u_unb_var3.c File Reference

(r)

Functions

FLA_Error FLA_Chol_u_unb_var3 (FLA_Obj A)

Function Documentation

References FLA_Cont_with_3x3_to_2x2(), FLA_Herc_external(), FLA_Inv_scal_external(), FLA_MINUS_ONE, FLA_Obj_length(), FLA_Part_2x2(), FLA_Repart_2x2_to_3x3(), and FLA_Sqrt().

Referenced by FLA_Chol_u().

{
  FLA_Obj ATL,   ATR,      A00,  a01,     A02,
          ABL,   ABR,      a10t, alpha11, a12t,
                           A20,  a21,     A22;

  int value = 0;

  FLA_Part_2x2( A,    &ATL, &ATR,
                      &ABL, &ABR,     0, 0, FLA_TL );

  while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){

    FLA_Repart_2x2_to_3x3( ATL, /**/ ATR,       &A00,  /**/ &a01,     &A02,
                        /* ************* */   /* ************************** */
                                                &a10t, /**/ &alpha11, &a12t,
                           ABL, /**/ ABR,       &A20,  /**/ &a21,     &A22,
                           1, 1, FLA_BR );

    /*------------------------------------------------------------*/

    // alpha11 = sqrt( alpha11 )
    value = FLA_Sqrt( alpha11 );

    if ( value != FLA_SUCCESS )
      return ( FLA_Obj_length( A00 ) + 1 );

    // a12t = a12t / alpha11
    FLA_Inv_scal_external( alpha11, a12t );

    // A22 = A22 - a12t' * a12t
    FLA_Herc_external( FLA_UPPER_TRIANGULAR, FLA_CONJUGATE, FLA_MINUS_ONE, a12t, A22 );

    /*------------------------------------------------------------*/

    FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR,       A00,  a01,     /**/ A02,
                                                     a10t, alpha11, /**/ a12t,
                            /* ************** */  /* ************************ */
                              &ABL, /**/ &ABR,       A20,  a21,     /**/ A22,
                              FLA_TL );
  }

  return value;
}