Java Code Examples for org.nd4j.linalg.factory.Nd4j#createComplexNumber()
The following examples show how to use
org.nd4j.linalg.factory.Nd4j#createComplexNumber() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseComplexNDArray.java From nd4j with Apache License 2.0 | 6 votes |
/** * in place (element wise) division of two matrices * * @param other the second ndarray to divide * @param result the result ndarray * @return the result of the divide */ @Override public IComplexNDArray divi(INDArray other, INDArray result) { IComplexNDArray cOther = (IComplexNDArray) other; IComplexNDArray cResult = (IComplexNDArray) result; IComplexNDArray linear = linearView(); IComplexNDArray cOtherLinear = cOther.linearView(); IComplexNDArray cResultLinear = cResult.linearView(); if (other.isScalar()) return divi(cOther.getComplex(0), result); IComplexNumber c = Nd4j.createComplexNumber(0, 0); IComplexNumber d = Nd4j.createComplexNumber(0, 0); for (int i = 0; i < length(); i++) cResultLinear.putScalar(i, linear.getComplex(i, c).divi(cOtherLinear.getComplex(i, d))); return cResult; }
Example 2
Source File: BaseComplexNDArray.java From nd4j with Apache License 2.0 | 6 votes |
/** * in place (element wise) multiplication of two matrices * * @param other the second ndarray to multiply * @param result the result ndarray * @return the result of the multiplication */ @Override public IComplexNDArray muli(INDArray other, INDArray result) { IComplexNDArray cOther = (IComplexNDArray) other; IComplexNDArray cResult = (IComplexNDArray) result; IComplexNDArray linear = linearView(); IComplexNDArray cOtherLinear = cOther.linearView(); IComplexNDArray cResultLinear = cResult.linearView(); if (other.isScalar()) return muli(cOther.getComplex(0), result); IComplexNumber c = Nd4j.createComplexNumber(0, 0); IComplexNumber d = Nd4j.createComplexNumber(0, 0); for (int i = 0; i < length(); i++) cResultLinear.putScalar(i, linear.getComplex(i, c).muli(cOtherLinear.getComplex(i, d))); return cResult; }
Example 3
Source File: BaseComplexNDArray.java From nd4j with Apache License 2.0 | 5 votes |
@Override public IComplexNDArray condi(Condition condition) { IComplexNDArray linear = linearView(); for (int i = 0; i < length(); i++) { boolean met = condition.apply(linear.getComplex(i)); IComplexNumber put = Nd4j.createComplexNumber(met ? 1 : 0, 0); linear.putScalar(i, put); } return this; }
Example 4
Source File: ComplexUtil.java From nd4j with Apache License 2.0 | 5 votes |
/** * Create complex number where the * @param realComponents the real components for the complex * @return the complex numbers based on the given real components */ public static IComplexNumber[][] complexNumbersFor(float[][] realComponents) { IComplexNumber[][] ret = new IComplexNumber[realComponents.length][realComponents[0].length]; for (int i = 0; i < realComponents.length; i++) for (int j = 0; j < realComponents[i].length; j++) ret[i][j] = Nd4j.createComplexNumber(realComponents[i][j], 0); return ret; }
Example 5
Source File: ComplexUtil.java From nd4j with Apache License 2.0 | 5 votes |
/** * Create complex number where the * @param realComponents the real components for the complex * @return the complex numbers based on the given real components */ public static IComplexNumber[][] complexNumbersFor(double[][] realComponents) { IComplexNumber[][] ret = new IComplexNumber[realComponents.length][realComponents[0].length]; for (int i = 0; i < realComponents.length; i++) for (int j = 0; j < realComponents[i].length; j++) ret[i][j] = Nd4j.createComplexNumber(realComponents[i][j], 0); return ret; }
Example 6
Source File: ComplexUtil.java From nd4j with Apache License 2.0 | 5 votes |
/** * Create complex number where the * @param realComponents the real components for the complex * @return the complex numbers based on the given real components */ public static IComplexNumber[] complexNumbersFor(float[] realComponents) { IComplexNumber[] ret = new IComplexNumber[realComponents.length]; for (int i = 0; i < realComponents.length; i++) ret[i] = Nd4j.createComplexNumber(realComponents[i], 0); return ret; }
Example 7
Source File: ComplexUtil.java From nd4j with Apache License 2.0 | 5 votes |
/** * Create complex number where the * @param realComponents the real components for the complex * @return the complex numbers based on the given real components */ public static IComplexNumber[] complexNumbersFor(double[] realComponents) { IComplexNumber[] ret = new IComplexNumber[realComponents.length]; for (int i = 0; i < realComponents.length; i++) ret[i] = Nd4j.createComplexNumber(realComponents[i], 0); return ret; }
Example 8
Source File: BaseIndexAccumulation.java From nd4j with Apache License 2.0 | 4 votes |
@Override public IComplexNumber zeroComplex() { return Nd4j.createComplexNumber(0.0, 0.0); }
Example 9
Source File: IAMin.java From nd4j with Apache License 2.0 | 4 votes |
@Override public IComplexNumber zeroComplex() { return Nd4j.createComplexNumber(0, 0); }
Example 10
Source File: IAMax.java From nd4j with Apache License 2.0 | 4 votes |
@Override public IComplexNumber zeroComplex() { return Nd4j.createComplexNumber(0, 0); }
Example 11
Source File: FirstIndex.java From nd4j with Apache License 2.0 | 4 votes |
@Override public IComplexNumber zeroComplex() { return Nd4j.createComplexNumber(-Double.MAX_VALUE, 0); }
Example 12
Source File: IMax.java From nd4j with Apache License 2.0 | 4 votes |
@Override public IComplexNumber zeroComplex() { return Nd4j.createComplexNumber(-Double.MAX_VALUE, 0); }
Example 13
Source File: IMin.java From nd4j with Apache License 2.0 | 4 votes |
@Override public IComplexNumber zeroComplex() { return Nd4j.createComplexNumber(Double.MAX_VALUE, 0); }
Example 14
Source File: BaseCondition.java From nd4j with Apache License 2.0 | 4 votes |
public BaseCondition(Number value) { this.value = value; this.complexNumber = Nd4j.createComplexNumber(value, 0); }