1 /*
2
3 Copyright (C) 2014, The University of Texas at Austin
4
5 This file is part of libflame and is available under the 3-Clause
6 BSD license, which can be found in the LICENSE file at the top-level
7 directory, or at http://opensource.org/licenses/BSD-3-Clause
8
9 */
10
11 #include "FLAME.h"
12
13 #ifdef FLA_ENABLE_NON_CRITICAL_CODE
14
FLA_Chol_l_unb_var2(FLA_Obj A)15 FLA_Error FLA_Chol_l_unb_var2( FLA_Obj A )
16 {
17 FLA_Obj ATL, ATR, A00, a01, A02,
18 ABL, ABR, a10t, alpha11, a12t,
19 A20, a21, A22;
20
21 int r_val = FLA_SUCCESS;
22
23 FLA_Part_2x2( A, &ATL, &ATR,
24 &ABL, &ABR, 0, 0, FLA_TL );
25
26 while ( FLA_Obj_length( ATL ) < FLA_Obj_length( A ) ){
27
28 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02,
29 /* ************* */ /* ************************** */
30 &a10t, /**/ &alpha11, &a12t,
31 ABL, /**/ ABR, &A20, /**/ &a21, &A22,
32 1, 1, FLA_BR );
33
34 /*------------------------------------------------------------*/
35
36 // alpha11 = alpha11 - a10t * a10t'
37 FLA_Dotcs_external( FLA_CONJUGATE, FLA_MINUS_ONE, a10t, a10t, FLA_ONE, alpha11 );
38
39 // a21 = a21 - A20 * a10t'
40 FLA_Gemvc_external( FLA_NO_TRANSPOSE, FLA_CONJUGATE, FLA_MINUS_ONE, A20, a10t, FLA_ONE, a21 );
41
42 // alpha11 = sqrt( alpha11 )
43 r_val = FLA_Sqrt( alpha11 );
44
45 if ( r_val != FLA_SUCCESS )
46 return ( FLA_Obj_length( A00 ) );
47
48 // a21 = a21 / alpha11
49 FLA_Inv_scal_external( alpha11, a21 );
50
51 /*------------------------------------------------------------*/
52
53 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02,
54 a10t, alpha11, /**/ a12t,
55 /* ************** */ /* ************************ */
56 &ABL, /**/ &ABR, A20, a21, /**/ A22,
57 FLA_TL );
58 }
59
60 return r_val;
61 }
62
63 #endif
64