libflame  revision_anchor
Functions
FLA_QR_UT_piv_colnorm.c File Reference

(r)

Functions

FLA_Error FLA_QR_UT_piv_colnorm (FLA_Obj alpha, FLA_Obj A, FLA_Obj b)
 

Function Documentation

◆ FLA_QR_UT_piv_colnorm()

FLA_Error FLA_QR_UT_piv_colnorm ( FLA_Obj  alpha,
FLA_Obj  A,
FLA_Obj  b 
)

References FLA_Axpy(), FLA_Check_error_level(), FLA_Cont_with_1x3_to_1x2(), FLA_Cont_with_3x1_to_2x1(), FLA_Dot(), FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_extract_real_part(), FLA_Obj_free(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Part_2x1(), FLA_QR_UT_piv_colnorm_check(), FLA_Repart_1x2_to_1x3(), and FLA_Repart_2x1_to_3x1().

Referenced by FLA_QR_UT_piv(), FLA_QR_UT_piv_unb_var1(), and FLA_QR_UT_piv_unb_var2().

14 {
15  FLA_Obj AL, AR, A0, a1, A2;
16  FLA_Obj bT, b0,
17  bB, beta1,
18  b2;
19 
20  FLA_Obj val2_a1, val2_a1_real;
21 
22  // A and b has matching dimensions.
23  if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
24  FLA_QR_UT_piv_colnorm_check( alpha, A, b );
25 
26  FLA_Obj_create( FLA_Obj_datatype( A ), 1, 1, 0, 0, &val2_a1 );
27  FLA_Obj_create( FLA_Obj_datatype( b ), 1, 1, 0, 0, &val2_a1_real );
28 
29  FLA_Part_1x2( A, &AL, &AR, 0, FLA_LEFT );
30 
31  FLA_Part_2x1( b, &bT,
32  &bB, 0, FLA_TOP );
33 
34  while ( FLA_Obj_width( AL ) < FLA_Obj_width( A ) ){
35 
36  FLA_Repart_1x2_to_1x3( AL, /**/ AR, &A0, /**/ &a1, &A2,
37  1, FLA_RIGHT );
38 
39  FLA_Repart_2x1_to_3x1( bT, &b0,
40  /* ** */ /* ** */
41  &beta1,
42  bB, &b2, 1, FLA_BOTTOM );
43 
44  /*------------------------------------------------------------*/
45  // Using dot product is a bit dangerous when a1 is close to
46  // under/over flow limits.
47  // The matrix should be properly scaled before using QR_UT_piv.
48  FLA_Dot( a1, a1, val2_a1 );
49  FLA_Obj_extract_real_part( val2_a1, val2_a1_real );
50  FLA_Axpy( alpha, val2_a1_real, beta1 );
51  /*------------------------------------------------------------*/
52  FLA_Cont_with_1x3_to_1x2( &AL, /**/ &AR, A0, a1, /**/ A2,
53  FLA_LEFT );
54 
55  FLA_Cont_with_3x1_to_2x1( &bT, b0,
56  beta1,
57  /* ** */ /* ** */
58  &bB, b2, FLA_TOP );
59  }
60 
61  FLA_Obj_free( &val2_a1 );
62  FLA_Obj_free( &val2_a1_real );
63 
64  return FLA_SUCCESS;
65 }
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_Repart_2x1_to_3x1(FLA_Obj AT, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj AB, FLA_Obj *A2, dim_t mb, FLA_Side side)
Definition: FLA_View.c:226
FLA_Error FLA_Repart_1x2_to_1x3(FLA_Obj AL, FLA_Obj AR, FLA_Obj *A0, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition: FLA_View.c:267
FLA_Error FLA_QR_UT_piv_colnorm_check(FLA_Obj alpha, FLA_Obj A, FLA_Obj b)
Definition: FLA_QR_UT_piv_colnorm_check.c:13
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition: FLA_Obj.c:588
FLA_Error FLA_Cont_with_3x1_to_2x1(FLA_Obj *AT, FLA_Obj A0, FLA_Obj A1, FLA_Obj *AB, FLA_Obj A2, FLA_Side side)
Definition: FLA_View.c:428
void FLA_Obj_extract_real_part(FLA_Obj alpha, FLA_Obj beta)
Definition: FLA_Misc.c:65
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
Definition: FLA_type_defs.h:158
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
FLA_Error FLA_Dot(FLA_Obj x, FLA_Obj y, FLA_Obj rho)
Definition: FLA_Dot.c:13
FLA_Error FLA_Cont_with_1x3_to_1x2(FLA_Obj *AL, FLA_Obj *AR, FLA_Obj A0, FLA_Obj A1, FLA_Obj A2, FLA_Side side)
Definition: FLA_View.c:475
FLA_Error FLA_Axpy(FLA_Obj alpha, FLA_Obj A, FLA_Obj B)
Definition: FLA_Axpy.c:15
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
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
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