Java Utililty Methods Array Multiply

List of utility methods to do Array Multiply

Description

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

Method

double[][]mult(double[][] A, double[][] B)
mult
if (A.length != B.length)
    throw new IllegalArgumentException("dim A != dim B");
double[][] AB = buildZeroMatrix(A.length);
for (int i = 0; i < A.length; i++) {
    for (int j = 0; j < A.length; j++) {
        AB[i][j] = 0;
        for (int k = 0; k < A.length; k++) {
            AB[i][j] += A[i][k] * B[k][j];
...
float[]mult(float[] nums, float n)
mult
assert !Float.isInfinite(n) : "Trying to multiply " + Arrays.toString(nums) + " by  " + n; 
for (int i = 0; i < nums.length; i++)
    nums[i] *= n;
return nums;
float[]mult(float[] nums, float n)
mult
assert !Float.isInfinite(n) : "Trying to multiply " + Arrays.toString(nums) + " by  " + n; 
for (int i = 0; i < nums.length; i++)
    nums[i] *= n;
return nums;
byte[]multiply(byte[] a, byte b)
a * b
if (a == null)
    throw new IllegalArgumentException("a should not be null");
int len = a.length;
byte[] result = new byte[len];
int carry = 0;
int i2 = byte2int(b);
for (int i = len - 1; 0 <= i; i--) {
    int i1 = byte2int(a[i]); 
...
double[]multiply(double factor, double[] vector)
multiply
double[] result = new double[vector.length];
for (int i = 0; i < vector.length; i++) {
    result[i] = vector[i] * factor;
return result;
double[]multiply(double[] a, double m)
Multiply each element in the given array by the given factor.
for (int i = 0; i < a.length; i++) {
    a[i] *= m;
return a;
voidmultiply(double[] a, double v)
Multiplies a constant to all elements in the array.
for (int i = 0; i < a.length; i++) {
    a[i] *= v;
double[]multiply(double[] a, double[] b)
multiply
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[]multiply(double[] a, double[] b)
multiply
final double[] res = Arrays.copyOf(a, a.length);
for (int i = 0; i < res.length; ++i) {
    res[i] *= b[i];
return res;
double[]multiply(double[] a, double[] b)
multiply
double[] out = new double[a.length];
for (int i = 0; i < a.length; i++) {
    out[i] = a[i] * b[i];
return out;