List of utility methods to do Array Multiply
String[] | multiply(String[] strings, String placeholder, String[] replacements) multiply String[] results = new String[replacements.length * strings.length]; int n = 0; for (int i = 0; i < replacements.length; i++) { for (int j = 0; j < strings.length; j++) { results[n++] = replaceOnce(strings[j], placeholder, replacements[i]); return results; ... |
double | multiplyAndSum(double[] r1, double[] r2) multiply And Sum double ret = 0; for (int i = 0; i < r1.length; i++) { ret += r1[i] * r2[i]; return ret; |
double | multiplyAndSum(final double[] d, final double scale) multiply And Sum return sum(scale(d, scale));
|
float[] | multiplyArray(float[] array, float num) multiply Array float[] result = new float[array.length]; for (int i = 0; i < array.length; i++) result[i] = array[i] * num; return result; |
double[] | multiplyByScalar(double scalar, double[] vector) Returns a new vector which is the multiplication of the given vector by a scalar. double[] ret = new double[vector.length]; for (int i = 0; i < vector.length; ++i) { ret[i] = scalar * vector[i]; return ret; |
byte[] | multiplyBytes(byte[] in, int count, int mul) Repeats count bytes of in mul times.
byte[] ret = new byte[count * mul]; for (int x = 0; x < count * mul; x++) { ret[x] = in[x % count]; return ret; |
double[] | multiplyComplex(double[] one, double[] two) Multiplies two arrays of complex numbers pairwise double[] revan = null; if (one.length == two.length) { revan = new double[one.length]; for (int i = 0; i < one.length / 2; i++) { revan[2 * i] = (one[2 * i] * two[2 * i]) - (one[(2 * i) + 1] * two[(2 * i) + 1]); revan[(2 * i) + 1] = (one[(2 * i) + 1] * two[2 * i]) + (one[2 * i] * two[(2 * i) + 1]); return revan; |
float[] | multiplyComplexVectors(float[] cA, float[] cB, long limit) multiply Complex Vectors assert limit * 2 == cA.length; for (int i = 0; i < limit; i++) { float realA = cA[i * 2]; float imA = cA[i * 2 + 1]; float realB = cB[i * 2]; float imB = cB[i * 2 + 1]; cA[i * 2] = realA * realB - imA * imB; cA[i * 2 + 1] = realA * imB + imA * realB; ... |
double[] | multiplycst(int k, double[] t) multiplycst if (t == null) { System.err.println("empty array for multiplying by constant"); return null; } else { double[] res = new double[t.length]; for (int i = 0; i < t.length; i++) { res[i] = t[i] * k; return res; |
double[] | multiplyElementwise(double[] a, int[] b) Multiplies an array of doubles and an array 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] = a[i] * b[i]; return result; ... |