inline void for_cons(const blitz::Array<T,n> & M, bool check_order){ need_copy = (!(M.isStorageContiguous())); if (check_order) for (int i=0; i<n;i++) need_copy = (need_copy || (M.ordering(i)!=i)); #ifdef DEBUG_REF_WARNING if (need_copy) std::cout<<"WARNING : REF : COPY NEEDED. Performance will be degraded"<<std::endl; #endif Mref = (blitz::Array<T,n> *)&M; // The copy has the same shape but is ordered like a fortran array if (need_copy) {Mcopy.resize(M.shape());Mcopy=M;} }
bool is_C_ordering(const blitz::Array<T,n> & A) {bool r=true; for (int i=0; i<n;i++) r = (r && (A.ordering(i)==n-i-1));return(r);}