Here you can find the source of transposematrixmultiply(final double[][] A, final double[] b)
Parameter | Description |
---|---|
A | the matrix |
b | the vector |
public static double[] transposematrixmultiply(final double[][] A, final double[] b)
//package com.java2s; /**/* w w w. ja va2 s .c o m*/ * This program is free software; you can * redistribute it and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation (version 2). This * program is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ public class Main { /** * Multiply matrix transpose(A) with vector b. * *@param A the matrix *@param b the vector *@return A b */ public static double[] transposematrixmultiply(final double[][] A, final double[] b) { double[] answer = new double[b.length]; // this assumes A is a square matrix for (int row = 0; row < answer.length; ++row) for (int col = 0; col < b.length; ++col) answer[row] += A[col][row] * b[col]; return answer; } }