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
FLA_Copyr_l_blk_var2(FLA_Obj A,FLA_Obj B,fla_copyr_t * cntl)13 FLA_Error FLA_Copyr_l_blk_var2( FLA_Obj A, FLA_Obj B, fla_copyr_t* cntl )
14 {
15 FLA_Obj ATL, ATR, A00, A01, A02,
16 ABL, ABR, A10, A11, A12,
17 A20, A21, A22;
18
19 FLA_Obj BTL, BTR, B00, B01, B02,
20 BBL, BBR, B10, B11, B12,
21 B20, B21, B22;
22
23 dim_t b;
24
25 FLA_Part_2x2( A, &ATL, &ATR,
26 &ABL, &ABR, 0, 0, FLA_BR );
27
28 FLA_Part_2x2( B, &BTL, &BTR,
29 &BBL, &BBR, 0, 0, FLA_BR );
30
31 while ( FLA_Obj_min_dim( ATL ) > 0 ){
32
33 b = FLA_Determine_blocksize( ATL, FLA_TL, FLA_Cntl_blocksize( cntl ) );
34
35 FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, &A01, /**/ &A02,
36 &A10, &A11, /**/ &A12,
37 /* ************* */ /* ******************** */
38 ABL, /**/ ABR, &A20, &A21, /**/ &A22,
39 b, b, FLA_TL );
40
41 FLA_Repart_2x2_to_3x3( BTL, /**/ BTR, &B00, &B01, /**/ &B02,
42 &B10, &B11, /**/ &B12,
43 /* ************* */ /* ******************** */
44 BBL, /**/ BBR, &B20, &B21, /**/ &B22,
45 b, b, FLA_TL );
46
47 /*------------------------------------------------------------*/
48
49 // B11 = tril( A11 );
50 FLA_Copyr_internal( FLA_LOWER_TRIANGULAR, A11, B11,
51 FLA_Cntl_sub_copyr( cntl ) );
52
53 // B10 = A10;
54 FLA_Copy_internal( A10, B10,
55 FLA_Cntl_sub_copy( cntl ) );
56
57 /*------------------------------------------------------------*/
58
59 FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, /**/ A01, A02,
60 /* ************** */ /* ****************** */
61 A10, /**/ A11, A12,
62 &ABL, /**/ &ABR, A20, /**/ A21, A22,
63 FLA_BR );
64
65 FLA_Cont_with_3x3_to_2x2( &BTL, /**/ &BTR, B00, /**/ B01, B02,
66 /* ************** */ /* ****************** */
67 B10, /**/ B11, B12,
68 &BBL, /**/ &BBR, B20, /**/ B21, B22,
69 FLA_BR );
70 }
71
72 return FLA_SUCCESS;
73 }
74
75