libflame revision_anchor
Functions
FLA_Hevd_lv_unb_var2.c File Reference

(r)

Functions

FLA_Error FLA_Hevd_lv_unb_var2 (dim_t n_iter_max, FLA_Obj A, FLA_Obj l, dim_t k_accum, dim_t b_alg)
 

Function Documentation

◆ FLA_Hevd_lv_unb_var2()

FLA_Error FLA_Hevd_lv_unb_var2 ( dim_t  n_iter_max,
FLA_Obj  A,
FLA_Obj  l,
dim_t  k_accum,
dim_t  b_alg 
)
14{
20 FLA_Obj scale, T, r, d, e, G, R, W;
21 dim_t mn_A;
23
28
29 // If the matrix is a scalar, then the EVD is easy.
30 if ( mn_A == 1 )
31 {
32 FLA_Copy( A, l );
33 FLA_Set( FLA_ONE, A );
34
35 return FLA_SUCCESS;
36 }
37
38 // Create a matrix to hold block Householder transformations.
40
41 // Create a vector to hold the realifying scalars.
42 FLA_Obj_create( dt, mn_A, 1, 0, 0, &r );
43
44 // Create vectors to hold the diagonal and sub-diagonal.
45 FLA_Obj_create( dt_real, mn_A, 1, 0, 0, &d );
46 FLA_Obj_create( dt_real, mn_A-1, 1, 0, 0, &e );
47 FLA_Obj_create( dt_comp, mn_A-1, n_G, 0, 0, &G );
48 FLA_Obj_create( dt_real, mn_A, mn_A, 0, 0, &R );
49 FLA_Obj_create( dt, mn_A, mn_A, 0, 0, &W );
50
51 // Create a real scaling factor.
52 FLA_Obj_create( dt_real, 1, 1, 0, 0, &scale );
53
54 // Compute a scaling factor; If none is needed, sigma will be set to one.
56
57 // Scale the matrix if scale is non-unit.
58 if ( !FLA_Obj_equals( scale, FLA_ONE ) )
59 FLA_Scalr( uplo, scale, A );
60
61 // Reduce the matrix to tridiagonal form.
62 FLA_Tridiag_UT( uplo, A, T );
63
64 // Apply scalars to rotate elements on the sub-diagonal to the real domain.
65 FLA_Tridiag_UT_realify( uplo, A, r );
66
67 // Extract the diagonal and sub-diagonal from A.
69
70 // Form Q, overwriting A.
71 FLA_Tridiag_UT_form_Q( uplo, A, T, A );
72
73 // Apply the scalars in r to Q.
75
76 // Perform an eigenvalue decomposition on the tridiagonal matrix.
78
79 // Copy the converged eigenvalues to the output vector.
80 FLA_Copy( d, l );
81
82 // Sort the eigenvalues and eigenvectors in ascending order.
84
85 // If the matrix was scaled, rescale the eigenvalues.
86 if ( !FLA_Obj_equals( scale, FLA_ONE ) )
88
90 FLA_Obj_free( &T );
91 FLA_Obj_free( &r );
92 FLA_Obj_free( &d );
93 FLA_Obj_free( &e );
94 FLA_Obj_free( &G );
95 FLA_Obj_free( &R );
96 FLA_Obj_free( &W );
97
98 return r_val;
99}
FLA_Error FLA_Hevd_compute_scaling(FLA_Uplo uplo, FLA_Obj A, FLA_Obj sigma)
Definition FLA_Hevd_compute_scaling.c:13
FLA_Error FLA_Tevd_v_opt_var2(dim_t n_iter_max, FLA_Obj d, FLA_Obj e, FLA_Obj G, FLA_Obj R, FLA_Obj W, FLA_Obj U, dim_t b_alg)
Definition FLA_Tevd_v_opt_var2.c:13
FLA_Error FLA_Tridiag_UT(FLA_Uplo uplo, FLA_Obj A, FLA_Obj T)
Definition FLA_Tridiag_UT.c:17
FLA_Error FLA_Tridiag_UT_extract_real_diagonals(FLA_Uplo uplo, FLA_Obj A, FLA_Obj d, FLA_Obj e)
Definition FLA_Tridiag_UT_extract_real_diagonals.c:13
FLA_Error FLA_Tridiag_UT_create_T(FLA_Obj A, FLA_Obj *T)
Definition FLA_Tridiag_UT_create_T.c:13
FLA_Error FLA_Tridiag_UT_form_Q(FLA_Uplo uplo, FLA_Obj A, FLA_Obj T, FLA_Obj Q)
Definition FLA_Tridiag_UT_form_Q.c:14
FLA_Error FLA_Tridiag_UT_realify(FLA_Uplo uplo, FLA_Obj A, FLA_Obj d)
Definition FLA_Tridiag_UT_realify.c:13
FLA_Error FLA_Copy(FLA_Obj A, FLA_Obj B)
Definition FLA_Copy.c:15
FLA_Error FLA_Scalr(FLA_Uplo uplo, FLA_Obj alpha, FLA_Obj A)
Definition FLA_Scalr.c:15
FLA_Error FLA_Inv_scal(FLA_Obj alpha, FLA_Obj A)
Definition FLA_Inv_scal.c:13
FLA_Obj FLA_ONE
Definition FLA_Init.c:18
FLA_Datatype FLA_Obj_datatype_proj_to_complex(FLA_Obj A)
Definition FLA_Query.c:37
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_Datatype FLA_Obj_datatype_proj_to_real(FLA_Obj A)
Definition FLA_Query.c:23
dim_t FLA_Obj_length(FLA_Obj obj)
Definition FLA_Query.c:116
FLA_Bool FLA_Obj_equals(FLA_Obj A, FLA_Obj B)
Definition FLA_Query.c:507
FLA_Error FLA_Obj_free(FLA_Obj *obj)
Definition FLA_Obj.c:588
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition FLA_Query.c:13
int FLA_Error
Definition FLA_type_defs.h:47
int FLA_Datatype
Definition FLA_type_defs.h:49
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
FLA_Error FLA_Sort_evd(FLA_Direct direct, FLA_Obj l, FLA_Obj V)
Definition FLA_Sort_evd.c:13
FLA_Error FLA_Apply_diag_matrix(FLA_Side side, FLA_Conj conj, FLA_Obj x, FLA_Obj A)
Definition FLA_Apply_diag_matrix.c:13
int i
Definition bl1_axmyv2.c:145
Definition FLA_type_defs.h:159

References FLA_Apply_diag_matrix(), FLA_Copy(), FLA_Hevd_compute_scaling(), FLA_Inv_scal(), FLA_Obj_create(), FLA_Obj_datatype(), FLA_Obj_datatype_proj_to_complex(), FLA_Obj_datatype_proj_to_real(), FLA_Obj_equals(), FLA_Obj_free(), FLA_Obj_length(), FLA_ONE, FLA_Scalr(), FLA_Set(), FLA_Sort_evd(), FLA_Tevd_v_opt_var2(), FLA_Tridiag_UT(), FLA_Tridiag_UT_create_T(), FLA_Tridiag_UT_extract_real_diagonals(), FLA_Tridiag_UT_form_Q(), FLA_Tridiag_UT_realify(), and i.