Here you can find the source of subtractRange(double[] accumulator, int offset, double[] values)
double
s from another.
Parameter | Description |
---|---|
accumulator | The array of <code>double</code>s to subtract the elements of <code>values</code> from (the elements of this array will be modified). |
offset | The index into <code>accumulator</code> at which to start subtracting the elements of <code>values</code>. |
values | The array of <code>double</code>s to subtract from each corresponding element of <code>accumulator</code>. |
accumulator
.
public static double[] subtractRange(double[] accumulator, int offset, double[] values)
//package com.java2s; /**//w ww .java 2s .c o m * Java Modular Image Synthesis Toolkit (JMIST) * Copyright (C) 2008-2013 Bradley W. Kimmel * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ public class Main { /** * Subtracts the elements of one array of <code>double</code>s from * another. * @param accumulator The array of <code>double</code>s to subtract the * elements of <code>values</code> from (the elements of this array * will be modified). * @param offset The index into <code>accumulator</code> at which to start * subtracting the elements of <code>values</code>. * @param values The array of <code>double</code>s to subtract from each * corresponding element of <code>accumulator</code>. * @return A reference to <code>accumulator</code>. */ public static double[] subtractRange(double[] accumulator, int offset, double[] values) { assert (accumulator.length >= offset + values.length); for (int i = offset, j = 0; j < values.length; i++, j++) { accumulator[i] -= values[j]; } return accumulator; } /** * Subtracts the elements of one array of <code>int</code>s from * another. * @param accumulator The array of <code>int</code>s to subtract the * elements of <code>values</code> from (the elements of this array * will be modified). * @param offset The index into <code>accumulator</code> at which to start * subtracting the elements of <code>values</code>. * @param values The array of <code>int</code>s to subtract from each * corresponding element of <code>accumulator</code>. * @return A reference to <code>accumulator</code>. */ public static int[] subtractRange(int[] accumulator, int offset, int[] values) { assert (accumulator.length >= offset + values.length); for (int i = offset, j = 0; j < values.length; i++, j++) { accumulator[i] -= values[j]; } return accumulator; } /** * Subtracts the elements of one array of <code>long</code>s from * another. * @param accumulator The array of <code>long</code>s to subtract the * elements of <code>values</code> from (the elements of this array * will be modified). * @param offset The index into <code>accumulator</code> at which to start * subtracting the elements of <code>values</code>. * @param values The array of <code>long</code>s to subtract from each * corresponding element of <code>accumulator</code>. * @return A reference to <code>accumulator</code>. */ public static long[] subtractRange(long[] accumulator, int offset, long[] values) { assert (accumulator.length >= offset + values.length); for (int i = offset, j = 0; j < values.length; i++, j++) { accumulator[i] -= values[j]; } return accumulator; } }