Go to the documentation of this file.00001
00002
00003 #ifndef testCompositions_hh
00004 #define testCompositions_hh
00005
00006 #include <memory>
00007 #include "basics/testcase.hh"
00008 #include "operator/sparseMatrix.hh"
00009 #include "operator/permutation.hh"
00010 #include "sparseqr/driver.hh"
00011 #include "sparseqr/givensRotations.hh"
00012
00013 namespace test {
00014
00015 using concepts::Real;
00016
00017
00018
00019 class CompositionTestBase : public TestCase {
00020 protected:
00021 template<typename F>
00022 void compare(const concepts::Matrix<F>& a, concepts::Operator<F>& b);
00023 };
00024
00025
00026
00034 class CompositionsTest : public CompositionTestBase {
00035 public:
00037 CompositionsTest();
00038 virtual ~CompositionsTest() {}
00039 virtual void run();
00040
00042
00043
00044 void test1();
00046 void test2();
00048 void test3();
00050 void test4();
00052 void test5();
00054 private:
00055
00056 uint dim;
00057 concepts::SparseMatrix<Real> a, b, c;
00058 };
00059
00060
00061
00069 class MoreCompositionsTest : public CompositionTestBase {
00070 public:
00072 MoreCompositionsTest();
00073 virtual ~MoreCompositionsTest() {}
00074 virtual void run();
00075
00077
00078
00081 void testPermutationConsistency();
00085 void testTrivExtendRestrictConsistency();
00089 void testCompositions();
00091 private:
00092
00093 uint dim;
00094 concepts::SparseMatrix<Real> a;
00095 };
00096
00097
00098
00104 class DeepCompositionsTest : public CompositionTestBase {
00105 public:
00107 DeepCompositionsTest();
00108 virtual ~DeepCompositionsTest() {}
00109 virtual void run();
00110 void createSparseQR();
00111
00113
00114 void testCompositions();
00116 private:
00117 concepts::DummySpace<Real> spc, cspc;
00118 concepts::SparseMatrix<Real> a, b, c;
00119 std::auto_ptr<sparseqr::Driver> qr;
00120 concepts::Permutation<Real> * Pr;
00121 std::auto_ptr<concepts::Permutation<Real> > Prt;
00122 sparseqr::GivensRotations<Real> * Qgt, * Qg;
00123 concepts::TrivExtendRestrict<Real>* ext, * restr;
00124 std::auto_ptr<concepts::Compose<Real> > PrQgt, QgPrt, restrPrQgt,
00125 QgPrtext, restrPrQgtA, restrPrQgtAQgPrtext, restrPrQgtM,
00126 restrPrQgtMQgPrtext;
00127 };
00128
00129 }
00130
00131 #endif // testCompositions_hh