math4610

Routine Name: matrixMatrixMultiply

Author: David Merkley

Language: Python

Description/Purpose: multiply of matrix and matrix

Input: a matrix and matrix

Output: the product

Implementation/Code:

def matrixMatrixMultiply(A, B):
    m = len(A)
    n = len(A[0])
    r = len(B[0])
    C = [[0 ] *r for i in range(m)]
    for i in range(m):
        for j in range(n):
            for k in range(r):
                C[i][k] += A[i][j] * B[j][k]
    return C