Skip to content

Commit

Permalink
basis orthonormality tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cval26 committed Dec 7, 2023
1 parent cf55f61 commit 72c6662
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion rom/laghos_rom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2299,7 +2299,7 @@ void ROM_Basis::ReadSolutionBases(const int window)
{
if (window == 0)
{
// For the first window, read all rdimv basis vectors normally.
// For the first window, read all rdimv basis vectors normally.
basisV = ReadBasisROM(rank, basename + "/" + ROMBasisName::V +
std::to_string(window) + basisIdentifier, tH1size, rdimv);
}
Expand Down Expand Up @@ -2365,6 +2365,16 @@ void ROM_Basis::ReadSolutionBases(const int window)
(*basisE)(i, tmp_rdime) = unitE[i];
}
basisE->orthogonalize_last();

std::cout << "Ortho test 1" << "\n";
Vector test_ortho(rdime) = 0.0;
for (int j = 0; j < rdime; j++)
{
for (int i = 0; i < tL2size; i++)
test_ortho[j] += (*basisE)(i, j) * (*basisE)(i, rdime - 1);

std::cout << test_ortho[j] << "\n";
}
}
else
{
Expand Down Expand Up @@ -2591,6 +2601,17 @@ void ROM_Basis::AddLastCol_V(Vector const& f)
(*basisV)(i, rdimv-1) = mfH1[i];

basisV->orthogonalize_last();

std::cout << "Ortho test 2" << "\n";
Vector test_ortho(rdimv) = 0.0;

for (int j = 0; j < rdimv; j++)
{
for (int i = 0; i < tH1size; i++)
test_ortho[j] += (*basisV)(i, j) * (*basisV)(i, rdimv - 1);

std::cout << test_ortho[j] << "\n";
}
}

// f is a full vector, not a true vector
Expand All @@ -2607,6 +2628,27 @@ void ROM_Basis::AddLastCol_E(Vector const& f)
(*basisE)(i, rdime-1) = mfL2[i];

basisE->orthogonalize_last();

std::cout << "Ortho test 3a" << "\n";
Vector test_ortho(rdime) = 0.0;

for (int j = 0; j < rdime - 1; j++)
{
for (int i = 0; i < tL2size; i++)
test_ortho[j] += (*basisE)(i, j) * (*basisE)(i, rdime - 2);

std::cout << test_ortho[j] << "\n";
}

std::cout << "Ortho test 3b" << "\n";
test_ortho = 0.0;
for (int j = 0; j < rdime; j++)
{
for (int i = 0; i < tL2size; i++)
test_ortho[j] += (*basisE)(i, j) * (*basisE)(i, rdime - 1);

std::cout << test_ortho[j] << "\n";
}
}

// f is a full vector, not a true vector
Expand Down

0 comments on commit 72c6662

Please sign in to comment.