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>
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][Cols];
23 for( int i=0; i!=Rows; ++i )
24 for( int j=0; j!=Cols; ++j )
25 r1[i][j]=(i==Row?-x.a[i][j]:x.a[i][j]);
26 float r2[Rows][Cols];
27 assign(r2,neg_row<Row>(x));
28 BOOST_QVM_TEST_EQ(r1,r2);
29 neg_row<Row>(x) + neg_row<Row>(x);
30 -neg_row<Row>(x);
31 }
32 }
33
34 int
main()35 main()
36 {
37 test<2,2,0>();
38 test<2,2,1>();
39
40 test<3,3,0>();
41 test<3,3,1>();
42 test<3,3,2>();
43
44 test<4,4,0>();
45 test<4,4,1>();
46 test<4,4,2>();
47 test<4,4,3>();
48
49 test<5,5,0>();
50 test<5,5,1>();
51 test<5,5,2>();
52 test<5,5,3>();
53 test<5,5,4>();
54 return boost::report_errors();
55 }
56