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