private void testStridedArray(INDArray mm) {
if (!(mm instanceof IStridedArray)) {
assertNull(mm.asDoubleArray());
return;
}
IStridedArray m=(IStridedArray)mm;
int dims=m.dimensionality();
int[] shape=m.getShape();
int[] strides=m.getStrides();
if (m.elementCount()==0) return;
if (mm.isMutable()) {
double[] data=m.getArray();
for (int i=0; i<dims; i++) {
assertEquals(m.getStride(i),strides[i]);
}
if (m.isPackedArray()) {
assertNotNull(m.asDoubleArray());
assertTrue(m.asDoubleArray()==m.getArray());
} else {
assertNull(m.asDoubleArray());
}
int[] ix = IntArrays.rand(shape);
int off=m.getArrayOffset()+IntArrays.dotProduct(strides,ix);
assertEquals(data[off],m.get(ix),0.0);
}
}