List of usage examples for org.apache.commons.math4.complex Complex Complex
public Complex(double real, double imaginary)
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Adds a scalar {@code Complex} to every element of a {@code Complex[]}. Returns deep copy. */*from w w w . j a va 2 s. c o m*/ * @param f {@code Complex[]} array. * @param g {@code Complex}. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] addC(Complex[] f, Complex g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).add(g); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Element-wise add {@code Complex[]} to {@code Complex[]}. Returns deep copy. */*from w ww . j av a 2 s .com*/ * @param f {@code Complex[]} array. * @param g {@code Complex[]} array. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] addC(Complex[] f, Complex[] g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).add(g[i]); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Divides a scalar {@code Complex} by every element of a {@code Complex[]}. Returns deep copy. *//from w w w . j a va2 s. co m * @param f {@code Complex[]} array. * @param g {@code Complex}. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] divideC(Complex[] f, Complex g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).divide(g); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Element-wise divide {@code Complex[]} by {@code Complex[]}. Returns deep copy. *// w w w . j a va 2 s .c o m * @param f {@code Complex[]} array. * @param g {@code Complex[]} array. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] divideC(Complex[] f, Complex[] g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).divide(g[i]); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Multiplies a scalar {@code Complex} by every element of a {@code Complex[]}. Returns deep copy. *//w w w . j a va2 s. c om * @param f {@code Complex[]} array. * @param g {@code Complex}. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] multiplyC(Complex[] f, Complex g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).multiply(g); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Element-wise multiply {@code Complex[]} by {@code Complex[]}. Returns deep copy. */* ww w.j ava 2 s . c om*/ * @param f {@code Complex[]} array. * @param g {@code Complex[]} array. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] multiplyC(Complex[] f, Complex[] g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).multiply(g[i]); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * subtracts a scalar {@code Complex} to every element of a {@code Complex[]}. Returns deep copy. *//from ww w . java 2 s. c o m * @param f {@code Complex[]} array. * @param g {@code Complex}. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] subtractC(Complex[] f, Complex g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).subtract(g); } return h; }
From source file:com.ericbarnhill.arrayMath.ArrayMath.java
/** * Element-wise subtract {@code Complex[]} to {@code Complex[]}. Returns deep copy. */*from w ww .ja v a 2s. c o m*/ * @param f {@code Complex[]} array. * @param g {@code Complex[]} array. * @return {@code Complex[]} array. * * @since 0.1 */ public static Complex[] subtractC(Complex[] f, Complex[] g) { final int fi = f.length; Complex[] h = new Complex[fi]; for (int i = 0; i < fi; i++) { h[i] = new Complex(f[i].getReal(), f[i].getImaginary()).subtract(g[i]); } return h; }