libflame  revision_anchor
Functions
FLA_Bidiag_UT_create_T.c File Reference

(r)

Functions

FLA_Error FLA_Bidiag_UT_create_T (FLA_Obj A, FLA_Obj *TU, FLA_Obj *TV)
 

Function Documentation

◆ FLA_Bidiag_UT_create_T()

FLA_Error FLA_Bidiag_UT_create_T ( FLA_Obj  A,
FLA_Obj TU,
FLA_Obj TV 
)

References FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_min_dim(), FLA_Obj_row_stride(), and FLA_Query_blocksize().

Referenced by FLA_Svd_ext_u_unb_var1(), FLA_Svd_uv_unb_var1(), and FLA_Svd_uv_unb_var2().

14 {
15  FLA_Datatype datatype;
16  dim_t b_alg, k;
17  dim_t rs_T, cs_T;
18 
19  // Query the datatype of A.
20  datatype = FLA_Obj_datatype( A );
21 
22  // Query the blocksize from the library.
23  b_alg = FLA_Query_blocksize( datatype, FLA_DIMENSION_MIN );
24 
25  // Scale the blocksize by a pre-set global constant.
26  b_alg = ( dim_t )( ( ( double ) b_alg ) * FLA_BIDIAG_INNER_TO_OUTER_B_RATIO );
27 
28  // Query the minimum dimension of A.
29  k = FLA_Obj_min_dim( A );
30 
31  b_alg = 5;
32 
33  // Adjust the blocksize with respect to the min-dim of A.
34  b_alg = min( b_alg, k );
35 
36  // Figure out whether TU and TV should be row-major or column-major.
37  if ( FLA_Obj_row_stride( A ) == 1 )
38  {
39  rs_T = 1;
40  cs_T = b_alg;
41  }
42  else // if ( FLA_Obj_col_stride( A ) == 1 )
43  {
44  rs_T = k;
45  cs_T = 1;
46  }
47 
48  // Create two b_alg x k matrices to hold the block Householder transforms
49  // that will be accumulated within the bidiagonal reduction algorithm.
50  // If the matrix dimension has a zero dimension, apply_q complains it.
51  if ( TU != NULL ) FLA_Obj_create( datatype, b_alg, k, rs_T, cs_T, TU );
52  if ( TV != NULL ) FLA_Obj_create( datatype, b_alg, k, rs_T, cs_T, TV );
53 
54  return FLA_SUCCESS;
55 }
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
dim_t FLA_Obj_row_stride(FLA_Obj obj)
Definition: FLA_Query.c:167
dim_t FLA_Query_blocksize(FLA_Datatype dt, FLA_Dimension dim)
Definition: FLA_Blocksize.c:161
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition: FLA_Query.c:153