17 size_t len = n - k - 1;
20 for (i = 0; i < len; i++) {
27 for (i = 1; i < len; i++) {
52 for (i = 0; i < n; i++) {
53 for (j = 0; j < n; j++) {
54 MAT_ELEM(Q, i, j) = (i == j) ? 1.0 : 0.0;
67 for (k = 0; k < n - 2; k++) {
68 hessenberg_column(H, Q, k, vbuf);
77 for (
size_t i = 0; i < H->
rows; i++) {
78 for (
size_t j = 0; j < H->
rows; j++) {
91 for (l = en; l > 0; l--) {
92 s = lmmc_abs(
MAT_ELEM(H, l - 1, l - 1)) +
97 if (lmmc_abs(
MAT_ELEM(H, l, l - 1)) <= eps * s) {
105static void francis_initial_column(
const lmmc_mat_t* H,
int en,
int l,
112 if (its == 10 || its == 20) {
114 t = lmmc_abs(
MAT_ELEM(H, en, en - 1)) +
115 lmmc_abs(
MAT_ELEM(H, en - 1, en - 2));
138 int n = (int)H->
rows;
141 notlast = (k != en - 1);
142 size_t len = notlast ? 3 : 2;
169 size_t nr = (size_t)((
int)(k + len + 1) <= en + 1 ?
170 (
int)(k + len + 1) : en + 1);
180 francis_initial_column(H, en, l, its, v);
181 for (
int k = l; k <= en - 1; k++) {
182 francis_reflector(H, Q, k, l, en, v);
203 const size_t max_iter = 30 * nn;
204 size_t total_iter = 0;
209 int en = (int)nn - 1;
213 int l = schur_find_split(H, en, norm);
222 if (total_iter >= max_iter) {
225 francis_step(H, Q, en, l, its);
239 return francis_qr_iteration(h, q, h->
rows);
LMMC binary real type and arithmetic spelling.
double lmmc_real_t
Public and internal LMMC real type.
lmmc_status_t lmmc_eigen_schur_reduce(lmmc_mat_t *h, lmmc_mat_t *q)
void householder_apply_left(lmmc_mat_t *M, size_t i0, size_t len, size_t j0, size_t j1, const lmmc_real_t *v, lmmc_real_t tau)
void householder_make(lmmc_real_t *x, size_t len, lmmc_real_t *tau_out, lmmc_real_t *beta_out)
void householder_apply_right(lmmc_mat_t *M, size_t i0, size_t i1, size_t j0, size_t len, const lmmc_real_t *v, lmmc_real_t tau)
特征值 / SVD 模块内部共享的缩放、Householder 与 Givens 辅助接口(仅源文件可见)。
#define MAT_ELEM(mat, i, j)
稠密矩阵直接分解接口(LU、Cholesky、QR)。
void * lmmc_memory_alloc_array(size_t count, size_t element_size)
void lmmc_memory_free(void *pointer)
Private recoverable allocator for persistent LMMC ownership.
lmmc_status_t
LMMC 库统一返回的状态码.
@ LMMC_STATUS_CONVERGENCE_FAILED
@ LMMC_STATUS_ALLOCATION_FAILED