Commit a5f1e73a authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

using rvector

parent b601265a
......@@ -25,11 +25,11 @@ protected:
};
TEST_F(TestCirculantEmbedding1D, TestCovarianceMatrix) {
ToeplitzRow ar;
ToeplitzColumn ac;
RVector ar;
RVector ac;
generator->createCovarianceMatrix(ar, ac);
ToeplitzRow expectedAr{1.0, 0.3291930, 0.10836802, 0.0356740};
ToeplitzColumn expectedAc{1.0, 0.3291930, 0.10836802, 0.0356740};
RVector expectedAr{1.0, 0.3291930, 0.10836802, 0.0356740};
RVector expectedAc{1.0, 0.3291930, 0.10836802, 0.0356740};
for (int i = 0; i < expectedAr.size(); i++) {
EXPECT_NEAR(expectedAr[i], ar[i], 1e-6);
EXPECT_NEAR(expectedAc[i], ac[i], 1e-6);
......@@ -42,21 +42,23 @@ TEST_F(TestCirculantEmbedding1D, TestCovarianceMatrix) {
}
TEST_F(TestCirculantEmbedding1D, TestEmbedCovarianceMatrix) {
ToeplitzRow ar{1.0, 0.3291930, 0.10836802, 0.0356740};
ToeplitzColumn ac{1.0, 0.3291930, 0.10836802, 0.0356740};
CirculantRow br;
CirculantRow expectedBr{1.0, 0.3291930, 0.10836802, 0.0356740,
0.0356740, 0.10836802, 0.3291930};
generator->embedCovarianceMatrix(ar, ac, br);
for (int i = 0; i < expectedBr.size(); i++) {
EXPECT_NEAR(expectedBr[i], br[i], 1e-6);
RVector toeplitzRow{1.0, 0.3291930, 0.10836802, 0.0356740};
RVector toeplitzColumn{1.0, 0.3291930, 0.10836802, 0.0356740};
RVector circulantRow;
generator->embedCovarianceMatrix(toeplitzRow, toeplitzColumn, circulantRow);
RVector expectedCirculantRow{
1.0, 0.3291930, 0.10836802, 0.0356740, 0.0356740, 0.10836802, 0.3291930
};
for (int i = 0; i < expectedCirculantRow.size(); i++) {
EXPECT_NEAR(expectedCirculantRow[i], circulantRow[i], 1e-6);
}
}
TEST_F(TestCirculantEmbedding1D, TestEigenValues) {
CirculantRow br{1.0, 0.1888756, 0.03567399, 0.03567399, 0.1888756};
EigenValues1D ev;
EigenValues1D expectedEv{1.44909919, 1.05900981, 0.7164406, 0.7164406, 1.05900981};
RVector br{1.0, 0.1888756, 0.03567399, 0.03567399, 0.1888756};
RVector ev;
RVector expectedEv{1.44909919, 1.05900981, 0.7164406, 0.7164406, 1.05900981};
generator->computeEV(br, ev);
for (int i = 0; i < expectedEv.size(); i++) {
EXPECT_NEAR(expectedEv[i], ev[i], 1e-6);
......@@ -64,11 +66,11 @@ TEST_F(TestCirculantEmbedding1D, TestEigenValues) {
}
TEST_F(TestCirculantEmbedding1D, TestPaddingDummyExample) {
ToeplitzRow ar{1.0, 0.3291930, 0.10836802, 0.0356740};
ToeplitzColumn ac{1.0, 0.3291930, 0.10836802, 0.0356740};
RVector ar{1.0, 0.3291930, 0.10836802, 0.0356740};
RVector ac{1.0, 0.3291930, 0.10836802, 0.0356740};
generator->padding(ar, ac);
ToeplitzRow expectedAr{1.0, 0.3291930, 0.10836802, 0.0356740, 0.0117436, 0.0038659};
ToeplitzColumn
RVector expectedAr{1.0, 0.3291930, 0.10836802, 0.0356740, 0.0117436, 0.0038659};
RVector
expectedAc{1.0, 0.3291930, 0.10836802, 0.0356740, 0.0117436, 0.0038659};
for (int i = 0; i < expectedAr.size(); i++) {
EXPECT_NEAR(expectedAr[i], ar[i], 1e-6);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment