def inverse(mat):  # pylint: disable=R1710
    """Calculate the inverse of a matrix.

    This function is equivalent to the `inverse` function in GLSL.

    Args:
        mat (:class:`taichi.Matrix`): The matrix of which to take the inverse.

    Returns:
        Inverse of the input matrix.

    Example::

        >>> @ti.kernel
        >>> def test():
        >>>     m = mat3([(1, 1, 0), (0, 1, 1), (0, 0, 1)])
        >>>     print(inverse(m))
        >>>
        >>> test()
        [[1.000000, -1.000000, 1.000000],
         [0.000000, 1.000000, -1.000000],
         [0.000000, 0.000000, 1.000000]]
    """
    return mat.inverse()