Skip to content

Commit 90b38be

Browse files
committed
basis orthonormality tests
1 parent cf55f61 commit 90b38be

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

rom/laghos_rom.cpp

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,7 @@ void ROM_Basis::ReadSolutionBases(const int window)
22992299
{
23002300
if (window == 0)
23012301
{
2302-
// For the first window, read all rdimv basis vectors normally.
2302+
// For the first window, read all rdimv basis vectors normally.
23032303
basisV = ReadBasisROM(rank, basename + "/" + ROMBasisName::V +
23042304
std::to_string(window) + basisIdentifier, tH1size, rdimv);
23052305
}
@@ -2365,6 +2365,18 @@ void ROM_Basis::ReadSolutionBases(const int window)
23652365
(*basisE)(i, tmp_rdime) = unitE[i];
23662366
}
23672367
basisE->orthogonalize_last();
2368+
2369+
std::cout << "Ortho test 1" << "\n";
2370+
Vector test_ortho(rdime);
2371+
test_ortho = 0.0;
2372+
2373+
for (int j = 0; j < rdime; j++)
2374+
{
2375+
for (int i = 0; i < tL2size; i++)
2376+
test_ortho[j] += (*basisE)(i, j) * (*basisE)(i, rdime - 1);
2377+
2378+
std::cout << test_ortho[j] << "\n";
2379+
}
23682380
}
23692381
else
23702382
{
@@ -2591,6 +2603,18 @@ void ROM_Basis::AddLastCol_V(Vector const& f)
25912603
(*basisV)(i, rdimv-1) = mfH1[i];
25922604

25932605
basisV->orthogonalize_last();
2606+
2607+
std::cout << "Ortho test 2" << "\n";
2608+
Vector test_ortho(rdimv);
2609+
test_ortho = 0.0;
2610+
2611+
for (int j = 0; j < rdimv; j++)
2612+
{
2613+
for (int i = 0; i < tH1size; i++)
2614+
test_ortho[j] += (*basisV)(i, j) * (*basisV)(i, rdimv - 1);
2615+
2616+
std::cout << test_ortho[j] << "\n";
2617+
}
25942618
}
25952619

25962620
// f is a full vector, not a true vector
@@ -2607,6 +2631,28 @@ void ROM_Basis::AddLastCol_E(Vector const& f)
26072631
(*basisE)(i, rdime-1) = mfL2[i];
26082632

26092633
basisE->orthogonalize_last();
2634+
2635+
std::cout << "Ortho test 3a" << "\n";
2636+
Vector test_ortho(rdime);
2637+
test_ortho = 0.0;
2638+
2639+
for (int j = 0; j < rdime - 1; j++)
2640+
{
2641+
for (int i = 0; i < tL2size; i++)
2642+
test_ortho[j] += (*basisE)(i, j) * (*basisE)(i, rdime - 2);
2643+
2644+
std::cout << test_ortho[j] << "\n";
2645+
}
2646+
2647+
std::cout << "Ortho test 3b" << "\n";
2648+
test_ortho = 0.0;
2649+
for (int j = 0; j < rdime; j++)
2650+
{
2651+
for (int i = 0; i < tL2size; i++)
2652+
test_ortho[j] += (*basisE)(i, j) * (*basisE)(i, rdime - 1);
2653+
2654+
std::cout << test_ortho[j] << "\n";
2655+
}
26102656
}
26112657

26122658
// f is a full vector, not a true vector

0 commit comments

Comments
 (0)