Java Utililty Methods Array Subtract

List of utility methods to do Array Subtract

Description

The list of methods to do Array Subtract are organized into topic(s).

Method

double[]arraySubtract(double[] x1, double[] x2)
array Subtract
double[] result = new double[x1.length];
for (int i = 0; i < x1.length; i++) {
    result[i] = x1[i] - x2[i];
return result;
Double[]arraySubtract(final Double[] first, final Double[] second)
Subtracts the elements of the arrays.
final Double[] toret = new Double[first.length];
for (int i = 0; i < first.length; i++) {
    toret[i] = first[i] - second[i];
return toret;
byte[]subtract(byte[] a, byte[] b)
a - b
if (a == null)
    throw new IllegalArgumentException("b1 should not be null");
if (b == null)
    throw new IllegalArgumentException("b2 should not be null");
if (a.length != b.length)
    throw new IllegalArgumentException("byte array length should be same");
int len = a.length;
byte[] result = new byte[len];
...
double[]subtract(double[] a, double[] b)
subtract
if (a.length != b.length) {
    throw new IllegalArgumentException("Arrays must be equal length");
double[] c = new double[a.length];
for (int i = 0; i < a.length; i++) {
    c[i] = a[i] - b[i];
return c;
...
double[]subtract(double[] a, double[] b)
Subtracts two points
if (a.length != b.length)
    throw new IllegalArgumentException("Subtracted two not matching Vectors.");
double[] erg = new double[a.length];
for (int i = 0; i < a.length; i++) {
    erg[i] = a[i] - b[i];
return erg;
double[]subtract(double[] a, double[] b)
Subtracts the two arrays together (componentwise)
if (a.length != b.length) {
    throw new IllegalArgumentException(
            "To add two arrays, they must have the same length : " + a.length + ", " + b.length);
double[] ans = copy(a);
for (int i = 0; i < a.length; i++) {
    ans[i] -= b[i];
return (ans);
double[]subtract(double[] a, double[] b)
Returns the array-wise difference between two vectors.
double[] out = new double[a.length];
for (int i = 0; i < a.length; i++) {
    out[i] = a[i] - b[i];
return out;
double[]subtract(double[] accumulator, double[] values)
Subtracts the elements of one array of doubles from another.
if (accumulator == null) {
    accumulator = new double[values.length];
assert (accumulator.length == values.length);
for (int i = 0; i < accumulator.length; i++) {
    accumulator[i] -= values[i];
return accumulator;
...
voidsubtract(double[] array, double a)
subtract
for (int i = 0; i < array.length; ++i) {
    array[i] -= a;
double[]subtract(double[] array, double value)
Subtracts a constant value from all items in an array
double[] returnValues = new double[array.length];
for (int i = 0; i < returnValues.length; i++) {
    returnValues[i] = array[i] - value;
return returnValues;