add .has_overlap()

This commit is contained in:
conrad
2021-01-14 13:27:49 +10:00
parent b98f39c2f8
commit 6a054092b2
+72 -36
View File
@@ -63,9 +63,9 @@ class ProxyCube< Cube<eT> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -73,6 +73,9 @@ class ProxyCube< Cube<eT> >
template<typename eT2>
arma_inline bool is_alias(const Cube<eT2>& X) const { return (void_ptr(&Q) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return is_alias(X.m); }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -107,9 +110,9 @@ class ProxyCube< GenCube<eT, gen_type> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_rows*Q.n_cols*Q.n_slices; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q[i]; }
arma_inline ea_type get_ea() const { return Q; }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -117,6 +120,9 @@ class ProxyCube< GenCube<eT, gen_type> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return GenCube<eT, gen_type>::is_simple; }
};
@@ -151,9 +157,9 @@ class ProxyCube< GenCube<eT, gen_randu> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -161,6 +167,9 @@ class ProxyCube< GenCube<eT, gen_randu> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -195,9 +204,9 @@ class ProxyCube< GenCube<eT, gen_randn> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -205,6 +214,9 @@ class ProxyCube< GenCube<eT, gen_randn> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -239,9 +251,9 @@ class ProxyCube< OpCube<T1, op_type> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -249,6 +261,9 @@ class ProxyCube< OpCube<T1, op_type> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -283,9 +298,9 @@ class ProxyCube< GlueCube<T1, T2, glue_type> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -293,6 +308,9 @@ class ProxyCube< GlueCube<T1, T2, glue_type> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -327,9 +345,9 @@ class ProxyCube< subview_cube<eT> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q; }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -337,6 +355,9 @@ class ProxyCube< subview_cube<eT> >
template<typename eT2>
arma_inline bool is_alias(const Cube<eT2>& X) const { return (void_ptr(&(Q.m)) == void_ptr(&X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return Q.check_overlap(X); }
constexpr bool is_aligned() const { return false; }
};
@@ -371,9 +392,9 @@ class ProxyCube< subview_cube_slices<eT,T1> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -381,6 +402,9 @@ class ProxyCube< subview_cube_slices<eT,T1> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -415,9 +439,9 @@ class ProxyCube< eOpCube<T1, eop_type > >
arma_inline uword get_n_slices() const { return Q.get_n_slices(); }
arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q; }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -425,6 +449,9 @@ class ProxyCube< eOpCube<T1, eop_type > >
template<typename eT2>
arma_inline bool is_alias(const Cube<eT2>& X) const { return Q.P.is_alias(X); }
template<typename eT2>
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return Q.P.has_overlap(X); }
arma_inline bool is_aligned() const { return Q.P.is_aligned(); }
};
@@ -459,9 +486,9 @@ class ProxyCube< eGlueCube<T1, T2, eglue_type > >
arma_inline uword get_n_slices() const { return Q.get_n_slices(); }
arma_inline uword get_n_elem() const { return Q.get_n_elem(); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q; }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -469,6 +496,9 @@ class ProxyCube< eGlueCube<T1, T2, eglue_type > >
template<typename eT2>
arma_inline bool is_alias(const Cube<eT2>& X) const { return (Q.P1.is_alias(X) || Q.P2.is_alias(X)); }
template<typename eT2>
arma_inline bool has_overlap(const subview_cube<eT2>& X) const { return (Q.P1.has_overlap(X) || Q.P2.has_overlap(X)); }
arma_inline bool is_aligned() const { return Q.P1.is_aligned() && Q.P2.is_aligned(); }
};
@@ -503,9 +533,9 @@ class ProxyCube< mtOpCube<out_eT, T1, op_type> >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -513,6 +543,9 @@ class ProxyCube< mtOpCube<out_eT, T1, op_type> >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};
@@ -547,9 +580,9 @@ class ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
arma_inline uword get_n_slices() const { return Q.n_slices; }
arma_inline uword get_n_elem() const { return Q.n_elem; }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword row, const uword col, const uword slice) const { return Q.at(row, col, slice); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline elem_type operator[] (const uword i) const { return Q[i]; }
arma_inline elem_type at (const uword r, const uword c, const uword s) const { return Q.at(r, c, s); }
arma_inline elem_type at_alt (const uword i) const { return Q.at_alt(i); }
arma_inline ea_type get_ea() const { return Q.memptr(); }
arma_inline aligned_ea_type get_aligned_ea() const { return Q; }
@@ -557,6 +590,9 @@ class ProxyCube< mtGlueCube<out_eT, T1, T2, glue_type > >
template<typename eT2>
constexpr bool is_alias(const Cube<eT2>&) const { return false; }
template<typename eT2>
constexpr bool has_overlap(const subview_cube<eT2>&) const { return false; }
arma_inline bool is_aligned() const { return memory::is_aligned(Q.memptr()); }
};