# Step 10: Dense BLAS Adapter ## 담당 역할과 필수 스킬 - 담당 역할: `implementation-agent` - 필수 스킬: `harness`, `fesa-cpp-msvc-tdd` - 이 Step만 `RED -> observed failure -> minimal GREEN -> focused/full VERIFY`로 수행한다. ## 읽어야 할 파일 - `/AGENTS.md` - `/docs/CODINGSTYLE.md` - `/docs/ARCHITECTURE.md` - `/docs/cpp-object-oriented-modular-refactoring/implementation-plan.md` - `/include/fesa/math/vector.h`, `/src/fesa/math/vector.cpp` - `/include/fesa/math/matrix.h`, `/src/fesa/math/matrix.cpp` - `/tests/unit/math/vector_test.cpp`, `/tests/unit/math/matrix_test.cpp` - `/src/fesa/CMakeLists.txt`, `/tests/CMakeLists.txt` - `/phases/cpp-object-oriented-modular-refactoring/index.json` - `/phases/cpp-object-oriented-modular-refactoring/step10.md` ## 작업 Requirement `R-DUP-002`의 dense-BLAS duplication만 제거한다. 1. `/tests/unit/math/dense_blas_internal_test.cpp`를 먼저 추가하고 `C-DUP-003`을 작성한다. Test는 zero/normal/overflow length conversion과 zero/nonzero contiguous copy behavior를 검증한다. 2. Missing internal adapter include/symbol로 RED compile failure를 기록한다. 3. Private candidate module은 `/src/fesa/math/dense_blas_internal.h`와 `/src/fesa/math/dense_blas_internal.cpp`다. Tests에 private include directory가 필요하면 `fesa_unit_tests`에만 `${PROJECT_SOURCE_DIR}/src/fesa`를 PRIVATE로 추가한다. 4. Candidate functions: ```cpp namespace fesa::dense_blas_internal { Result ToMklSize(std::size_t size); void CopyValues(const double* source, std::size_t size, double* destination); } // namespace fesa::dense_blas_internal ``` 5. `MKL_INT` and MKL includes are permitted only in this private implementation boundary and existing backend `.cpp`; no file under `/include/fesa/` may expose them. 6. Matrix/Vector의 duplicated conversion/copy helpers를 adapter call로 교체한다. Exception, Status/failure meaning, row-major layout and BLAS call order stay unchanged. ## Acceptance Criteria ```powershell cmake --build .harness/build --config Debug --target fesa_unit_tests ctest --test-dir .harness/build -C Debug ` -R "DenseMath|DenseBlasInternal" --output-on-failure rg -n "ToMklSize|CopyValues" src/fesa/math rg -n "MKL_INT|mkl\.h" include/fesa & "C:/Program Files/LLVM/bin/clang-format.exe" --dry-run --Werror ` src/fesa/math/dense_blas_internal.h src/fesa/math/dense_blas_internal.cpp ` src/fesa/math/vector.cpp src/fesa/math/matrix.cpp ` tests/unit/math/dense_blas_internal_test.cpp cmake --build .harness/build --config Debug ctest --test-dir .harness/build -C Debug --show-only=json-v1 ctest --test-dir .harness/build -C Debug --output-on-failure ``` The public-header vendor scan must return no matches. The private helper scan must show one definition family and the two intended consumers only. ## 검증 및 상태 갱신 - RED missing seam, focused conversion/copy behavior, scans and full CTest를 summary에 기록한다. - Public vendor type leak or behavior regression이면 `error`로 기록한다. - 성공 시 현재 Step만 `completed`로 갱신한다. - timestamp, retry, commit, advancement는 Executor 소유다. ## 금지사항 - Public math API에 MKL type을 추가하지 마라. - Matrix layout 또는 BLAS operation order를 바꾸지 마라. - SIMD, allocation or runtime performance optimization을 하지 마라. - 직접 commit하거나 hook script를 수동 실행하지 마라.