28 #ifndef REMORA_KERNELS_MATRIX_ASSIGN_HPP 29 #define REMORA_KERNELS_MATRIX_ASSIGN_HPP 35 #include <type_traits> 37 namespace remora {
namespace kernels{
43 template<
class F,
class M,
class Device>
45 matrix_expression<M, Device> &m,
46 typename M::value_type t
48 if(m().size1() == 0|| m().size2() == 0)
return;
49 typedef typename M::orientation orientation;
50 bindings::matrix_assign<F> (m, t, orientation());
61 template<
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
63 matrix_expression<M, Device> &m,
64 matrix_expression<E, Device>
const& e,
65 row_major, EOrientation ,TagE tagE, TagM tagM
67 typedef typename std::conditional<
68 std::is_same<EOrientation, unknown_orientation>::value,
69 typename M::orientation,
70 typename E::orientation
72 bindings::matrix_assign(m,e,
typename M::orientation(),Orientation(),tagE,tagM);
77 template<
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
79 matrix_expression<M, Device> &m,
80 matrix_expression<E, Device>
const& e,
81 column_major, EOrientation,TagE tagE, TagM tagM
83 typedef typename M::orientation::transposed_orientation::orientation TMOrientation;
84 typedef typename E::orientation::transposed_orientation::orientation TEOrientation;
85 auto transM = trans(m);
86 auto transE = trans(e);
88 matrix_assign(transM,transE,TMOrientation(),TEOrientation(),tagE,tagM);
93 template<
class M,
class E,
class Device>
94 void assign(matrix_expression<M, Device>& m, matrix_expression<E, Device>
const& e) {
95 REMORA_SIZE_CHECK(m().size1() == e().size1());
96 REMORA_SIZE_CHECK(m().size2() == e().size2());
97 if(m().size1() == 0|| m().size2() == 0)
return;
98 typedef typename M::orientation::orientation MOrientation;
99 typedef typename E::orientation::orientation EOrientation;
100 typedef typename M::evaluation_category::tag MCategory;
101 typedef typename E::evaluation_category::tag ECategory;
102 detail::matrix_assign(m, e, MOrientation(),EOrientation(),MCategory(), ECategory());
113 template<
class F,
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
114 void matrix_assign_functor(
115 matrix_expression<M, Device> &m,
116 matrix_expression<E, Device>
const& e,
118 row_major, EOrientation ,TagE tagE, TagM tagM
120 typedef typename std::conditional<
121 std::is_same<EOrientation, unknown_orientation>::value,
122 typename M::orientation,
123 typename E::orientation
125 bindings::matrix_assign_functor(m,e,f,
typename M::orientation(),Orientation(),tagE,tagM);
130 template<
class F,
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
131 void matrix_assign_functor(
132 matrix_expression<M, Device> &m,
133 matrix_expression<E, Device>
const& e,
135 column_major, EOrientation,TagE tagE, TagM tagM
137 typedef typename M::orientation::transposed_orientation::orientation TMOrientation;
138 typedef typename E::orientation::transposed_orientation::orientation TEOrientation;
140 auto transM = trans(m);
141 auto transE = trans(e);
142 matrix_assign_functor(transM,transE,f,TMOrientation(),TEOrientation(),tagE,tagM);
149 template<
class F,
class M,
class E,
class Device>
150 void assign(matrix_expression<M, Device> &m,
const matrix_expression<E, Device> &e, F f = F()) {
151 REMORA_SIZE_CHECK(m().size1() == e().size1());
152 REMORA_SIZE_CHECK(m().size2() == e().size2());
153 if(m().size1() == 0|| m().size2() == 0)
return;
154 typedef typename M::orientation::orientation MOrientation;
155 typedef typename E::orientation::orientation EOrientation;
156 typedef typename M::evaluation_category::tag MCategory;
157 typedef typename E::evaluation_category::tag ECategory;
158 detail::matrix_assign_functor(m, e, f, MOrientation(),EOrientation(), MCategory(), ECategory());