Skip to content

Commit

Permalink
Added proper LHS handling for transforms
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffburdick committed Aug 4, 2023
1 parent 6213d10 commit a9a5d8e
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 11 deletions.
20 changes: 18 additions & 2 deletions include/matx/operators/collapse.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ namespace matx
return op_.Size(DIM + dim - 1);
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}
/**
Expand Down Expand Up @@ -257,7 +265,15 @@ namespace matx
return op_.Size(dim);
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}
/**
Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/concat.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,15 @@ namespace matx
return cuda::std::get<0>(ops_).Size(dim);
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}

private:
cuda::std::tuple<Ts...> ops_;
Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/permute.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,15 @@ namespace matx
return op_.Size(dims_[dim]);
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}

Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/remap.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,15 @@ namespace matx
}
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}

Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/reshape.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,15 @@ namespace matx
return sizes_[dim];
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}

Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/reverse.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ namespace matx
return op_.Size(dim);
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}

Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/shift.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ namespace matx
return detail::matx_max(size1,size2);
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}
/**
Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,15 @@ namespace matx
return sizes_[dim];
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}
};
}

Expand Down
10 changes: 9 additions & 1 deletion include/matx/operators/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,15 @@ namespace matx
}
}

template<typename R> __MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}

private:
cuda::std::tuple<Ts...> ops_;
Expand Down
9 changes: 8 additions & 1 deletion include/matx/operators/transpose.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ namespace detail {
}

template<typename R>
__MATX_INLINE__ auto operator=(const R &rhs) { return set(*this, rhs); }
__MATX_INLINE__ auto operator=(const R &rhs) {
if constexpr (is_matx_transform_op<R>()) {
return mtie(*this, rhs);
}
else {
return set(*this, rhs);
}
}

};
}
Expand Down

0 comments on commit a9a5d8e

Please sign in to comment.