more thorough alias checking

This commit is contained in:
conrad
2022-06-07 10:52:58 +10:00
parent b121c4e1e1
commit 8d8fbdd54c
+12 -12
View File
@@ -303,7 +303,7 @@ struct quasi_unwrap< Mat<eT> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)) || (void_ptr(M.mem) == void_ptr(X.mem)); }
};
@@ -326,7 +326,7 @@ struct quasi_unwrap< Row<eT> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)) || (void_ptr(M.mem) == void_ptr(X.mem)); }
};
@@ -348,7 +348,7 @@ struct quasi_unwrap< Col<eT> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&M) == void_ptr(&X)) || (void_ptr(M.mem) == void_ptr(X.mem)); }
};
@@ -405,7 +405,7 @@ struct quasi_unwrap< subview_col<eT> >
inline
quasi_unwrap(const subview_col<eT>& A)
: orig( A.m )
, M ( const_cast<eT*>( A.colmem ), A.n_rows, false, false )
, M ( const_cast<eT*>( A.colmem ), A.n_rows, false, false )
{
arma_extra_debug_sigprint();
}
@@ -418,7 +418,7 @@ struct quasi_unwrap< subview_col<eT> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)) || (void_ptr(M.mem) == void_ptr(X.mem)); }
};
@@ -442,7 +442,7 @@ struct quasi_unwrap< subview_cols<eT> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)) || (void_ptr(M.mem) == void_ptr(X.mem)); }
};
@@ -536,7 +536,7 @@ struct quasi_unwrap< Op<Col<eT>, op_strans> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)); }
};
@@ -560,7 +560,7 @@ struct quasi_unwrap< Op<Row<eT>, op_strans> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)); }
};
@@ -584,7 +584,7 @@ struct quasi_unwrap< Op<subview_col<eT>, op_strans> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&X) == void_ptr(&orig)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)); }
};
@@ -616,7 +616,7 @@ struct quasi_unwrap_Col_htrans< Op<Col<eT>, op_htrans> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)); }
};
@@ -680,7 +680,7 @@ struct quasi_unwrap_Row_htrans< Op<Row<eT>, op_htrans> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)); }
};
@@ -744,7 +744,7 @@ struct quasi_unwrap_subview_col_htrans< Op<subview_col<eT>, op_htrans> >
static constexpr bool has_orig_mem = true;
template<typename eT2>
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)); }
arma_inline bool is_alias(const Mat<eT2>& X) const { return (void_ptr(&orig) == void_ptr(&X)) || (void_ptr(orig.mem) == void_ptr(X.mem)); }
};