@Override public INDArray putColumn(int column, INDArray toPut) { if (isColumnVector() && toPut.isVector()) { return assign(toPut); } return put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.point(column)}, toPut); }
/** * Returns the indices of non-zero element of the vector * * @return indices in Databuffer * */ @Override public DataBuffer getVectorCoordinates() { int idx; if (isRowVector()) { idx = 1; } else if (isColumnVector()) { idx = 0; } else { throw new UnsupportedOperationException(); } // FIXME: int cast int[] temp = new int[(int) length()]; for (int i = 0; i < length(); i++) { temp[i] = getUnderlyingIndicesOf(i).getInt(idx); } return Nd4j.createBuffer(temp); }
&& indexes[0] instanceof PointIndex && indexes[0].offset() == 0 && indexes[1] instanceof NDArrayIndexAll || isColumnVector() && indexes[1] instanceof PointIndex && indexes[0].offset() == 0 && indexes[0] instanceof NDArrayIndexAll))) return this;
@Override public INDArray putScalar(long i, double value) { if (i < 0) i += rank(); if (isScalar()) { if (Nd4j.getExecutioner().getProfilingMode() != OpExecutioner.ProfilingMode.DISABLED && Nd4j.getExecutioner().getProfilingMode() != OpExecutioner.ProfilingMode.SCOPE_PANIC) OpProfiler.getInstance().processScalarCall(); addOrUpdate(new long[] {0, 0}, value); return this; } if (isRowVector()) { addOrUpdate(new long[] {0, i}, value); return this; } else if (isColumnVector()) { addOrUpdate(new long[] {i, 0}, value); return this; } long[] indexes = ordering() == 'c' ? Shape.ind2subC(this, i) : Shape.ind2sub(this, i); return putScalar(indexes, value); }