@Override
public double[] toDoubleArray() {
double[] result=Array.createStorage(this.getShape());
int skip=(int)slice(0).elementCount();
for (int i=0; i<slices.length; i++) {
INDArray s=slices[i];
if (s.isSparse()) {
s.addToArray(result,skip*i);
} else {
s.getElements(result,skip*i);
}
}
return result;
}