Files
FESADev/docs/mitc4-shell-feast-eigen2/numerical-review-controls.md
T
2026-10-04 03:32:59 +09:00

125 lines
11 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 내부 수치 기준과 FEAST controls
- Feature ID: `mitc4-shell-feast-eigen2`; Owner: `numerical-review-agent`; revision `r2` (2026-09-10, C5 종료 제어만 변경).
- 기본 보고서: [numerical-review](numerical-review.md#numerical-review); 수식: [새 formulation](formulation.md).
- IEEE binary64의 내부 검증 계약이며 [외부 TOLERANCE](../TOLERANCE.md)를 변경하지 않는다.
- 아래 `NOT RUN`은 r1 문서 검토 당시의 기록이다. 변경된 C5의 실제 실행 판정은
[종료 제어 구현 검토](implementation-review.md#implementation-feast-residual-review)를 따른다.
## C1–C4, C6, C7의 독립 검토 후 명시 채택
[이전 controls](../mitc4-shell-feast-eigen/numerical-review.md#numerical-review-controls)의 C1, C2-01~14와
nodal rcond 절, C3-01~08와 raw classification, C4, C6의 seed/QR/thread/storage,
C7의 retained static 기준을 전부 읽고 새 M/S/E 식에 대조하여 **수치 정의만 채택**한다.
이것은 과거 판정·runtime·reference pass의 승계가 아니다. 다음 적용 경계가 우선한다.
- E/V/S 식 번호는 [새 formulation](formulation.md)과 그 문서가 명시 채택한
[V1–V5 측정식](../mitc4-shell-feast-eigen/formulation.md#formulation-verification)에 대응한다.
- 이전 C5 전체와 lower/empty-prefix search는 채택하지 않는다. 아래 C5가 완전히 대체한다.
- C6 count `n×n`은 이번의 보수적 allocation 선택이며 Intel의 최소 workspace 의무가 아니다.
Count input capacity `n`, 반환 count, solve capacity `m0`, 요청 `N`은 서로 다른 값이다.
- C7는 `shell`, `shellNL`, linear-limit 및 내부 synthetic 의무에만 적용한다.
이전 문서의 제외 예제·고정 검사 수·고정 workflow는 채택하지 않는다.
- Runtime/ABI/thread의 설치 확인은 **NOT RUN**이며 후속 implementation 의무다.
| 분류 | 채택한 기준과 근거 |
| --- | --- |
| 단위·zero branch | `ell=max active edge length`, `D=diag(ell I3,I3)` congruence 뒤 norm. Finite-first; 분자=분모=0이면 항등식 metric0, 분모0·분자비영이면 failure. Zero vector/nonpositive mass는 실패. Floor/clamp 없음 |
| 대수 C1/C2 | Symmetry·oracle·moment·covariance·null/PZ·Cholesky reconstruction `<=1e-12`; `u=2^-53`, `gamma4096≈4.55e-13`와 기존 linear algebra 기준. 어려운 geometry의 forward accuracy 보장 아님 |
| 질량 C2 | Scalar Ck entry error를 `m_e(t/2)^k`로 나눔; first moment는 `m_e ell`. Strict `mi,ji,ji-hi²/mi>0`; analytic rank와 director constraint exact-zero intersection. Nodal scaled positive block `rcond_inf>=2^-32`; 작으면 failure이며 rank 변경 금지 |
| Modal C3 | Original free residual·whitened residual·`norm(Bx-mu x)/norm(x)`·normalization·pairwise orthogonality·Gram·energy·rigid/scaling `<=1e-10`; FEAST stopping `1e-12`와 별도 독립 후검증 |
| Known spectrum | Error/s `<=1e-10`, known distinct gap 존재 시 error `<=gap/8`; exact repeated subspace projector `<=1e-6`는 isolated known gap `>=1e-3 s`인 검증군에만 적용 |
| Raw 분류 | `mu=lambda/s`, `tau_zero=1e-9`, `tau_cluster=1e-8`; `mu<-tau_zero`는 실패, 양끝 포함 near-zero는 분류만. Raw 부호·값 보존, 작은 양수 mode 삭제 금지, 음수 frequency 생성 금지 |
| 결정론 C4/C6 | Stable raw sort, equal tie는 solver column; connected cluster 평균/merge 금지. Source 최대 scaled component sign·첫 tie. 같은 runtime/thread/input 세 반복의 structure/order exact; repeated vector는 projector 비교 |
| 정적 C7 | Linear symmetry/frame/energy `1e-12`, full residual/equilibrium `1e-10`. Nonlinear directional tangent `1e-6`, zero direction `1e-10`, objectivity `1e-10`, factor-one force/moment balance 각각 `1e-8`; 기존 typed Newton zero/100-iteration/no-cutback 계약 유지 |
C6의 seed `0x4D495443344D4645`, uint64 recurrence
`z=6364136223846793005*z+1442695040888963407 mod 2^64`, column-major
`x=2*(double(z>>11)*2^-53)-1`, nonpivoted Householder QR 및 positive R diagonal을 채택한다.
`m0=n`은 identity. QR relative pivot `<=1e-12`는 실패, post-QR Gram `<=1e-12`다.
Seed 변경으로 통과를 찾지 않는다. oneMKL thread-local 1을 설정하고 모든 exit에서 반환된
이전 설정을 복원한다. 이 반환 의미는 이번 [Intel 원문](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2026-0/mkl-set-num-threads-local.html)에서 재확인했다.
## C5. Fixed lower enclosure와 bounded upper search
실제 backend는 `dfeast_scsrgv(B,I)`, `uplo='U'`, sorted duplicate-free 1-based CSR이다.
각 call에 `feastinit` 후 C-index fpm을 다음과 같이 다시 설정한다.
| Index | 값 |
| --- | --- |
| `[0],[1],[2],[3]` | `0,16,12,20` |
| `[4],[5],[13]` | `1,0,0` |
| `[26],[27]` | `1,1` |
| `[49]` | Count `1`, solve `0` |
| `[63]` | `0` |
나머지는 해당 설치의 초기값을 유지·기록한다. 이번 [Intel parameter table](https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2026-0/extended-eigensolver-input-parameters.html)의 허용 contour16,
residual stopping, CSR/SPD checks와 count flag reset을 확인했다. 위 값은 FESA의 고정
제어 선택이며 어떤 matrix에서도 수렴한다는 vendor 보장이 아니다.
2026-09-10 사용자 승인으로 C-index `fpm[5]=1` trace stopping을 `0` residual stopping으로
대체한다. Double precision의 vendor stopping epsilon은 `10^-fpm[2]=1e-12`이며
`fpm[3]=20`을 유지한다. Count/solve 모두 같은 초기 controls를 적용하고 `[49]`만 구분한다.
전체 c개의 독립 `rho_B=||Bx-mu x||2/||x||2<=1e-10`, Gram 및 original-free 복구 검증은
그대로다. Vendor residual의 정규화와 독립 rho_B를 동일시하지 않으며 `info=0`도 독립 검증을
대체하지 않는다. `epsout`은 trace 변화 진단량으로 보존하고 새 residual 오차로 재해석하지 않는다.
기존 trace 실행의 pass/fail·loop·epsout은 당시 controls의 이력이다. Zero/mixed-zero/repeated
및 원본 모델의 새 실행과 미해결 위험은 [종료 제어 구현 검토](implementation-review.md#implementation-feast-residual-review)에
구분한다. S3·물리 정식화·공통 외부 tolerance는 이 결정으로 변경하지 않는다.
Gershgorin off-diagonal absolute row sum은 매 합산 뒤 `nextafter(+infinity)`로 outward
누적하고 diagonal±sum도 바깥 한 ULP를 적용한다. `beta=norm(B,inf)`도 outward로 구한다.
`B=0`의 algorithmic enclosure에서만 beta=1이며 physical mass/λ floor가 아니다.
`ulp(v)`는 양쪽 finite adjacent spacing의 큰 값,
`delta(v)=1e-8 beta+64 ulp(v)`로 고정한다. Finite overflow/underflow로 strict bound를
구성할 수 없으면 failure다. `a0=nextafter(gL-16delta(gL),-inf)`,
`b0=nextafter(gU+16delta(gU),+inf)`로 spectrum을 엄밀히 포함한다.
정확한 B=0은 별도 결정론 branch로 **초기 (a0,b0)=(-1,1)**를 사용하며 위 gL/gU padding
식을 적용하지 않는다. 초기 endpoint 재시도 j=0,1,2에서는 `(-2^j,2^j)`를 사용한다.
이 branch에서도 beta=1의 동일 delta·count/solve·분리·raw 검증을 적용한다.
**하한은 a0로 고정한다.** 바깥 spectral bound가 lower completeness를 증명하므로
empty-prefix count를 의무로 호출하지 않는다. 최초 `(a0,b0)` count는 `info=0,c=n`이어야
한다. 초기 endpoint 재시도는 최초 포함 최대3회이며 `info=1,-5` 또는 성공 count!=n에만
허용한다. Attempt j=0,1,2에서 최초 16delta padding을 `2^j`배로 넓히고 outward 처리한다.
최종 성공 enclosure를 a0,b0로 고정한다. 그 외 status·3회 소진은 failure다.
이 성공 bracket은 항상 fallback 후보로 보존한다.
Upper candidate v의 세 intervals `(a0,v-delta(v))`, `(a0,v)`, `(a0,v+delta(v))`가
strict하고 enclosing 범위 안에 있으며 모두 `info=0`이고 같은 count c이면 guarded endpoint다.
`c>=N`이면 certified upper로 저장하고 더 낮은 v를 탐색한다. `c<N`은 탐색 왼쪽만
갱신하며 최종 a0를 움직이지 않는다. 서로 다른 successful count의 monotonicity 모순은
즉시 failure다. `info=1`은 empty 증명이 아니고 optional search를 종료한다.
Optional 후보의 `info=2,3,-5`도 search를 종료하고 이미 certified bracket을 유지한다.
그 외 invalid/inner-solver/SPD/index/allocation 오류는 즉시 failure다.
| 제어 | 고정 한계·처리 |
| --- | --- |
| Count 전체 | 초기·실패·guard·최종·retry를 모두 포함 최대512 calls |
| Optional upper search | 최대32 midpoint, optimization 최대384 calls; 나머지128은 최종·retry 예약 |
| Collision 후보 | midpoint에서 `0,+1,-1,+2,-2,+4,-4` times delta 순서 최대7; bracket 내부만 |
| Search 종료 | `N<=c<=min(n,2N+8)`, 폭 `<=8delta(mid)`, representable midpoint 없음 또는 optimization budget; 저장한 가장 작은 certified b 사용, 없으면 b0 |
| 최종 count | `(a0,b)` 성공 count=c>=N 재확인; interior b는 세 guard 재확인. b0는 outward bound가 margin 증거이며 outside empty count를 요구하지 않음 |
| Solve capacity | `m0=min(n,max(c+8,ceil(3c/2)))`; c=n이면 n. Overflow 전 exact integer 검사 |
| Solve 횟수 | 최초 포함 최대3, 각 refinement 최대20 |
| Solve retry | `info=1,2,3`, count/returned-m mismatch, endpoint separation failure에만 저장한 더 큰 certified b 선택 후 재count; 최종 b0. `m0=min(n,max(new formula,2*previous m0))` |
| Retry 종료 | 더 큰 certified bracket/증가 capacity 등 바뀐 입력이 없으면 동일 실패 call 반복 금지; 최종 검증·budget 부족이면 failure |
| 즉시 실패 | Nonfinite eigenpair, Gram/residual 실패, 유의한 negative spectrum, invalid/SPD/inner-solver/index/allocation 오류. Mass/seed/backend/threshold 변경 금지 |
Returned `m=c`, 전체 c개 독립 Gram/residual 및 `mu-a0>=delta(a0)`,
`b-mu>=delta(b)`를 검사하고 첫 N개만 공개한다. N번째가 반복군 안이면 전체 c를
검사하되 외부 requested rows는 N개다. Bounds/status/count/m0/m/loops/epsout/최종 ranks와
모든 실패·fallback을 기록한다. 초기 total count=n만으로 floating API의 무오류를 주장하지
않으며 known spectra/runtime probes로 구현을 반증 가능하게 검증한다.
## Storage와 미실행 위험
Count `x[n*n]`, `e[n]`, `res[n]` 보수 storage와 identity initial subspace를 사용한다.
`1<=N<=n<=MKL_INT_MAX`, `nnz+1`, `n+1`, `6*nodes`, `n*m0`, `n*n`, byte product,
container max_size 및 `min(SIZE_MAX,PTRDIFF_MAX)`를 overflow **전** 검사한다.
Global inverse를 만들지 않으며 allocation/shifted factorization 실패는 명시적으로 종료한다.
Count n² scratch는 최소 memory 보장이나 전체 peak memory 추정이 아니다.
[Research G01/G02](research.md#research-evidence)의 installed empty/occupied/endpoint/count reset,
workspace·header/runtime probes는 **NOT RUN**이다. Safe enclosing fallback으로 빈 count 성공이
수학적 전제에서는 제거됐지만 실제 FEAST 실행·메모리·cluster 동작 검증 의무는 남는다.