28#ifndef REMORA_KERNELS_MATRIX_ASSIGN_HPP
29#define REMORA_KERNELS_MATRIX_ASSIGN_HPP
37namespace remora {
namespace kernels{
39template<
class F,
class M,
class Device>
41 matrix_expression<M, Device>& m,
44 if(m().size1() == 0|| m().size2() == 0)
return;
45 typedef typename M::orientation orientation;
46 bindings::matrix_apply(m, f, orientation());
54template<
class F,
class M,
class Device>
56 matrix_expression<M, Device>& m,
57 typename M::value_type t
59 if(m().size1() == 0|| m().size2() == 0)
return;
60 typedef typename M::orientation orientation;
61 bindings::matrix_assign<F> (m, t, orientation());
72template<
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
74 matrix_expression<M, Device>& m,
75 matrix_expression<E, Device>
const& e,
76 row_major, EOrientation ,TagE tagE, TagM tagM
78 typedef typename std::conditional<
79 std::is_same<EOrientation, unknown_orientation>::value,
81 typename E::orientation
83 bindings::matrix_assign(m, e,
typename M::orientation(), Orientation(), tagE, tagM);
88template<
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
90 matrix_expression<M, Device>& m,
91 matrix_expression<E, Device>
const& e,
92 column_major, EOrientation,TagE tagE, TagM tagM
94 typedef typename M::orientation::transposed_orientation::orientation TMOrientation;
95 typedef typename E::orientation::transposed_orientation::orientation TEOrientation;
96 auto transM = trans(m);
97 auto transE = trans(e);
99 matrix_assign(transM, transE, TMOrientation(), TEOrientation(), tagE, tagM);
104template<
class M,
class E,
class Device>
106 matrix_expression<M, Device>& m,
107 matrix_expression<E, Device>
const& e
109 REMORA_SIZE_CHECK(m().size1() == e().size1());
110 REMORA_SIZE_CHECK(m().size2() == e().size2());
111 if(m().size1() == 0|| m().size2() == 0)
return;
112 typedef typename M::orientation::orientation MOrientation;
113 typedef typename E::orientation::orientation EOrientation;
114 typedef typename M::evaluation_category::tag MCategory;
115 typedef typename E::evaluation_category::tag ECategory;
116 detail::matrix_assign(m, e, MOrientation(), EOrientation(), MCategory(), ECategory());
127template<
class F,
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
128void matrix_assign_functor(
129 matrix_expression<M, Device>& m,
130 matrix_expression<E, Device>
const& e,
132 row_major, EOrientation ,TagE tagE, TagM tagM
134 typedef typename std::conditional<
135 std::is_same<EOrientation, unknown_orientation>::value,
137 typename E::orientation
139 bindings::matrix_assign_functor(m, e, f,
typename M::orientation(), Orientation(), tagE, tagM);
144template<
class F,
class M,
class E,
class EOrientation,
class TagE,
class TagM,
class Device>
145void matrix_assign_functor(
146 matrix_expression<M, Device>& m,
147 matrix_expression<E, Device>
const& e,
149 column_major, EOrientation,TagE tagE, TagM tagM
151 typedef typename M::orientation::transposed_orientation::orientation TMOrientation;
152 typedef typename E::orientation::transposed_orientation::orientation TEOrientation;
154 auto transM = trans(m);
155 auto transE = trans(e);
156 matrix_assign_functor(transM, transE, f, TMOrientation(), TEOrientation(), tagE, tagM);
163template<
class F,
class M,
class E,
class Device>
165 matrix_expression<M, Device>& m,
166 matrix_expression<E, Device>
const&e,
169 REMORA_SIZE_CHECK(m().size1() == e().size1());
170 REMORA_SIZE_CHECK(m().size2() == e().size2());
171 if(m().size1() == 0|| m().size2() == 0)
return;
172 typedef typename M::orientation::orientation MOrientation;
173 typedef typename E::orientation::orientation EOrientation;
174 typedef typename M::evaluation_category::tag MCategory;
175 typedef typename E::evaluation_category::tag ECategory;
176 detail::matrix_assign_functor(m, e, f, MOrientation(), EOrientation(), MCategory(), ECategory());