ConstCubeSlice<T>::ConstCubeSlice(const ConstCubeSlice<T>& bigger, long i, long dOffset) { assert(dOffset >= 0 && dOffset <= bigger.getNumDims()); // allow zero-dimensional slice assert(i >= 0 && i < bigger.getProd(0, dOffset)); data = bigger.data; sig = bigger.sig; dimOffset = dOffset + bigger.dimOffset; sizeOffset = bigger.sizeOffset + i*bigger.getProd(dOffset); }
void getHyperColumn(Vec<T>& v, const ConstCubeSlice<T>& s, long pos) { long m = s.getProd(1); long n = s.getDim(0); assert(pos >= 0 && pos < m); v.SetLength(n); for (long i = 0; i < n; i++) v[i] = s[pos + i*m]; }