diff --git a/include/armadillo_bits/Proxy.hpp b/include/armadillo_bits/Proxy.hpp index cc1b7512..bdc8108e 100644 --- a/include/armadillo_bits/Proxy.hpp +++ b/include/armadillo_bits/Proxy.hpp @@ -188,7 +188,7 @@ struct Proxy< Mat > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&Q) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&Q) == void_ptr(&X)) || (void_ptr(Q.mem) == void_ptr(X.mem))): false; } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -235,7 +235,7 @@ struct Proxy< Col > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&Q) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&Q) == void_ptr(&X)) || (void_ptr(Q.mem) == void_ptr(X.mem))) : false; } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -282,7 +282,7 @@ struct Proxy< Row > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&Q) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&Q) == void_ptr(&X)) || (void_ptr(Q.mem) == void_ptr(X.mem))): false; } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -966,7 +966,7 @@ struct Proxy< subview > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&(Q.m)) == void_ptr(&X)) || (void_ptr(Q.m.mem) == void_ptr(X.mem))) : false; } template arma_inline bool has_overlap(const subview& X) const { return Q.check_overlap(X); } @@ -1013,7 +1013,7 @@ struct Proxy< subview_col > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&(Q.m)) == void_ptr(&X)) || (void_ptr(Q.m.mem) == void_ptr(X.mem))) : false; } template arma_inline bool has_overlap(const subview& X) const { return Q.check_overlap(X); } @@ -1062,7 +1062,7 @@ struct Proxy< subview_cols > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&(sv.m)) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&(sv.m)) == void_ptr(&X)) || (void_ptr(sv.m.mem) == void_ptr(X.mem))): false; } template arma_inline bool has_overlap(const subview& X) const { return sv.check_overlap(X); } @@ -1109,7 +1109,7 @@ struct Proxy< subview_row > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&(Q.m)) == void_ptr(&X)) || (void_ptr(Q.m.mem) == void_ptr(X.mem))): false; } template arma_inline bool has_overlap(const subview& X) const { return Q.check_overlap(X); } @@ -1257,7 +1257,7 @@ struct Proxy< diagview > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? (void_ptr(&(Q.m)) == void_ptr(&X)) : false; } + arma_inline bool is_alias(const Mat& X) const { return (is_same_type::value) ? ((void_ptr(&(Q.m)) == void_ptr(&X)) || (void_ptr(Q.m.mem) == void_ptr(X.mem))) : false; } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -1313,7 +1313,7 @@ struct Proxy_diagvec_mat< Op > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return (void_ptr(&R) == void_ptr(&X)); } + arma_inline bool is_alias(const Mat& X) const { return ((void_ptr(&R) == void_ptr(&X)) || (void_ptr(R.m.mem) == void_ptr(X.mem))); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -1490,7 +1490,7 @@ struct Proxy_xtrans_default< Op > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return void_ptr(&(U.M)) == void_ptr(&X); } + arma_inline bool is_alias(const Mat& X) const { return ((void_ptr(&(U.M)) == void_ptr(&X)) || (void_ptr(U.M.mem) == void_ptr(X.mem))); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -1531,7 +1531,7 @@ struct Proxy_xtrans_default< Op > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return void_ptr(&(U.M)) == void_ptr(&X); } + arma_inline bool is_alias(const Mat& X) const { return ((void_ptr(&(U.M)) == void_ptr(&X)) || (void_ptr(U.M.mem) == void_ptr(X.mem))); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); } @@ -2394,7 +2394,7 @@ struct Proxy_vectorise_col_mat< Op > arma_inline aligned_ea_type get_aligned_ea() const { return Q; } template - arma_inline bool is_alias(const Mat& X) const { return ( void_ptr(&X) == void_ptr(&(U.M)) ); } + arma_inline bool is_alias(const Mat& X) const { return ((void_ptr(&(U.M)) == void_ptr(&X)) || (void_ptr(U.M.mem) == void_ptr(X.mem))); } template arma_inline bool has_overlap(const subview& X) const { return is_alias(X.m); }