Java Array Multiply multiply(double[] a, double[] b)

Here you can find the source of multiply(double[] a, double[] b)

Description

multiply

License

Apache License

Declaration

public static final double[] multiply(double[] a, double[] b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final double[] multiply(double[] a, double[] b) {
        double[] out = new double[a.length];
        for (int i = 0; i < a.length; i++) {
            out[i] = a[i] * b[i];/*from  w  w  w. ja  va 2s .  c o  m*/
        }
        return out;
    }

    public static final float[] multiply(float[] a, float[] b) {
        float[] out = new float[a.length];
        for (int i = 0; i < a.length; i++) {
            out[i] = a[i] * b[i];
        }
        return out;
    }

    public static final int[] multiply(int[] a, int[] b) {
        int[] out = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            out[i] = a[i] * b[i];
        }
        return out;
    }

    public static final long[] multiply(long[] a, long[] b) {
        long[] out = new long[a.length];
        for (int i = 0; i < a.length; i++) {
            out[i] = a[i] * b[i];
        }
        return out;
    }

    public static final double[] multiply(double[] in, double val) {
        double[] out = new double[in.length];
        for (int i = 0; i < in.length; i++) {
            out[i] = in[i] * val;
        }
        return out;
    }

    public static final float[] multiply(float[] in, float val) {
        float[] out = new float[in.length];
        for (int i = 0; i < in.length; i++) {
            out[i] = in[i] * val;
        }
        return out;
    }

    public static final void multiply(float[][][][] img, float val) {
        for (int i = 0; i < img.length; i++)
            for (int j = 0; j < img[0].length; j++)
                for (int k = 0; k < img[0][0].length; k++)
                    for (int l = 0; l < img[0][0][0].length; l++) {
                        img[i][j][k][l] *= val;
                    }
    }

    public static final void multiply(float[][][][] img, double val) {
        for (int i = 0; i < img.length; i++)
            for (int j = 0; j < img[0].length; j++)
                for (int k = 0; k < img[0][0].length; k++)
                    for (int l = 0; l < img[0][0][0].length; l++) {
                        img[i][j][k][l] *= val;
                    }
    }

    public static final void multiply(float[][][] img, float val) {
        for (int i = 0; i < img.length; i++)
            for (int j = 0; j < img[0].length; j++)
                for (int k = 0; k < img[0][0].length; k++) {
                    img[i][j][k] *= val;
                }
    }

    public static final void multiply(float[][][] img, double val) {
        for (int i = 0; i < img.length; i++)
            for (int j = 0; j < img[0].length; j++)
                for (int k = 0; k < img[0][0].length; k++) {
                    img[i][j][k] *= val;
                }
    }
}

Related

  1. mult(float[] nums, float n)
  2. multiply(byte[] a, byte b)
  3. multiply(double factor, double[] vector)
  4. multiply(double[] a, double m)
  5. multiply(double[] a, double v)
  6. multiply(double[] a, double[] b)
  7. multiply(double[] a, double[] b)
  8. multiply(double[] array, double multiplier)
  9. multiply(double[] multiplicand, double[] factor, double multiplicandAdjustment, double factorAdjustment)