| 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 |
FLA_Error FLA_LQ_UT_unb_var2( FLA_Obj A, FLA_Obj T ) |
| 14 |
{ |
| 15 |
FLA_Obj ATL, ATR, A00, a01, A02, |
| 16 |
ABL, ABR, a10t, alpha11, a12t, |
| 17 |
A20, a21, A22; |
| 18 |
|
| 19 |
FLA_Obj TTL, TTR, T00, t01, T02, |
| 20 |
TBL, TBR, t10t, tau11, t12t, |
| 21 |
T20, t21, T22; |
| 22 |
|
| 23 |
|
| 24 |
FLA_Part_2x2( A, &ATL, &ATR, |
| 25 |
&ABL, &ABR, 0, 0, FLA_TL ); |
| 26 |
|
| 27 |
FLA_Part_2x2( T, &TTL, &TTR, |
| 28 |
&TBL, &TBR, 0, 0, FLA_TL ); |
| 29 |
|
| 30 |
while ( FLA_Obj_min_dim( ABR ) > 0 ){ |
| 31 |
|
| 32 |
FLA_Repart_2x2_to_3x3( ATL, /**/ ATR, &A00, /**/ &a01, &A02, |
| 33 |
/* ************* */ /* ************************** */ |
| 34 |
&a10t, /**/ &alpha11, &a12t, |
| 35 |
ABL, /**/ ABR, &A20, /**/ &a21, &A22, |
| 36 |
1, 1, FLA_BR ); |
| 37 |
|
| 38 |
FLA_Repart_2x2_to_3x3( TTL, /**/ TTR, &T00, /**/ &t01, &T02, |
| 39 |
/* ************* */ /* ************************ */ |
| 40 |
&t10t, /**/ &tau11, &t12t, |
| 41 |
TBL, /**/ TBR, &T20, /**/ &t21, &T22, |
| 42 |
1, 1, FLA_BR ); |
| 43 |
|
| 44 |
/*------------------------------------------------------------*/ |
| 45 |
|
| 46 |
// Compute tau11 and u12t from alpha11 and a12t such that tau11 and u12t |
| 47 |
// determine a Householder transform H such that applying H from the |
| 48 |
// right to the row vector consisting of alpha11 and a12t annihilates |
| 49 |
// the entries in a12t (and updates alpha11). |
| 50 |
FLA_Househ2_UT( FLA_RIGHT, alpha11, a12t, |
| 51 |
tau11 ); |
| 52 |
|
| 53 |
// ( a21 A22 ) = ( a21 A22 ) H |
| 54 |
// |
| 55 |
// where H is formed from tau11 and u12t. |
| 56 |
FLA_Apply_H2_UT( FLA_RIGHT, tau11, a12t, a21, A22 ); |
| 57 |
|
| 58 |
// t01 = conj(a01) + conj(A02) * u12t^T; |
| 59 |
FLA_Copyt_external( FLA_CONJ_NO_TRANSPOSE, a01, t01 ); |
| 60 |
FLA_Gemvc_external( FLA_CONJ_NO_TRANSPOSE, FLA_NO_CONJUGATE, FLA_ONE, A02, a12t, FLA_ONE, t01 ); |
| 61 |
|
| 62 |
/*------------------------------------------------------------*/ |
| 63 |
|
| 64 |
FLA_Cont_with_3x3_to_2x2( &ATL, /**/ &ATR, A00, a01, /**/ A02, |
| 65 |
a10t, alpha11, /**/ a12t, |
| 66 |
/* ************** */ /* ************************ */ |
| 67 |
&ABL, /**/ &ABR, A20, a21, /**/ A22, |
| 68 |
FLA_TL ); |
| 69 |
|
| 70 |
FLA_Cont_with_3x3_to_2x2( &TTL, /**/ &TTR, T00, t01, /**/ T02, |
| 71 |
t10t, tau11, /**/ t12t, |
| 72 |
/* ************** */ /* ********************** */ |
| 73 |
&TBL, /**/ &TBR, T20, t21, /**/ T22, |
| 74 |
FLA_TL ); |
| 75 |
|
| 76 |
} |
| 77 |
|
| 78 |
return FLA_SUCCESS; |
| 79 |
} |
| 80 |
|