1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
2 
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 #include <boost/qvm/map_mat_mat.hpp>
7 #include <boost/qvm/mat_operations.hpp>
8 #include <boost/qvm/mat_traits_array.hpp>
9 #include <boost/qvm/mat.hpp>
10 #include "test_qvm.hpp"
11 #include "test_qvm_matrix.hpp"
12 #include "gold.hpp"
13 
14 namespace
15     {
16     template <int Rows,int Cols,int Row,int Col>
17     void
test()18     test()
19         {
20         using namespace boost::qvm;
21         test_qvm::matrix<M1,Rows,Cols> x(42,1);
22         float r1[Rows-1][Cols-1];
23         for( int i=0; i!=Rows-1; ++i )
24             for( int j=0; j!=Cols-1; ++j )
25                 r1[i][j]=x.a[i+(i>=Row)][j+(j>=Col)];
26         float r2[Rows-1][Cols-1];
27         assign(r2,del_row_col<Row,Col>(x));
28         BOOST_QVM_TEST_EQ(r1,r2);
29         del_row_col<Row,Col>(x) *= 2;
30         for( int i=0; i!=Rows-1; ++i )
31             for( int j=0; j!=Cols-1; ++j )
32                 r1[i][j]=x.a[i+(i>=Row)][j+(j>=Col)];
33         assign(r2,del_row_col<Row,Col>(x));
34         BOOST_QVM_TEST_EQ(r1,r2);
35         del_row_col<Row,Col>(x) + del_row_col<Row,Col>(x);
36         -del_row_col<Row,Col>(x);
37         }
38     }
39 
40 int
main()41 main()
42     {
43     test<2,2,0,0>();
44     test<2,2,0,1>();
45     test<2,2,1,0>();
46     test<2,2,1,1>();
47 
48     test<3,3,0,0>();
49     test<3,3,0,1>();
50     test<3,3,0,2>();
51     test<3,3,1,0>();
52     test<3,3,1,1>();
53     test<3,3,1,2>();
54     test<3,3,2,0>();
55     test<3,3,2,1>();
56     test<3,3,2,2>();
57 
58     test<4,4,0,0>();
59     test<4,4,0,1>();
60     test<4,4,0,2>();
61     test<4,4,0,3>();
62     test<4,4,1,0>();
63     test<4,4,1,1>();
64     test<4,4,1,2>();
65     test<4,4,1,3>();
66     test<4,4,2,0>();
67     test<4,4,2,1>();
68     test<4,4,2,2>();
69     test<4,4,2,3>();
70     test<4,4,3,0>();
71     test<4,4,3,1>();
72     test<4,4,3,2>();
73     test<4,4,3,3>();
74 
75     test<5,5,0,0>();
76     test<5,5,0,1>();
77     test<5,5,0,2>();
78     test<5,5,0,3>();
79     test<5,5,0,4>();
80     test<5,5,1,0>();
81     test<5,5,1,1>();
82     test<5,5,1,2>();
83     test<5,5,1,3>();
84     test<5,5,1,4>();
85     test<5,5,2,0>();
86     test<5,5,2,1>();
87     test<5,5,2,2>();
88     test<5,5,2,3>();
89     test<5,5,2,4>();
90     test<5,5,3,0>();
91     test<5,5,3,1>();
92     test<5,5,3,2>();
93     test<5,5,3,3>();
94     test<5,5,3,4>();
95     test<5,5,4,0>();
96     test<5,5,4,1>();
97     test<5,5,4,2>();
98     test<5,5,4,3>();
99     test<5,5,4,4>();
100     return boost::report_errors();
101     }
102