X-Git-Url: https://git.sthu.org/?p=libstick.git;a=blobdiff_plain;f=tests%2Fsimplicialcomplex.h;h=afc9fab1c8f649603b4044f7c602bfd1e0b4a22b;hp=fa829e1f31dfa08ed02f9641ff7369feaee3a0e1;hb=929c696bfb48aa0f96ce2b70b1b926b5f2b2dede;hpb=267194caeb2fe56530b11c440fefd01c344e5482 diff --git a/tests/simplicialcomplex.h b/tests/simplicialcomplex.h index fa829e1..afc9fab 100644 --- a/tests/simplicialcomplex.h +++ b/tests/simplicialcomplex.h @@ -5,6 +5,7 @@ #include #include +#include using namespace libstick; @@ -32,6 +33,7 @@ class SimplicialComplexTestSuite: public Test::Suite { TEST_ADD(SimplicialComplexTestSuite::test_isOrderFiltration); TEST_ADD(SimplicialComplexTestSuite::test_isOrderMonotone); TEST_ADD(SimplicialComplexTestSuite::test_boundaryMatrix); + TEST_ADD(SimplicialComplexTestSuite::test_matrixreduction); } protected: @@ -43,43 +45,43 @@ class SimplicialComplexTestSuite: public Test::Suite { const unsigned num = 11; scomplex::Simplex ss[num] = { // dimension, faces, value... - {0, {0, 0, 0}, 0}, - {0, {0, 0, 0}, 1}, - {0, {0, 0, 0}, 2}, - {0, {0, 0, 0}, 3}, - {1, {0, 1, 0}, 4}, - {1, {1, 2, 0}, 5}, - {1, {2, 3, 0}, 6}, - {1, {3, 0, 0}, 7}, - {1, {0, 2, 0}, 8}, - {2, {6, 7, 8}, 9}, - {2, {4, 5, 8}, 10} + {0, {}, 1}, + {0, {}, 2}, + {0, {}, 3}, + {0, {}, 4}, + {1, {1, 2}, 5}, + {1, {2, 3}, 6}, + {1, {3, 4}, 7}, + {1, {4, 1}, 8}, + {1, {1, 3}, 9}, + {2, {7, 8, 9}, 10}, + {2, {5, 6, 9}, 11} }; // This is o1 This is o2 This is o3(b) // (value = index) (values) (values) // - // 0 ----4---- 1 0 ----4---- 1 0 ----4---- 1 - // |\ | |\ | |\ | - // | \ 10 | | \ 10 | | \ 12 | - // | \ | | \ | | \ | - // | \ | | \ | | \ | - // 7 8 5 7 8 11 7 8 11 - // | \ | | \ | | \ | - // | 9 \ | | 9 \ | | 9 \ | - // | \ | | \ | | \ | - // | \| | \| | \| - // 3 ----6---- 2 3 ----6---- 2 3 ----6---- 2 + // 1 ----5---- 2 1 ----5---- 2 1 ----5---- 2 + // |\ | |\ | |\ | + // | \ 11 | | \ 11 | | \ 13 | + // | \ | | \ | | \ | + // | \ | | \ | | \ | + // 8 9 6 8 9 12 8 9 12 + // | \ | | \ | | \ | + // | 10 \ | | 10 \ | | 10 \ | + // | \ | | \ | | \ | + // | \| | \| | \| + // 4 ----7---- 3 4 ----7---- 3 4 ----7---- 3 // Build the complex for (unsigned i=0; i(b.size()); + + bm b_orig = b; + reduceBoundaryMatrix(b, v); + TEST_ASSERT(b == b_orig*v); + + //std::cout << std::endl << "after reduce: " << std::endl; + //std::cout << std::endl << b << std::endl; + //std::cout << std::endl << v << std::endl; + //std::cout << std::endl << (b_orig*v) << std::endl; } };