/** * Create a complex array from the given numbers * @param iComplexNumbers the numbers to use * @return the complex numbers */ public static IComplexNDArray createComplex(IComplexNumber[] iComplexNumbers) { if (iComplexNumbers == null || iComplexNumbers.length < 1) throw new ND4JIllegalStateException("Number of complex numbers can't be < 1 for new INDArray"); return createComplex(iComplexNumbers, new int[] {1, iComplexNumbers.length}); }
@Override public IComplexNDArray mean(int... dimension) { return Nd4j.createComplex(super.mean(dimension)); }
@Override protected IComplexNDArray create(DataBuffer buffer) { return Nd4j.createComplex(buffer, new int[] {1, (int) buffer.length()}); }
@Override public IComplexNDArray divi(IComplexNumber n, IComplexNDArray result) { return Nd4j.createComplex(this).divi(n, result); }
/** * Creates an ndarray with the specified data * * @param data the number of columns in the row vector * @return ndarray */ public static IComplexNDArray createComplex(float[] data) { return createComplex(data, Nd4j.order()); }
protected INDArray create(int[] shape, char ordering) { if (this instanceof IComplexNDArray) return Nd4j.createComplex(shape, ordering); else return Nd4j.create(shape, ordering); }
/** * * @param data * @param shape * @param offset * @return */ public static IComplexNDArray createComplex(double[] data, int[] shape, long offset) { return createComplex(data, shape, offset, Nd4j.order()); }
private INDArray create(int[] shape, int[] stride) { if (this instanceof IComplexNDArray) return Nd4j.createComplex(shape, stride); else return Nd4j.create(shape, stride); }
/** * Creates an ndarray * * @param columns the number of columns in the row vector * @return ndarray */ public static IComplexNDArray createComplex(int columns) { return createComplex(columns, order()); }
/** * Creates a complex ndarray with the specified shape * * @param rows the rows of the ndarray * @param columns the columns of the ndarray * @param stride the stride for the ndarray * @return the instance */ public static IComplexNDArray createComplex(int rows, int columns, int[] stride) { return createComplex(rows, columns, stride, order()); }
/** * 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 */ public static IComplexNDArray createComplex(int[] shape, int[] stride) { return createComplex(shape, stride, order()); }
/** * Creates a complex ndarray with the specified shape * * @param rows the rows of the ndarray * @param columns the columns of the ndarray * @return the instance */ public static IComplexNDArray createComplex(int rows, int columns) { return createComplex(rows, columns, order()); }
/** * Assigns the given matrix (put) to the specified slice * * @param slice the slice to assign * @param put the slice to put * @return this for chainability */ @Override public IComplexNDArray putSlice(int slice, INDArray put) { return putSlice(slice, Nd4j.createComplex(put)); }
protected INDArray create(DataBuffer data, int[] shape, long offset) { if (this instanceof IComplexNDArray) return Nd4j.createComplex(data, shape, offset); else return Nd4j.create(data, shape, offset); }
protected INDArray create(DataBuffer data, int[] newShape, int[] newStrides, long offset, char ordering) { if (this instanceof IComplexNDArray) return Nd4j.createComplex(data, newShape, newStrides, offset, ordering); else return Nd4j.create(data, newShape, newStrides, offset, ordering); }
protected INDArray create(DataBuffer data, int[] newShape, int[] newStrides, long offset) { if (this instanceof IComplexNDArray) return Nd4j.createComplex(data, newShape, newStrides, offset); else return Nd4j.create(data, newShape, newStrides, offset); }
@Override public IComplexNDArray linearViewColumnOrder() { if (length() >= Integer.MAX_VALUE) throw new IllegalArgumentException("Length can not be >= Integer.MAX_VALUE"); return Nd4j.createComplex(data, new int[] {(int) length(), 1}, offset()); }
protected INDArray create(int[] shape) { if (this instanceof IComplexNDArray) return Nd4j.createComplex(shape, getStrides(shape, Nd4j.order()), 0); else return Nd4j.create(shape, getStrides(shape, Nd4j.order()), 0); }
@Override public IComplexNDArray hermitian() { IComplexNDArray result = Nd4j.createComplex(shape()); IComplexDouble c = Nd4j.createDouble(0, 0); for (int i = 0; i < slices(); i++) for (int j = 0; j < columns(); j++) result.putScalar(j, i, getComplex(i, j, c).conji()); return result; }
/** * Computes the eigenvalues of a general matrix. */ public static IComplexNDArray eigenvalues(INDArray A) { assert A.rows() == A.columns(); INDArray WR = Nd4j.create(A.rows(), A.rows()); INDArray WI = WR.dup(); Nd4j.getBlasWrapper().geev('N', 'N', A.dup(), WR, WI, dummy, dummy); return Nd4j.createComplex(WR, WI); }