public INDArray slice(int majorSlice) {
// if ((majorSlice<0)||(majorSlice>=shape[0])) throw new IllegalArgumentException(ErrorMessages.invalidSlice(this,majorSlice));
if (dimensions==0) {
throw new IllegalArgumentException("Can't slice a 0-d NDArray");
} else if (dimensions==1) {
return new ArrayIndexScalar(data,offset+majorSlice*getStride(0));
} else if (dimensions==2) {
int st=stride[1];
return Vectorz.wrapStrided(data, offset+majorSlice*getStride(0), getShape(1), st);
} else {
return Arrayz.wrapStrided(data,