Here you can find the source of multiplyScalars(float[][] x, float[][] y)
public static float[][] multiplyScalars(float[][] x, float[][] y)
//package com.java2s; /** Ben F Rayfield offers this software opensource MIT license */ public class Main { /** 1d arrays can be different sizes within same parent array, but x and y must be same sizes in all ways. */ public static float[][] multiplyScalars(float[][] x, float[][] y) { if (x.length != y.length) throw new Error("diff sizes"); float[][] ret = new float[x.length][]; for (int i = 0; i < x.length; i++) { int innerSize = x[i].length; ret[i] = new float[innerSize]; if (innerSize != y[i].length) throw new Error("diff sizes"); for (int j = 0; j < innerSize; j++) { ret[i][j] = x[i][j] * y[i][j]; }/*from ww w . j a v a 2s . c o m*/ } return ret; } }