Java Array Subtract subtract(final double[] first, final double[] second)

Here you can find the source of subtract(final double[] first, final double[] second)

Description

subtract

License

Open Source License

Declaration

final public static double[] subtract(final double[] first, final double[] second) 

Method Source Code

//package com.java2s;
/*//w ww. ja va  2  s  .  c  o  m
 * ====================================================
 * Copyright (C) 2013 by Idylwood Technologies, LLC. All rights reserved.
 *
 * Developed at Idylwood Technologies, LLC.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * The License should have been distributed to you with the source tree.
 * If not, it can be found at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * Author: Charles Cooper
 * Date: 2013
 * ====================================================
 */

public class Main {
    final public static double[] subtract(final double[] first, final double[] second) {
        final int len = Math.min(first.length, second.length);
        final double ret[] = new double[len];
        for (int i = 0; i < len; i++)
            ret[i] = first[i] - second[i];
        return ret;
    }

    public final static double min(double... values) {
        if (values.length == 0)
            return Double.NaN;
        double ret = values[0];
        for (int i = 1; i < values.length; i++)
            if (values[i] < ret)
                ret = values[i];
        return ret;
    }
}

Related

  1. subtract(double[] x, double c)
  2. subtract(double[][] a, double[][] b)
  3. subtract(double[][] a, double[][] b)
  4. subtract(double[][] dest, double[][] a, double[][] b)
  5. subtract(final double[] a, final double[] b, final double[] c)
  6. subtract(final double[] v1, final double[] v2)
  7. subtract(final double[] vector1, final double[] vector2)
  8. subtract(float a[][][], float b[][][])
  9. subtract(float[] dividend, float[] divisor)