com.ericbarnhill.arrayMath.MathArrayDouble3D.java Source code

Java tutorial

Introduction

Here is the source code for com.ericbarnhill.arrayMath.MathArrayDouble3D.java

Source

/*
 * (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 double[][][]} objects.
 * @author ericbarnhill
 * @see MathArray
 * @see MathArrayFactory
 * @see ArrayMath
 * @since 0.1
 *
 */

public class MathArrayDouble3D extends MathArray<double[][][]> {

    protected MathArrayDouble3D(double[][][] f, int type, int nDims) {
        super(f, type, nDims);
    }

    @Override
    public double[][][] getArray() {
        return f;
    }

    @Override
    protected MathArrayDouble3D abs() {
        return new MathArrayDouble3D(ArrayMath.abs(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D acos() {
        return new MathArrayDouble3D(ArrayMath.acos(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D acosC() {
        return new MathArrayDouble3D(ArrayMath.acosC(f), getType(), getnDims());
    }

    protected MathArrayDouble3D add(double g) {
        return new MathArrayDouble3D(ArrayMath.add(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D add(float g) {
        return new MathArrayDouble3D(ArrayMath.add(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D add(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D add(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.add(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D add(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.add(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D addC(double g) {
        return new MathArrayDouble3D(ArrayMath.addC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D addC(float g) {
        return new MathArrayDouble3D(ArrayMath.addC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D addC(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D addC(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.addC(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D addC(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.addC(f, g), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D asin() {
        return new MathArrayDouble3D(ArrayMath.asin(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D asinC() {
        return new MathArrayDouble3D(ArrayMath.asinC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D atan() {
        return new MathArrayDouble3D(ArrayMath.atan(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D atanC() {
        return new MathArrayDouble3D(ArrayMath.atanC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D cos() {
        return new MathArrayDouble3D(ArrayMath.cos(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D cosC() {
        return new MathArrayDouble3D(ArrayMath.cosC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D cosh() {
        return new MathArrayDouble3D(ArrayMath.cosh(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D coshC() {
        return new MathArrayDouble3D(ArrayMath.coshC(f), getType(), getnDims());
    }

    protected MathArrayDouble3D divide(double g) {
        return new MathArrayDouble3D(ArrayMath.divide(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D divide(float g) {
        return new MathArrayDouble3D(ArrayMath.divide(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D divide(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D divide(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.divide(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D divide(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.divide(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D divideC(double g) {
        return new MathArrayDouble3D(ArrayMath.divideC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D divideC(float g) {
        return new MathArrayDouble3D(ArrayMath.divideC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D divideC(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D divideC(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.divideC(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D divideC(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.divideC(f, g), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D log() {
        return new MathArrayDouble3D(ArrayMath.log(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D logC() {
        return new MathArrayDouble3D(ArrayMath.logC(f), getType(), getnDims());
    }

    protected MathArrayDouble3D multiply(double g) {
        return new MathArrayDouble3D(ArrayMath.multiply(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D multiply(float g) {
        return new MathArrayDouble3D(ArrayMath.multiply(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D multiply(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D multiply(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.multiply(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D multiply(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.multiply(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D multiplyC(double g) {
        return new MathArrayDouble3D(ArrayMath.multiplyC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D multiplyC(float g) {
        return new MathArrayDouble3D(ArrayMath.multiplyC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D multiplyC(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D multiplyC(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.multiplyC(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D multiplyC(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.multiplyC(f, g), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D reciprocal() {
        return new MathArrayDouble3D(ArrayMath.reciprocal(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D reciprocalC() {
        return new MathArrayDouble3D(ArrayMath.reciprocalC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D sin() {
        return new MathArrayDouble3D(ArrayMath.sin(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D sinC() {
        return new MathArrayDouble3D(ArrayMath.sinC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D sinh() {
        return new MathArrayDouble3D(ArrayMath.sinh(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D sinhC() {
        return new MathArrayDouble3D(ArrayMath.sinhC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D sqrt() {
        return new MathArrayDouble3D(ArrayMath.sqrt(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D sqrtC() {
        return new MathArrayDouble3D(ArrayMath.sqrtC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D square() {
        return new MathArrayDouble3D(ArrayMath.square(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D squareC() {
        return new MathArrayDouble3D(ArrayMath.squareC(f), getType(), getnDims());
    }

    protected MathArrayDouble3D subtract(double g) {
        return new MathArrayDouble3D(ArrayMath.subtract(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D subtract(float g) {
        return new MathArrayDouble3D(ArrayMath.subtract(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D subtract(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D subtract(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.subtract(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D subtractC(double g) {
        return new MathArrayDouble3D(ArrayMath.subtractC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D subtractC(float g) {
        return new MathArrayDouble3D(ArrayMath.subtractC(f, g), getType(), getnDims());
    }

    protected MathArrayDouble3D subtractC(Complex g) {
        throw new ClassCastException("Cannot add Complex number to double array");
    }

    @Override
    protected MathArrayDouble3D subtractC(MathArray<double[][][]> g) {
        return new MathArrayDouble3D(ArrayMath.subtractC(f, g.getArray()), getType(), getnDims());
    }

    protected MathArrayDouble3D subtractC(double[][][] g) {
        return new MathArrayDouble3D(ArrayMath.subtractC(f, g), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D tan() {
        return new MathArrayDouble3D(ArrayMath.tan(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D tanC() {
        return new MathArrayDouble3D(ArrayMath.tanC(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D tanh() {
        return new MathArrayDouble3D(ArrayMath.tanh(f), getType(), getnDims());
    }

    @Override
    protected MathArrayDouble3D tanhC() {
        return new MathArrayDouble3D(ArrayMath.tanhC(f), getType(), getnDims());
    }

}