inline void pairwise_div( cube<T>& a, const cube<T>& b ) { ZI_ASSERT(a.n_elem==b.n_elem); T* ap = a.memptr(); const T* bp = b.memptr(); for ( size_t i = 0; i < a.n_elem; ++i ) ap[i] /= bp[i]; }
inline bool equal(const cube<T>& c1, const cube<T>& c2) { if ( c1.n_elem != c2.n_elem ) { return false; } return std::equal(c1.memptr(), c1.memptr() + c1.n_elem, c2.memptr()); }
inline void fill_indices(cube<T>& c) { T idx = 0; T* mem = c.memptr(); for ( size_t i = 0; i < c.n_elem; ++i, ++idx ) mem[i] = idx; }
inline void flip(cube<T>& c) { std::reverse(c.memptr(), c.memptr() + c.n_elem); }