CAPI trlib_eigen_inverse¶
Functions¶
-
trlib_int_t
trlib_eigen_inverse
(trlib_int_t n, trlib_flt_t *diag, trlib_flt_t *offdiag, trlib_flt_t lam_init, trlib_int_t itmax, trlib_flt_t tol_abs, trlib_flt_t *ones, trlib_flt_t *diag_fac, trlib_flt_t *offdiag_fac, trlib_flt_t *eig, trlib_int_t verbose, trlib_int_t unicode, char *prefix, FILE *fout, trlib_int_t *timing, trlib_flt_t *lam_pert, trlib_flt_t *pert, trlib_int_t *iter_inv)¶ Computes eigenvector to provided eigenvalue of symmetric tridiagonal matrix \(T \in \mathbb R^{n\times n}\), using inverse iteration.
For a description of the method see https://en.wikipedia.org/wiki/Inverse_iteration.
Convergence
Convergence is reported if \(\vert \frac{1}{\Vert w_{i+1} \Vert} - \texttt{pert} \vert \le \texttt{tol}\_\texttt{abs}\), where \((T-\lambda I) w_{i+1} = v_i\), \(v_i\) the current normalized iterate and \(\texttt{pert}\) is the perturbation applied to the provided eigenvalue.
Parameters: - n (
trlib_int_t
, input) – dimension, ensure \(n > 0\) - diag (
trlib_flt_t
, input) – pointer to array holding diagonal of \(T\), lengthn
- offdiag (
trlib_flt_t
, input) – pointer to array holding offdiagonal of \(T\), lengthn-1
- lam_init (
trlib_flt_t
, input) – estimation of eigenvalue corresponding to eigenvector to compute - itmax (
trlib_int_t
, input) – maximum number of iterations - tol_abs (
trlib_flt_t
, input) – absolute stopping tolerance in inverse iteration, good default may be \(\sqrt{\texttt{macheps}}\) (TRLIB_EPS_POW_5
) - ones (
trlib_flt_t
, input) – array with every value1.0
, lengthn
- diag_fac (
trlib_flt_t
, input/output) –pointer to array holding diagonal of Cholesky factorization of \(T - \lambda I\), length
n
- on entry: allocated memory
- on exit: factorization corresponding to computed eigenvalue @p lam
- offdiag_fac –
pointer to array holding offdiagonal of Cholesky factorization of \(T - \lambda I\), length
n-1
- on entry: allocated memory
- on exit: factorization corresponding to computed eigenvalue @p lam
- eig (
trlib_flt_t
, input/output) – pointer to array holding eigenvector, lengthn
- verbose (
trlib_int_t
, input) – determines the verbosity level of output that is written tofout
- unicode (
trlib_int_t
, input) – set to1
iffout
can handle unicode, otherwise to0
- prefix (char, input) – string that is printed before iteration output
- fout (FILE, input) – output stream
- timing (
trlib_int_t
, input/output) –gives timing details, provide allocated zero initialized memory of length
trlib_eigen_timing_size()
block description 0 total duration 1 timing of linear algebra calls - lam_pert (
trlib_flt_t
, output) – eigenvalue corresponding to eigenvector - pert (
trlib_flt_t
, output) – perturbation applied to provided eigenvalue - iter_inv (
trlib_int_t
, output) – number of inverse iterations
Returns: status
TRLIB_EIR_CONV
successTRLIB_EIR_ITMAX
iteration limit exceededTRLIB_EIR_FAIL_FACTOR
failure on matrix factorizationTRLIB_EIR_FAIL_LINSOLVE
failure on backsolve
Return type: trlib_int_t
- n (
-
trlib_int_t
trlib_eigen_timing_size
(void)¶ size that has to be allocated for
timing
intrlib_eigen_inverse()