def matrix_multiply(m1, m2):
    """ Matrix multiplication (iterative algorithm).

    The running time of the iterative matrix multiplication algorithm is :math:`O(n^{3})`.

    :param m1: 1st matrix with dimensions :math:`(n \\times p)`
    :type m1: list, tuple
    :param m2: 2nd matrix with dimensions :math:`(p \\times m)`
    :type m2: list, tuple
    :return: resultant matrix with dimensions :math:`(n \\times m)`
    :rtype: list
    """
    mm = [[0.0 for _ in range(len(m2[0]))] for _ in range(len(m1))]
    for i in range(len(m1)):
        for j in range(len(m2[0])):
            for k in range(len(m2)):
                mm[i][j] += float(m1[i][k] * m2[k][j])
    return mm
def matrix_multiply ( m1 , m2 ) : mm = [ [ 0.0 for _ in range ( len ( m2 [ 0 ] ) ) ] for _ in range ( len ( m1 ) ) ] for i in range ( len ( m1 ) ) : for j in range ( len ( m2 [ 0 ] ) ) : for k in range ( len ( m2 ) ) : mm [ i ] [ j ] += float ( m1 [ i ] [ k ] * m2 [ k ] [ j ] ) return mm
Matrix multiplication (iterative algorithm).

    The running time of the iterative matrix multiplication algorithm is :math:`O(n^{3})`.

    :param m1: 1st matrix with dimensions :math:`(n \\times p)`
    :type m1: list, tuple
    :param m2: 2nd matrix with dimensions :math:`(p \\times m)`
    :type m2: list, tuple
    :return: resultant matrix with dimensions :math:`(n \\times m)`
    :rtype: list