/** * Create a scalar ndarray with the specified offset * * @param value the value to initialize the scalar with * @return the created ndarray */ @Override public IComplexNDArray complexScalar(Number value) { return complexScalar(value, 0); }
/** * Creates a row vector with the data * * @param data the columns of the ndarray * @return the created ndarray */ @Override public INDArray create(double[] data) { return create(data, new int[] {1, data.length}); }
@Override public Blas blas() { if (blas == null) createBlas(); return blas; }
/** * Create a scalar nd array with the specified value and offset * * @param value the value of the scalar * @return the scalar nd array */ @Override public INDArray scalar(double value) { if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) return create(new double[] {value}, new int[] {1, 1}, new int[] {1, 1}, 0); else return scalar((float) value); }
/** * Creates an ndarray with the specified data * * @param data the number of columns in the row vector * @return ndarray */ @Override public IComplexNDArray createComplex(double[] data) { assert data.length % 2 == 0 : "Length of data must be even. A complex ndarray is made up of pairs of real and imaginary components"; return createComplex(data, new int[] {1, data.length / 2}); }
/** * Create a scalar ndarray with the specified offset * * @param value the value to initialize the scalar with * @param offset the offset of the ndarray * @return the created ndarray */ @Override public IComplexNDArray complexScalar(Number value, long offset) { if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) return scalar(createDouble(value.doubleValue(), 0), offset); if (Nd4j.dataType() == DataBuffer.Type.FLOAT || Nd4j.dataType() == DataBuffer.Type.INT || Nd4j.dataType() == DataBuffer.Type.HALF) return scalar(createFloat(value.floatValue(), 0), offset); throw new IllegalStateException("Illegal data opType " + Nd4j.dataType()); }
/** * Creates an shape ndarray with the specified value * * @param shape the shape of the ndarray * @param value the value to assign * @return a complex ndarray of the specified size * and value */ @Override public IComplexNDArray complexValueOf(int[] shape, IComplexNumber value) { IComplexNDArray ones = complexOnes(shape); ones.assign(Nd4j.scalar(value)); return ones; }
@Override public Level1 level1() { if (level1 == null) createLevel1(); return level1; }
@Override public Lapack lapack() { if (lapack == null) createLapack(); return lapack; }
@Override public Level2 level2() { if (level2 == null) createLevel2(); return level2; }
/** * Create an ndarray of ones * * @param shape the shape of the ndarray * @return an ndarray with ones filled in */ @Override public IComplexNDArray complexZeros(int[] shape) { IComplexNDArray ret = createComplex(shape); return ret; }
/** * Create a scalar ndarray with the specified offset * * @param value the value to initialize the scalar with * @param offset the offset of the ndarray * @return the created ndarray */ @Override public IComplexNDArray complexScalar(Number value, long offset) { if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) return scalar(createDouble(value.doubleValue(), 0), offset); if (Nd4j.dataType() == DataBuffer.Type.FLOAT || Nd4j.dataType() == DataBuffer.Type.INT || Nd4j.dataType() == DataBuffer.Type.HALF) return scalar(createFloat(value.floatValue(), 0), offset); throw new IllegalStateException("Illegal data type " + Nd4j.dataType()); }
/** * Creates an 1 x num ndarray with the specified value * * @param num the number of columns * @param value the value to assign * @return a complex ndarray of the specified size * and value */ @Override public IComplexNDArray complexValueOf(int num, double value) { IComplexNDArray ones = complexOnes(num); ones.assign(Nd4j.createDouble(value, 0.0)); return ones; }
/** * Create a scalar nd array with the specified value and offset * * @param value the value of the scalar * = * @return the scalar nd array */ @Override public INDArray scalar(float value) { if (Nd4j.dataType() == DataBuffer.Type.FLOAT || Nd4j.dataType() == DataBuffer.Type.HALF) return create(new float[] {value}, new int[] {1, 1}, new int[] {1, 1}, 0); else if (Nd4j.dataType() == DataBuffer.Type.DOUBLE) return scalar((double) value); else return scalar((int) value); }
@Override public Level1 level1() { if (level1 == null) createLevel1(); return level1; }
@Override public Lapack lapack() { if (lapack == null) createLapack(); return lapack; }
@Override public Level2 level2() { if (level2 == null) createLevel2(); return level2; }
/** * Creates a complex ndarray with the specified shape * * @param shape the shape of the ndarray * @param stride the stride for the ndarray * @return the instance */ @Override public IComplexNDArray createComplex(int[] shape, int[] stride) { return createComplex(shape, stride, 0); }
/** * Creates a row vector with the data * * @param data the columns of the ndarray * @return the created ndarray */ @Override public INDArray create(float[] data) { return create(data, new int[] {1, data.length}); }
/** * Creates an shape ndarray with the specified value * * @param shape the shape of the ndarray * @param value the value to assign * @return a complex ndarray of the specified size * and value */ @Override public IComplexNDArray complexValueOf(int[] shape, double value) { IComplexNDArray ones = complexOnes(shape); ones.assign(Nd4j.scalar(value)); return ones; }