Java Array Subtract subtractKeepPositiveValues(float[] dividend, float divisor)

Here you can find the source of subtractKeepPositiveValues(float[] dividend, float divisor)

Description

subtract Keep Positive Values

License

Open Source License

Declaration

public static float[] subtractKeepPositiveValues(float[] dividend,
            float divisor) 

Method Source Code

//package com.java2s;
/*//w  w w. ja v  a 2  s  . c o  m
 * Copyright (c) 2008-2013 Maksim Khadkevich and Fondazione Bruno Kessler.
 *
 * This file is part of MART.
 * MART is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2, as published
 * by the Free Software Foundation.
 *
 * MART 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 MART; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

public class Main {
    public static float[] subtractKeepPositiveValues(float[] dividend,
            float divisor) {
        float[] difference = new float[dividend.length];
        for (int i = 0; i < dividend.length; i++) {
            difference[i] = Math.max(dividend[i] - divisor, 0);
        }
        return difference;
    }
}

Related

  1. subtractElementwise(int[] a, int[] b)
  2. subtractImages(float[][] top, float[][] base)
  3. subtractInPlace(double[] a, double[] b)
  4. subtractInPlace(double[] first, double[] second)
  5. subtractInPlace(final double[] a, final double[] b)
  6. subtractMin(Double[] array)
  7. subtractRange(double[] accumulator, int offset, double[] values)
  8. subtractSignals(double[] s1, double[] s2)
  9. subtractTo(double a[][][], double b[][][])