perf(math): route ordinary products through MKL and preserve arithmetic
This commit is contained in:
@@ -32,11 +32,7 @@ Status Failure(const std::string& code, const std::string& identity,
|
||||
}
|
||||
|
||||
double Dot(const Vector& left, const Vector& right) {
|
||||
double result = 0.0;
|
||||
for (std::size_t index = 0U; index < left.Size(); ++index) {
|
||||
result += left[index] * right[index];
|
||||
}
|
||||
return result;
|
||||
return left.Dot(right);
|
||||
}
|
||||
|
||||
double Norm(const Vector& vector) {
|
||||
@@ -318,8 +314,13 @@ Result<EigenAnalysisState> ExecuteCandidate(const Domain& domain) {
|
||||
(pencil_scale * y_norm) * y_norm);
|
||||
const double rayleigh = energy / modal_mass;
|
||||
Vector x(a.Rows());
|
||||
for (std::size_t row = 0; row < x.Size(); ++row)
|
||||
for (std::size_t row = 0; row < x.Size(); ++row) {
|
||||
x[row] = state.backend.eigenvectors(row, column) * normalization;
|
||||
if (!std::isfinite(x[row]))
|
||||
return Result<EigenAnalysisState>::Failure(
|
||||
Failure("invalid-eigenvalue-result", std::to_string(column),
|
||||
"Recovered mode is nonfinite or violates constraints."));
|
||||
}
|
||||
Vector ax = a.Multiply(x);
|
||||
Vector whitened_residual = ax;
|
||||
whitened_residual.Axpy(-lambda, x);
|
||||
@@ -421,6 +422,10 @@ Result<EigenAnalysisState> LinearFrequencyProcedureExecutor::Execute(
|
||||
return Result<EigenAnalysisState>::Failure(
|
||||
Failure("eigen-index-overflow", "modal-workspace",
|
||||
"Requested workspace exceeds container capacity."));
|
||||
} catch (const std::runtime_error&) {
|
||||
return Result<EigenAnalysisState>::Failure(
|
||||
Failure("eigen-multiplication-failed", "modal-workspace",
|
||||
"Modal sparse multiplication failed."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user