Java Utililty Methods Array Divide

List of utility methods to do Array Divide

Description

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

Method

voiddivideElements(final int j, final int numRows, final float[] u, final float u_0)
divide Elements
for (int i = j; i < numRows; i++) {
    u[i] /= u_0;
voiddivideElements4arg(final int j, final int numRows, final double[] u, final double u_0)
divide Elementsarg
for (int i = j; i < numRows; i++) {
    u[i] /= u_0;
voiddivideElements_Bcol(int j, int numRows, int numCols, double[] u, double b[], int startB, double u_0)
divide Element Bcol
int indexB = j * numCols + startB;
for (int i = j; i < numRows; i++, indexB += numCols) {
    b[indexB] = u[i] /= u_0;
double[]divideElementwise(int[] a, int[] b)
Divides the values in the two arrays of integers element-wise.
if (a.length != b.length) {
    throw new ArithmeticException();
} else {
    double[] result = new double[a.length];
    for (int i = 0; i < a.length; i++) {
        result[i] = (double) a[i] / b[i];
    return result;
...
float[][]divideImage(float[][] base, float[][] divisor)
Calculates the value of one image divided by another, pixel by pixel
float[][] output = new float[base.length][base[0].length];
for (int i = 0; i < base.length; i++) {
    for (int j = 0; j < base[0].length; j++) {
        output[i][j] = base[i][j] / divisor[i][j];
return output;
voiddivideInPlace(double denominator, double[] target)
divide In Place
for (int i = 0; i < target.length; i++) {
    target[i] /= denominator;
voiddivideInPlace(float[] vector, float val)
Divides the second vector from the first one (vector1[i] /= val)
int length = vector.length;
for (int i = 0; i < length; i++) {
    vector[i] /= val;
Object[][]divideIntoChunks(Object[] objs, int chunkSize)
Divides an array of Objects into series of smaller arrays.
Object[][] chunkObjs = null;
if (objs == null || objs.length == 0) {
    chunkObjs = new Object[0][];
} else {
    int chunks = ((objs.length - 1) / chunkSize) + 1;
    chunkObjs = new Object[chunks][];
    int count = 0;
    int batchCount = 0;
...
double[]divideNonSingular(int[] array1, int[] array2)
Divides two arrays element-to-element, but when numerator and denominator = 0, returns 0 instead of a singularity (NaN)
double[] out = new double[array1.length];
for (int i = 0; i < out.length; i++)
    out[i] = array1[i] == 0 && array2[i] == 0 ? 0 : (double) array1[i] / array2[i];
return out;
voiddivideVector(float[] resultVec, float divisor)
Divide all element of a vector by a scalar
for (int i = 0; i < resultVec.length; i++) {
    resultVec[i] /= divisor;