001 /** 002 * Sequential Matrix Multiplication. 003 * Sequential algorithm, matrix is B transposed. 004 * @author Heinz Kredel. 005 */ 006 public class SeqMultTrans implements MMInf { 007 008 /** 009 * Performs the multiplication of two matrices, B transposed. 010 * C = A * trans(B). 011 * @param C result matrix. 012 * @param A matrix. 013 * @param B matrix. 014 */ 015 public void multiply(double[][] C, double[][] A, double[][] B) { 016 System.out.println("SeqMultTrans"); 017 for (int i=0; i < A.length; i++) { 018 double[] Ai = A[i]; 019 for (int j=0; j < B.length; j++) { 020 double[] Bj = B[j]; 021 double c = 0.0; 022 for (int k=0; k < B[0].length; k++) { 023 c += Ai[k] * Bj[k]; 024 } 025 C[i][j] = c; 026 } 027 } 028 } 029 030 }