Here you can find the source of multiply(double[][] m, double[] x)
public static double[] multiply(double[][] m, double[] x)
//package com.java2s; //License from project: Open Source License public class Main { /**//from www . j a v a 2 s.co m * Multiply a square matrix and a vector. Note that matrix width and vector length have to be equal, otherwise null is returned. */ public static double[] multiply(double[][] m, double[] x) { assert (m[0].length == x.length); double[] y = new double[m.length]; for (int i = 0; i < m.length; i++) for (int j = 0; j < x.length; j++) { y[i] += m[i][j] * x[j]; } return y; } }