]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/qvm/detail/mat_assign.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / qvm / detail / mat_assign.hpp
1 #ifndef BOOST_QVM_DETAIL_MAT_ASSIGN_HPP_INCLUDED
2 #define BOOST_QVM_DETAIL_MAT_ASSIGN_HPP_INCLUDED
3
4 // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc.
5
6 // Distributed under the Boost Software License, Version 1.0. (See accompanying
7 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9 #include <boost/qvm/gen/mat_assign2.hpp>
10 #include <boost/qvm/gen/mat_assign3.hpp>
11 #include <boost/qvm/gen/mat_assign4.hpp>
12
13 namespace boost { namespace qvm {
14
15 namespace
16 qvm_detail
17 {
18 template <int M,int N>
19 struct
20 assign_mm_defined
21 {
22 static bool const value=false;
23 };
24
25 template <int I,int N>
26 struct
27 copy_matrix_elements
28 {
29 template <class A,class B>
30 static
31 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
32 void
33 f( A & a, B const & b )
34 {
35 mat_traits<A>::template write_element<I/mat_traits<A>::cols,I%mat_traits<A>::cols>(a) =
36 mat_traits<B>::template read_element<I/mat_traits<B>::cols,I%mat_traits<B>::cols>(b);
37 copy_matrix_elements<I+1,N>::f(a,b);
38 }
39 };
40
41 template <int N>
42 struct
43 copy_matrix_elements<N,N>
44 {
45 template <class A,class B>
46 static
47 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_CRITICAL
48 void
49 f( A &, B const & )
50 {
51 }
52 };
53 }
54
55 template <class A,class B>
56 BOOST_QVM_CONSTEXPR BOOST_QVM_INLINE_TRIVIAL
57 typename enable_if_c<
58 is_mat<A>::value && is_mat<B>::value &&
59 mat_traits<A>::rows==mat_traits<B>::rows &&
60 mat_traits<A>::cols==mat_traits<B>::cols &&
61 !qvm_detail::assign_mm_defined<mat_traits<A>::rows,mat_traits<A>::cols>::value,
62 A &>::type
63 assign( A & a, B const & b )
64 {
65 qvm_detail::copy_matrix_elements<0,mat_traits<A>::rows*mat_traits<A>::cols>::f(a,b);
66 return a;
67 }
68
69 } }
70
71 #endif