libflame revision_anchor
FLA_Svd.c File Reference

(r)

Functions

FLA_Error FLA_Svd (FLA_Svd_type jobu, FLA_Svd_type jobv, FLA_Obj A, FLA_Obj s, FLA_Obj U, FLA_Obj V)
 

Function Documentation

◆ FLA_Svd()

FLA_Error FLA_Svd ( FLA_Svd_type jobu,
FLA_Svd_type jobv,
FLA_Obj A,
FLA_Obj s,
FLA_Obj U,
FLA_Obj V )
14{
15 FLA_Error r_val = FLA_SUCCESS;
16 dim_t n_iter_max = 30;
17 dim_t k_accum = 32;
18 dim_t b_alg = 512;
19 dim_t min_m_n = FLA_Obj_min_dim( A );
20 dim_t m_A = FLA_Obj_length( A );
21 dim_t n_A = FLA_Obj_width( A );
22 FLA_Obj W; // Dummy variable for partitioning of matrices.
23
24 // Check parameters.
25 if ( FLA_Check_error_level() >= FLA_MIN_ERROR_CHECKING )
26 FLA_Svd_check( jobu, jobv, A, s, U, V );
27
28 // Partition U and V if necessary.
29 if ( jobu == FLA_SVD_VECTORS_MIN_COPY ) FLA_Part_1x2( U, &U, &W, min_m_n, FLA_LEFT );
30 if ( jobv == FLA_SVD_VECTORS_MIN_COPY ) FLA_Part_1x2( V, &V, &W, min_m_n, FLA_LEFT );
31
32 // Use extension version
33 if ( m_A >= n_A )
34 {
35 r_val = FLA_Svd_ext_u_unb_var1( jobu, jobv,
36 n_iter_max,
37 A, s, U, V,
38 k_accum, b_alg );
39 }
40 else
41 {
42 // Flip A and change U and V
45
46 r_val = FLA_Svd_ext_u_unb_var1( jobu, jobv,
47 n_iter_max,
48 A, s, V, U,
49 k_accum, b_alg );
50
51 // Recover A and conjugate U and V for complex cases
53
54 if ( FLA_Obj_is_complex( A ) )
55 {
56 if ( jobu != FLA_SVD_VECTORS_NONE ) FLA_Conjugate( U );
57 if ( jobv != FLA_SVD_VECTORS_NONE ) FLA_Conjugate( V );
58 }
59 }
60
61 return r_val;
62}
FLA_Error FLA_Svd_check(FLA_Svd_type jobu, FLA_Svd_type jobv, FLA_Obj A, FLA_Obj s, FLA_Obj U, FLA_Obj V)
Definition FLA_Svd_check.c:13
FLA_Error FLA_Svd_ext_u_unb_var1(FLA_Svd_type jobu, FLA_Svd_type jobv, dim_t n_iter_max, FLA_Obj A, FLA_Obj s, FLA_Obj V, FLA_Obj U, dim_t k_accum, dim_t b_alg)
Definition FLA_Svd_ext_u_unb_var1.c:14
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_Part_1x2(FLA_Obj A, FLA_Obj *A1, FLA_Obj *A2, dim_t nb, FLA_Side side)
Definition FLA_View.c:110
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
FLA_Bool FLA_Obj_is_complex(FLA_Obj A)
Definition FLA_Query.c:324
unsigned int FLA_Check_error_level(void)
Definition FLA_Check.c:18
dim_t FLA_Obj_min_dim(FLA_Obj obj)
Definition FLA_Query.c:153
int FLA_Error
Definition FLA_type_defs.h:47
unsigned long dim_t
Definition FLA_type_defs.h:71
FLA_Error FLA_Conjugate(FLA_Obj A)
Definition FLA_Conjugate.c:13
Definition FLA_type_defs.h:159

References FLA_Check_error_level(), FLA_Conjugate(), FLA_Obj_flip_base(), FLA_Obj_flip_view(), FLA_Obj_is_complex(), FLA_Obj_length(), FLA_Obj_min_dim(), FLA_Obj_width(), FLA_Part_1x2(), FLA_Svd_check(), and FLA_Svd_ext_u_unb_var1().