예제 #1
0
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];
}
예제 #2
0
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());
}
예제 #3
0
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;
}
예제 #4
0
inline void flip(cube<T>& c)
{
    std::reverse(c.memptr(), c.memptr() + c.n_elem);
}