/** * Create an ndarray * with the given shape * @param shape */ public BaseNDArray(int[] shape) { this(shape, 0, Nd4j.order()); }
/** * Creates a new <i>n</i> times <i>m</i> <tt>DoubleMatrix</tt>. * * @param newRows the number of rows (<i>n</i>) of the new matrix. * @param newColumns the number of columns (<i>m</i>) of the new matrix. */ public BaseNDArray(int newRows, int newColumns) { this(newRows, newColumns, Nd4j.order()); }
/** * Create an ndarray from the specified slices. * This will go through and merge all of the * data from each slice in to one ndarray * which will then take the specified shape * * @param slices the slices to merge * @param shape the shape of the ndarray */ public BaseNDArray(List<INDArray> slices, int[] shape) { this(slices, shape, Nd4j.order()); }
/** * Create with the specified ndarray as the real component * and the given stride * * @param m the ndarray to use as the stride * @param stride the stride of the ndarray */ public BaseComplexNDArray(INDArray m, int[] stride) { this(m, stride, Nd4j.order()); }
/** * Create an ndarray from the specified slices * and the given shape * * @param slices the slices of the ndarray * @param shape the final shape of the ndarray * @param stride the stride of the ndarray */ public BaseComplexNDArray(List<IComplexNDArray> slices, int[] shape, int[] stride) { this(slices, shape, stride, Nd4j.order()); }
/** * * @param buffer * @param shape * @param strides */ public BaseNDArray(DataBuffer buffer, int[] shape, int[] strides) { this(buffer, shape, strides, 0, Nd4j.order()); }
/** * Initialize the ndarray * with the given data * @param data */ public BaseNDArray(float[][] data) { this(data, Nd4j.order()); }
/** * Creates an ndarray with the specified shape * * @param shape the shape of the ndarray * @return the instance */ public static INDArray create(int... shape) { return create(shape, order()); }
/** * * @param data * @param shape * @param offset * @return */ public static IComplexNDArray createComplex(double[] data, int[] shape, long offset) { return createComplex(data, shape, offset, Nd4j.order()); }
/** * Creates an ndarray with the specified shape * * @param shape the shape of the ndarray * @param stride the stride for the ndarray * @return the instance */ public static INDArray create(int[] shape, int[] stride) { return create(shape, stride, order()); }
/** * Creates a complex ndarray with the specified shape * * @param shape the shape of the ndarray * @return the instance */ public static IComplexNDArray createComplex(int... shape) { return createComplex(shape, order()); }
/** * Cretes uninitialized INDArray detached from any (if any) workspace * * @param shape * @return */ public static INDArray createUninitializedDetached(int[] shape) { return createUninitializedDetached(shape, Nd4j.order()); }
/** * Get the strides based on the shape * and NDArrays.order() * * @param shape the shape of the ndarray * @return the strides for the given shape * and order specified by NDArrays.order() */ public static int[] getComplexStrides(int[] shape) { return getComplexStrides(shape, Nd4j.order()); }
/** * This method creates shapeInformation buffer, based on shape being passed in * * @param shape * @return */ @Override public Pair<DataBuffer, long[]> createShapeInformation(long[] shape) { char order = Nd4j.order(); return createShapeInformation(shape, order); }
public static INDArray createUninitialized(long length) { if (length < 1) throw new IllegalStateException("INDArray length should be positive value"); long[] shape = new long[] {1, length}; INDArray ret = INSTANCE.createUninitialized(shape, order()); logCreationIfNecessary(ret); return ret; }
@Override public INDArray valueArrayOf(long[] shape, double value) { INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order()); ret.assign(value); return ret; }
public static INDArray rand(long[] shape) { INDArray ret = createUninitialized(shape, order()); //INSTANCE.rand(shape, Nd4j.getRandom()); logCreationIfNecessary(ret); return rand(ret); }
/** * Create a random ndarray with the given shape using the given RandomGenerator * * @param shape the shape of the ndarray * @param rng the random generator to use * @return the random ndarray with the specified shape */ public static INDArray rand(int[] shape, org.nd4j.linalg.api.rng.Random rng) { INDArray ret = createUninitialized(shape, Nd4j.order()); //INSTANCE.rand(shape, rng); logCreationIfNecessary(ret); return rand(ret, rng); }
/** * Random normal using the specified seed * * @param shape the shape of the ndarray * @return */ public static INDArray randn(int[] shape, long seed) { INDArray ret = Nd4j.createUninitialized(shape, order()); logCreationIfNecessary(ret); return randn(ret, seed); }