List of utility methods to do Array Subtract
void | subtract(final double[] a, final double[] b, final double[] c) set c = a - b. assert (rows(a) == rows(b)) && (rows(a) == rows(c)); final int rows = rows(a); for (int i = 0; i < rows; ++i) c[i] = a[i] - b[i]; |
double[] | subtract(final double[] first, final double[] second) subtract 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; |
double[] | subtract(final double[] v1, final double[] v2) subtract if (v1.length != v2.length) { throw new RuntimeException(VECTORS_DIFFERENT_LENGTHS); final double[] result = new double[v1.length]; for (int i = 0; i < result.length; i++) { result[i] = v1[i] - v2[i]; return result; ... |
double[] | subtract(final double[] vector1, final double[] vector2) subtract assert (vector1.length == vector2.length); final double[] result = new double[vector1.length]; for (int i = 0; i < vector1.length; i++) { result[i] = vector1[i] - vector2[i]; return result; |
float[][][] | subtract(float a[][][], float b[][][]) Create matrix c = a - b int l = a.length; int m = a[0].length; int n = a[0][0].length; float[][][] c = new float[l][m][n]; for (int i = 0; i < l; i++) for (int j = 0; j < m; j++) for (int k = 0; k < n; k++) c[i][j][k] = a[i][j][k] - b[i][j][k]; ... |
float[] | subtract(float[] dividend, float[] divisor) subtract float[] difference = new float[dividend.length]; for (int i = 0; i < dividend.length; i++) { difference[i] = dividend[i] - divisor[i]; return difference; |
int[] | subtract(int a, int[] b) subtract int[] re = new int[b.length]; for (int i = 0; i < b.length; i++) re[i] = a - b[i]; return re; |
void | subtract(int bytesPerDim, int dim, byte[] a, byte[] b, byte[] result) Result = a - b, where a >= b, else IllegalArgumentException is thrown. int start = dim * bytesPerDim; int end = start + bytesPerDim; int borrow = 0; for (int i = end - 1; i >= start; i--) { int diff = (a[i] & 0xff) - (b[i] & 0xff) - borrow; if (diff < 0) { diff += 256; borrow = 1; ... |
int[] | subtract(int[] a, int[] b) subtract int[] c = new int[a.length]; for (int i = 0; i < a.length; i++) { c[i] = a[i] - b[i]; return c; |
void | subtract2(double[] v1, double[] v2, double[] res) subtracts two vectors v1-v2, writes into res res[0] = v1[0] - v2[0]; res[1] = v1[1] - v2[1]; res[2] = v1[2] - v2[2]; |