| 1 | // Copyright 2008-2022 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 | #ifdef BOOST_QVM_TEST_SINGLE_HEADER |
| 7 | # include BOOST_QVM_TEST_SINGLE_HEADER |
| 8 | #else |
| 9 | # include <boost/qvm/map_mat_mat.hpp> |
| 10 | # include <boost/qvm/mat_operations.hpp> |
| 11 | # include <boost/qvm/mat.hpp> |
| 12 | #endif |
| 13 | |
| 14 | #include <boost/qvm/mat_traits_array.hpp> |
| 15 | #include "test_qvm.hpp" |
| 16 | #include "test_qvm_matrix.hpp" |
| 17 | #include "gold.hpp" |
| 18 | |
| 19 | namespace |
| 20 | { |
| 21 | template <int Rows,int Cols,int Row> |
| 22 | void |
| 23 | test() |
| 24 | { |
| 25 | using namespace boost::qvm; |
| 26 | test_qvm::matrix<M1,Rows,Cols> x(42,1); |
| 27 | float r1[Rows-1][Cols]; |
| 28 | for( int i=0; i!=Rows-1; ++i ) |
| 29 | for( int j=0; j!=Cols; ++j ) |
| 30 | r1[i][j]=x.a[i+(i>=Row)][j]; |
| 31 | float r2[Rows-1][Cols]; |
| 32 | assign(r2,del_row<Row>(x)); |
| 33 | BOOST_QVM_TEST_EQ(r1,r2); |
| 34 | del_row<Row>(x) *= 2; |
| 35 | for( int i=0; i!=Rows-1; ++i ) |
| 36 | for( int j=0; j!=Cols; ++j ) |
| 37 | r1[i][j]=x.a[i+(i>=Row)][j]; |
| 38 | assign(r2,del_row<Row>(x)); |
| 39 | BOOST_QVM_TEST_EQ(r1,r2); |
| 40 | del_row<Row>(x)+del_row<Row>(x); |
| 41 | -del_row<Row>(x); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | int |
| 46 | main() |
| 47 | { |
| 48 | test<2,2,0>(); |
| 49 | test<2,2,1>(); |
| 50 | |
| 51 | test<3,3,0>(); |
| 52 | test<3,3,1>(); |
| 53 | test<3,3,2>(); |
| 54 | |
| 55 | test<4,4,0>(); |
| 56 | test<4,4,1>(); |
| 57 | test<4,4,2>(); |
| 58 | test<4,4,3>(); |
| 59 | |
| 60 | test<5,5,0>(); |
| 61 | test<5,5,1>(); |
| 62 | test<5,5,2>(); |
| 63 | test<5,5,3>(); |
| 64 | test<5,5,4>(); |
| 65 | return boost::report_errors(); |
| 66 | } |
| 67 | |