Java tutorial
/* * (c) Eric Barnhill 2016 All Rights Reserved. * * This file is part of Java ArrayMath. Java ArrayMath is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * Java ArrayMath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of * the GNU General Public License along with Java ArrayMath. If not, see http://www.gnu.org/licenses/ . * * This code uses software from the Apache Software Foundation. The Apache Software License can be found at: http://www.apache.org/licenses/LICENSE-2.0.txt . */ package com.ericbarnhill.arrayMath; import org.apache.commons.math4.complex.Complex; /** * Implementation of MathArray for {@code Complex[][]} objects. * @author ericbarnhill * @see MathArray * @see MathArrayFactory * @see ArrayMath * @since 0.1 * */ public class MathArrayComplex2D extends MathArray<Complex[][]> { protected MathArrayComplex2D(Complex[][] f, int type, int nDims) { super(f, type, nDims); } @Override public Complex[][] getArray() { return f; } @Override protected MathArrayDouble2D abs() { return new MathArrayDouble2D(ArrayMath.abs(f), getType(), getnDims()); } @Override protected MathArrayComplex2D acos() { return new MathArrayComplex2D(ArrayMath.acos(f), getType(), getnDims()); } @Override protected MathArrayComplex2D acosC() { return new MathArrayComplex2D(ArrayMath.acosC(f), getType(), getnDims()); } protected MathArrayComplex2D add(double g) { return new MathArrayComplex2D(ArrayMath.add(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D add(float g) { return new MathArrayComplex2D(ArrayMath.add(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D add(Complex g) { return new MathArrayComplex2D(ArrayMath.add(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D add(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.add(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D add(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.add(f, g), getType(), getnDims()); } protected MathArrayComplex2D addC(double g) { return new MathArrayComplex2D(ArrayMath.addC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D addC(float g) { return new MathArrayComplex2D(ArrayMath.addC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D addC(Complex g) { return new MathArrayComplex2D(ArrayMath.addC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D addC(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.addC(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D addC(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.addC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D asin() { return new MathArrayComplex2D(ArrayMath.asin(f), getType(), getnDims()); } @Override protected MathArrayComplex2D asinC() { return new MathArrayComplex2D(ArrayMath.asinC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D atan() { return new MathArrayComplex2D(ArrayMath.atan(f), getType(), getnDims()); } @Override protected MathArrayComplex2D atanC() { return new MathArrayComplex2D(ArrayMath.atanC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D cos() { return new MathArrayComplex2D(ArrayMath.cos(f), getType(), getnDims()); } @Override protected MathArrayComplex2D cosC() { return new MathArrayComplex2D(ArrayMath.cosC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D cosh() { return new MathArrayComplex2D(ArrayMath.cosh(f), getType(), getnDims()); } @Override protected MathArrayComplex2D coshC() { return new MathArrayComplex2D(ArrayMath.coshC(f), getType(), getnDims()); } protected MathArrayComplex2D divide(double g) { return new MathArrayComplex2D(ArrayMath.divide(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D divide(float g) { return new MathArrayComplex2D(ArrayMath.divide(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D divide(Complex g) { return new MathArrayComplex2D(ArrayMath.divide(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D divide(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.divide(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D divide(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.divide(f, g), getType(), getnDims()); } protected MathArrayComplex2D divideC(double g) { return new MathArrayComplex2D(ArrayMath.divideC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D divideC(float g) { return new MathArrayComplex2D(ArrayMath.divideC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D divideC(Complex g) { return new MathArrayComplex2D(ArrayMath.divideC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D divideC(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.divideC(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D divideC(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.divideC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D log() { return new MathArrayComplex2D(ArrayMath.log(f), getType(), getnDims()); } @Override protected MathArrayComplex2D logC() { return new MathArrayComplex2D(ArrayMath.logC(f), getType(), getnDims()); } protected MathArrayComplex2D multiply(double g) { return new MathArrayComplex2D(ArrayMath.multiply(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D multiply(float g) { return new MathArrayComplex2D(ArrayMath.multiply(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D multiply(Complex g) { return new MathArrayComplex2D(ArrayMath.multiply(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D multiply(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.multiply(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D multiply(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.multiply(f, g), getType(), getnDims()); } protected MathArrayComplex2D multiplyC(double g) { return new MathArrayComplex2D(ArrayMath.multiplyC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D multiplyC(float g) { return new MathArrayComplex2D(ArrayMath.multiplyC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D multiplyC(Complex g) { return new MathArrayComplex2D(ArrayMath.multiplyC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D multiplyC(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.multiplyC(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D multiplyC(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.multiplyC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D reciprocal() { return new MathArrayComplex2D(ArrayMath.reciprocal(f), getType(), getnDims()); } @Override protected MathArrayComplex2D reciprocalC() { return new MathArrayComplex2D(ArrayMath.reciprocalC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D sin() { return new MathArrayComplex2D(ArrayMath.sin(f), getType(), getnDims()); } @Override protected MathArrayComplex2D sinC() { return new MathArrayComplex2D(ArrayMath.sinC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D sinh() { return new MathArrayComplex2D(ArrayMath.sinh(f), getType(), getnDims()); } @Override protected MathArrayComplex2D sinhC() { return new MathArrayComplex2D(ArrayMath.sinhC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D sqrt() { return new MathArrayComplex2D(ArrayMath.sqrt(f), getType(), getnDims()); } @Override protected MathArrayComplex2D sqrtC() { return new MathArrayComplex2D(ArrayMath.sqrtC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D square() { return new MathArrayComplex2D(ArrayMath.square(f), getType(), getnDims()); } @Override protected MathArrayComplex2D squareC() { return new MathArrayComplex2D(ArrayMath.squareC(f), getType(), getnDims()); } protected MathArrayComplex2D subtract(double g) { return new MathArrayComplex2D(ArrayMath.subtract(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D subtract(float g) { return new MathArrayComplex2D(ArrayMath.subtract(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D subtract(Complex g) { return new MathArrayComplex2D(ArrayMath.subtract(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D subtract(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.subtract(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D subtract(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.subtract(f, g), getType(), getnDims()); } protected MathArrayComplex2D subtractC(double g) { return new MathArrayComplex2D(ArrayMath.subtractC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D subtractC(float g) { return new MathArrayComplex2D(ArrayMath.subtractC(f, new Complex(g)), getType(), getnDims()); } protected MathArrayComplex2D subtractC(Complex g) { return new MathArrayComplex2D(ArrayMath.subtractC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D subtractC(MathArray<Complex[][]> g) { return new MathArrayComplex2D(ArrayMath.subtractC(f, g.getArray()), getType(), getnDims()); } protected MathArrayComplex2D subtractC(Complex[][] g) { return new MathArrayComplex2D(ArrayMath.subtractC(f, g), getType(), getnDims()); } @Override protected MathArrayComplex2D tan() { return new MathArrayComplex2D(ArrayMath.tan(f), getType(), getnDims()); } @Override protected MathArrayComplex2D tanC() { return new MathArrayComplex2D(ArrayMath.tanC(f), getType(), getnDims()); } @Override protected MathArrayComplex2D tanh() { return new MathArrayComplex2D(ArrayMath.tanh(f), getType(), getnDims()); } @Override protected MathArrayComplex2D tanhC() { return new MathArrayComplex2D(ArrayMath.tanhC(f), getType(), getnDims()); } }