Here you can find the source of matrixATrans_x_matrixB(double[][] matA, double[][] matB)
Parameter | Description |
---|---|
matA | The matrix (m x n). |
matB | The matrix (m x r). |
public static double[][] matrixATrans_x_matrixB(double[][] matA, double[][] matB)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww . j a v a2s. com * First transposes matrix matA, then multiplies it with matrix matB. * @param matA The matrix (m x n). * @param matB The matrix (m x r). * @return The resulting matrix of size n x r. */ public static double[][] matrixATrans_x_matrixB(double[][] matA, double[][] matB) { final int m = matA[0].length; final int n = matB[0].length; double[][] res = new double[m][n]; for (int r = 0; r < m; r++) { for (int c = 0; c < n; c++) { for (int i = 0; i < matA.length; i++) { res[r][c] += matA[i][r] * matB[i][c]; } } } return res; } }