Java Matrix Transpose transposematrixmultiply(final double[][] A, final double[] b)

Here you can find the source of transposematrixmultiply(final double[][] A, final double[] b)

Description

Multiply matrix transpose(A) with vector b.

License

Open Source License

Parameter

Parameter Description
A the matrix
b the vector

Return

A b

Declaration

public static double[] transposematrixmultiply(final double[][] A, final double[] b) 

Method Source Code

//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;
    }
}

Related

  1. transposeInPlace(float[] src)
  2. transposeMatrix(double[][] m)
  3. transposeMatrix(double[][] m)
  4. transposeMatrix(final float[] msrc, final int msrc_offset, final float[] mres, final int mres_offset)
  5. transposeMatrix3x3(float[] result, float[] m)
  6. transposeQuad(final double[][] src, int n)
  7. transposeSquareMatrix(T[][] matrixT)
  8. transposeValue(long[] valSet, int DEPTH)