]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/swap_rows_test.cpp
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
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)
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"
16 template <int Rows
,int Cols
,int R1
,int R2
>
20 using namespace boost::qvm
;
21 test_qvm::matrix
<M1
,Rows
,Cols
> x(42,1);
23 for( int i
=0; i
!=Rows
; ++i
)
24 for( int j
=0; j
!=Cols
; ++j
)
25 r1
[i
][j
]=x
.a
[i
==R1
?R2
:i
==R2
?R1
:i
][j
];
27 assign(r2
,swap_rows
<R1
,R2
>(x
));
28 BOOST_QVM_TEST_EQ(r1
,r2
);
29 swap_rows
<R1
,R2
>(x
) *= 2;
30 for( int i
=0; i
!=Rows
; ++i
)
31 for( int j
=0; j
!=Cols
; ++j
)
32 r1
[i
][j
]=x
.a
[i
==R1
?R2
:i
==R2
?R1
:i
][j
];
33 assign(r2
,swap_rows
<R1
,R2
>(x
));
34 BOOST_QVM_TEST_EQ(r1
,r2
);
35 swap_rows
<R1
,R2
>(x
)+swap_rows
<R1
,R2
>(x
);
100 return boost::report_errors();