fix(math): preflight finite dense operands at dispatch boundary

This commit is contained in:
KOKO\Mimi
2026-10-14 16:02:17 +09:00
parent 770fa2a0d1
commit 9c4e6854ae
8 changed files with 65 additions and 5 deletions
@@ -1194,8 +1194,13 @@ Result<FeastEigenResult> MklFeastEigenSolver::SolveImpl(
for (std::size_t row = 0; row < n; ++row)
mode[row] = ordered_vectors(row, right);
const auto action = mass != nullptr ? mass->Multiply(mode) : std::move(mode);
for (std::size_t row = 0; row < n; ++row)
for (std::size_t row = 0; row < n; ++row) {
if (!std::isfinite(action[row]))
return Result<FeastEigenResult>::Failure(
TraceFailure("eigenpair-validation-failed", "gram",
"The independent mass action is nonfinite."));
mass_modes(row, right) = action[row];
}
}
const auto gram = dense_blas_internal::MultiplyTransposeLeft(ordered_vectors,
mass_modes);
@@ -1245,6 +1250,10 @@ Result<FeastEigenResult> MklFeastEigenSolver::SolveImpl(
solve_upper,
upper_search_termination};
return Result<FeastEigenResult>::Success(std::move(result));
} catch (const std::invalid_argument&) {
return Result<FeastEigenResult>::Failure(
Failure("eigenpair-validation-failed", "independent-action",
"Modal product inputs must be finite and shape compatible."));
} catch (const std::length_error&) {
return Result<FeastEigenResult>::Failure(
Failure("feast-integer-overflow", "independent-action",