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\), length n
  • offdiag (trlib_flt_t, input) – pointer to array holding offdiagonal of \(T\), length n-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 value 1.0, length n
  • 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, length n
  • verbose (trlib_int_t, input) – determines the verbosity level of output that is written to fout
  • unicode (trlib_int_t, input) – set to 1 if fout can handle unicode, otherwise to 0
  • 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

Return type:

trlib_int_t

trlib_int_t trlib_eigen_timing_size(void)

size that has to be allocated for timing in trlib_eigen_inverse()

Definitions

TRLIB_EIR_CONV

0

TRLIB_EIR_ITMAX

-1

TRLIB_EIR_FAIL_FACTOR

-2

TRLIB_EIR_FAIL_LINSOLVE

-3

TRLIB_EIR_N_STARTVEC

5