def matrix_dot(mat1, mat2):
    """Inner product for matrices

Compute the inner product between matrices as:

    .. math:: \\mathrm{Trace}(M_1^T M_2)

Parameters
----------
mat1: 2d array
   First matrix
mat2: 2d matrix
    Second matrix

Returns
-------
dot: float
    The matrix inner product.
"""
    return (mat1 * mat2).sum()