klib
[Ported from github.com/attractivechaos/klib] added block arena
Brought by drakestapleton
klib / keigen.h
| 1 | #ifndef KEIGEN_H |
| 2 | #define KEIGEN_H |
| 3 | |
| 4 | #define KE_EXCESS_ITER (-1) |
| 5 | |
| 6 | #ifdef __cplusplus |
| 7 | extern "C" { |
| 8 | #endif |
| 9 | |
| 10 | /** |
| 11 | * Compute eigenvalues/vectors for a dense symmetric matrix |
| 12 | * |
| 13 | * @param n dimension |
| 14 | * @param a input matrix and eigenvalues on return ([n*n]; in & out) |
| 15 | * @param v eigenvalues ([n]; out) |
| 16 | * @param cal_ev compute eigenvectos or not (faster without vectors) |
| 17 | * @param eps precision (<=0 for default) |
| 18 | * @param max_itr max iteration (<=0 for detaul) |
| 19 | * |
| 20 | * @return 0 on success; KE_EXCESS_ITER if too many iterations |
| 21 | */ |
| 22 | int ke_eigen_sd(int n, double *a, double *v, int cal_ev, double eps, int max_iter); |
| 23 | |
| 24 | /** |
| 25 | * Transform a real symmetric matrix to a tridiagonal matrix |
| 26 | * |
| 27 | * @param n dimension |
| 28 | * @param q input matrix and transformation matrix ([n*n]; in & out) |
| 29 | * @param b diagonal ([n]; out) |
| 30 | * @param c subdiagonal ([n]; out) |
| 31 | */ |
| 32 | void ke_core_strq(int n, double *q, double *b, double *c); |
| 33 | |
| 34 | /** |
| 35 | * Compute eigenvalues and eigenvectors for a tridiagonal matrix |
| 36 | * |
| 37 | * @param n dimension |
| 38 | * @param b diagonal and eigenvalues on return ([n]; in & out) |
| 39 | * @param c subdiagonal ([n]; in) |
| 40 | * @param q transformation matrix and eigenvectors on return ([n*n]; in & out) |
| 41 | * @param cal_ev compute eigenvectors or not (faster without vectors) |
| 42 | * @param eps precision |
| 43 | * @param l max iterations |
| 44 | * |
| 45 | * @return 0 on success; KE_EXCESS_ITER if too many iterations |
| 46 | */ |
| 47 | int ke_core_sstq(int n, double *b, double *c, double *q, int cal_ev, double eps, int l); |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | #endif |