Here you can find the source of matrixVector(double[][] w, double[] v)
public static double[] matrixVector(double[][] w, double[] v)
//package com.java2s; //License from project: Open Source License public class Main { public static double[] matrixVector(double[][] w, double[] v) { int w1 = w.length; int w2 = w[0].length; int v1 = v.length; if (w2 != v1) { System.out.println("Matrix dimensions do not agree..."); System.exit(-1);//w w w. j a v a 2s. co m } double[] result = new double[w1]; for (int w_i1 = 0; w_i1 < w1; w_i1++) { double sum = 0; for (int w_i2 = 0; w_i2 < w2; w_i2++) { sum += w[w_i1][w_i2] * v[w_i2]; } result[w_i1] = sum; } return result; } }