from diofant import FunctionMatrix, Lambda, Matrix, MatrixExpr
from diofant.abc import i, j


__all__ = ()


def test_funcmatrix():
    X = FunctionMatrix(3, 3, Lambda((i, j), i - j))
    assert X[1, 1] == 0
    assert X[1, 2] == -1
    assert X.shape == (3, 3)
    assert X.rows == X.cols == 3
    assert Matrix(X) == Matrix(3, 3, lambda i, j: i - j)
    assert isinstance(X*X + X, MatrixExpr)
