libflame  revision_anchor
Functions
FLA_Bidiag_UT_form_V_ext.c File Reference

(r)

Functions

FLA_Error FLA_Bidiag_UT_form_V_ext (FLA_Uplo uplo, FLA_Obj A, FLA_Obj S, FLA_Trans transv, FLA_Obj V)
 

Function Documentation

◆ FLA_Bidiag_UT_form_V_ext()

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

References FLA_Apply_pivots(), FLA_Bidiag_UT_form_U_ext(), FLA_LQ_UT_form_Q(), FLA_Obj_create(), FLA_Obj_flip_base(), FLA_Obj_flip_view(), FLA_Obj_free(), FLA_Obj_is(), FLA_Obj_width(), FLA_ONE, FLA_Part_1x2(), FLA_Part_2x1(), FLA_Part_2x2(), FLA_Set(), and FLA_ZERO.

Referenced by FLA_Bidiag_UT_form_U_ext(), FLA_Bidiag_UT_form_V(), and FLA_Svd_ext_u_unb_var1().