Skip to content

Commit

Permalink
Output eigenvalue absolute error
Browse files Browse the repository at this point in the history
  • Loading branch information
siuwuncheung committed Apr 4, 2024
1 parent ff004a4 commit af1f38d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/prom/elliptic_eigenproblem_global_rom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,14 @@ int main(int argc, char *argv[])
for (int i = 0; i < eigenvalues.Size() && i < nev; i++)
{
diff_ev[i] = ev_fom[i] - eigenvalues[i];
double ev_diff_norm = sqrt(diff_ev[i] * diff_ev[i]);
double ev_fom_norm = sqrt(ev_fom[i] * ev_fom[i]);
if (myid == 0)
{
std::cout << "FOM solution for eigenvalue " << i << " = " <<
ev_fom[i] << std::endl;
std::cout << "Absolute error of ROM solution for eigenvalue " << i << " = " <<
abs(diff_ev[i]) << std::endl;
std::cout << "Relative error of ROM solution for eigenvalue " << i << " = " <<
ev_diff_norm / ev_fom_norm << std::endl;
abs(diff_ev[i]) / abs(ev_fom[i]) << std::endl;
}
}

Expand Down

0 comments on commit af1f38d

Please sign in to comment.