def assert_fortran_mat(*mats):
    """Check if the input ndarrays are all proper Fortran matrices."""
    for mat in mats:
        if mat is not None and (mat.shape[0] > 1 or mat.shape[1] > 1
            ) and not mat.flags['F_CONTIGUOUS']:
            raise ValueError('Input matrix must be Fortran contiguous')
