/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray diviRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).divi(rowVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray muliRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).muli(rowVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param columnVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray subiColumnVector(INDArray columnVector) { for (int i = 0; i < columns(); i++) { getColumn(i).subi(columnVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param columnVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray addiColumnVector(INDArray columnVector) { for (int i = 0; i < columns(); i++) { getColumn(i).addi(columnVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray addiRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).addi(rowVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param columnVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray diviColumnVector(INDArray columnVector) { for (int i = 0; i < columns(); i++) { getColumn(i).divi(columnVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param columnVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray muliColumnVector(INDArray columnVector) { for (int i = 0; i < columns(); i++) { getColumn(i).muli(columnVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray subiRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).subi(rowVector.getScalar(i)); } return this; }
@Override public void roundToTheNearest(int roundTo) { for (int i = 0; i < getFeatures().length(); i++) { double curr = (double) getFeatures().getScalar(i).element(); getFeatures().put(i, Nd4j.scalar(MathUtils.roundDouble(curr, roundTo))); } }
/** * Squeezes input data to a max and a min * * @param min the min value to occur in the dataset * @param max the max value to ccur in the dataset */ @Override public void squishToRange(double min, double max) { for (int i = 0; i < getFeatures().length(); i++) { double curr = (double) getFeatures().getScalar(i).element(); if (curr < min) getFeatures().put(i, Nd4j.scalar(min)); else if (curr > max) getFeatures().put(i, Nd4j.scalar(max)); } }
put(0, put.getScalar(0)); return this; } else if (isVector()) {
private static int[] rasterData(INDArray matrix) { int[] ret = new int[matrix.length()]; for (int i = 0; i < ret.length; i++) ret[i] = (int) Math.round((double) matrix.getScalar(i).element()); return ret; }
private static int[] rasterData(INDArray matrix) { int[] ret = new int[matrix.length()]; for(int i = 0; i < ret.length; i++) ret[i] = (int) Math.round((double) matrix.getScalar(i).element()); return ret; }
/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray diviRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).divi(rowVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param columnVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray subiColumnVector(INDArray columnVector) { for (int i = 0; i < columns(); i++) { getColumn(i).subi(columnVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param columnVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray addiColumnVector(INDArray columnVector) { for (int i = 0; i < columns(); i++) { getColumn(i).addi(columnVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray muliRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).muli(rowVector.getScalar(i)); } return this; }
/** * In place addition of a column vector * * @param rowVector the column vector to add * @return the result of the addition */ @Override public IComplexNDArray subiRowVector(INDArray rowVector) { for (int i = 0; i < rows(); i++) { getRow(i).subi(rowVector.getScalar(i)); } return this; }
private static INDArray applyScalarTensorOperationWithPreservedShape(INDArray tensor, INDArray scalarTensor, BiFunction<INDArray, INDArray, INDArray> operation) { INDArray result = operation.apply(tensor, scalarTensor.getScalar(0)); long[] resultShape = Shape.broadcastOutputShape(tensor.shape(), scalarTensor.shape()); return result.reshape(resultShape); }
@Override public void roundToTheNearest(int roundTo) { for (int i = 0; i < getFeatures().length(); i++) { double curr = (double) getFeatures().getScalar(i).element(); getFeatures().put(i, Nd4j.scalar(MathUtils.roundDouble(curr, roundTo))); } }