libflame  revision_anchor
Functions
FLA_Bidiag_UT_form_U_ext.c File Reference

(r)

Functions

FLA_Error FLA_Bidiag_UT_form_U_ext (FLA_Uplo uplo, FLA_Obj A, FLA_Obj T, FLA_Trans transu, FLA_Obj U)
 

Function Documentation

◆ FLA_Bidiag_UT_form_U_ext()

FLA_Error FLA_Bidiag_UT_form_U_ext ( FLA_Uplo  uplo,
FLA_Obj  A,
FLA_Obj  T,
FLA_Trans  transu,
FLA_Obj  U 
)

References FLA_Apply_pivots(), FLA_Bidiag_UT_form_V_ext(), FLA_Obj_create(), FLA_Obj_flip_base(), FLA_Obj_flip_view(), FLA_Obj_free(), FLA_Obj_is(), FLA_Obj_length(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_Part_2x2(), FLA_QR_UT_form_Q(), FLA_Set(), and FLA_ZERO.

Referenced by FLA_Bidiag_UT_form_U(), FLA_Bidiag_UT_form_V_ext(), and FLA_Svd_ext_u_unb_var1().

15 {
16  //if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
17  // FLA_Bidiag_UT_form_U_ext_check( uplo, A, T, transu, U );
18 
19  if ( transu == FLA_NO_TRANSPOSE ||
20  transu == FLA_CONJ_NO_TRANSPOSE )
21  {
22 
23  if ( uplo == FLA_UPPER_TRIANGULAR )
24  {
25  FLA_QR_UT_form_Q( A, T, U );
26  }
27  else // if ( uplo == FLA_LOWER_TRIANGULAR )
28  {
29  FLA_Obj ATL, ATR,
30  ABL, ABR;
31 
32  FLA_Obj UTL, UTR,
33  UBL, UBR;
34 
35  FLA_Obj TL, TR;
36 
37  dim_t b = ( FLA_Obj_length( A ) - 1 );
38 
39  FLA_Part_1x2( T, &TL, &TR, 1, FLA_RIGHT );
40  FLA_Part_2x2( U, &UTL, &UTR,
41  &UBL, &UBR, 1, 1, FLA_TL );
42 
43  if ( FLA_Obj_is( A, U ) == FALSE )
44  {
45  FLA_Set( FLA_ONE, UTL ); FLA_Set( FLA_ZERO, UTR );
46  FLA_Set( FLA_ZERO, UBL );
47 
48  FLA_Part_2x2( A, &ATL, &ATR,
49  &ABL, &ABR, 1, b, FLA_TL );
50 
51  FLA_QR_UT_form_Q( ABL, TL, UBR );
52  }
53  else
54  {
55  FLA_Obj p, pt, pb;
56  FLA_Part_2x2( A, &ATL, &ATR,
57  &ABL, &ABR, 1, b+1, FLA_TL );
58 
59  FLA_Obj_create( FLA_INT, b+1,1, 0, 0, &p );
60  FLA_Part_2x1( p, &pt,
61  &pb, 1, FLA_BOTTOM );
62  FLA_Set( FLA_ONE, pt );
63  FLA_Set( FLA_ZERO, pb );
64  FLA_Apply_pivots ( FLA_RIGHT, FLA_NO_TRANSPOSE, p, ABL );
65  FLA_Obj_free(&p );
66 
67  FLA_Set( FLA_ONE, UTL );
68  FLA_Set( FLA_ZERO, UBL );
69  FLA_Set( FLA_ZERO, UTR );
70 
71  FLA_Part_1x2( ABL, &ABL,
72  &ABR, 1, FLA_LEFT );
73 
74  FLA_QR_UT_form_Q( ABR, TL, UBR );
75  }
76  }
77  }
78  else
79  {
80  FLA_Uplo uplo_flip = ( uplo == FLA_UPPER_TRIANGULAR ?
81  FLA_LOWER_TRIANGULAR : FLA_UPPER_TRIANGULAR );
82 
83  FLA_Obj_flip_base( &A );
84  FLA_Obj_flip_view( &A );
85 
86  // A and U should have different base objects
87  FLA_Bidiag_UT_form_V_ext( uplo_flip, A, T,
88  FLA_CONJ_TRANSPOSE, U );
89 
90  FLA_Obj_flip_base( &A );
91 
92  // As we use QR and LQ for constructing U and V,
93  // conjugation naturally fits there.
94  // Never apply conjugation separately here even if flipping trick is applied.
95  //FLA_Conjugate( U );
96  }
97 
98  return FLA_SUCCESS;
99 }
FLA_Error FLA_Obj_create(FLA_Datatype datatype, dim_t m, dim_t n, dim_t rs, dim_t cs, FLA_Obj *obj)
Definition: FLA_Obj.c:55
unsigned long dim_t
Definition: FLA_type_defs.h:71
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
FLA_Error FLA_Obj_flip_base(FLA_Obj *obj)
Definition: FLA_Obj.c:647
FLA_Bool FLA_Obj_is(FLA_Obj A, FLA_Obj B)
Definition: FLA_Query.c:460
FLA_Error FLA_Part_2x2(FLA_Obj A, FLA_Obj *A11, FLA_Obj *A12, FLA_Obj *A21, FLA_Obj *A22, dim_t mb, dim_t nb, FLA_Quadrant quadrant)
Definition: FLA_View.c:17
FLA_Obj FLA_ONE
Definition: FLA_Init.c:18
Definition: FLA_type_defs.h:158
FLA_Error FLA_Set(FLA_Obj alpha, FLA_Obj A)
Definition: FLA_Set.c:13
FLA_Error FLA_QR_UT_form_Q(FLA_Obj A, FLA_Obj T, FLA_Obj Q)
Definition: FLA_QR_UT_form_Q.c:13
int FLA_Uplo
Definition: FLA_type_defs.h:52
FLA_Error FLA_Part_2x1(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition: FLA_View.c:76
FLA_Error FLA_Part_1x2(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition: FLA_View.c:110
FLA_Error FLA_Apply_pivots(FLA_Side side, FLA_Trans trans, FLA_Obj p, FLA_Obj A)
Definition: FLA_Apply_pivots.c:15
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116
FLA_Error FLA_Obj_flip_view(FLA_Obj *obj)
Definition: FLA_Obj.c:669
FLA_Obj FLA_ZERO
Definition: FLA_Init.c:20
FLA_Error FLA_Bidiag_UT_form_V_ext(FLA_Uplo uplo, FLA_Obj A, FLA_Obj S, FLA_Trans transv, FLA_Obj V)
Definition: FLA_Bidiag_UT_form_V_ext.c:13