#NEWLINE# def test_lambdify_matrix_vec_input( ) : #NEWLINE# #INDENT# X = sympy . DeferredVector ( 'X' ) #NEWLINE# M = Matrix ( [ [ ( X [ 0 ] ** 2 ) , ( X [ 0 ] * X [ 1 ] ) , ( X [ 0 ] * X [ 2 ] ) ] , [ ( X [ 1 ] * X [ 0 ] ) , ( X [ 1 ] ** 2 ) , ( X [ 1 ] * X [ 2 ] ) ] , [ ( X [ 2 ] * X [ 0 ] ) , ( X [ 2 ] * X [ 1 ] ) , ( X [ 2 ] ** 2 ) ] ] ) #NEWLINE# f = lambdify ( X , M , [ { #NEWLINE# #INDENT# 'ImmutableMatrix' : numpy . array , #NEWLINE# #UNINDENT# } , 'numpy' ] ) #NEWLINE# Xh = array ( [ 1.0 , 2.0 , 3.0 ] ) #NEWLINE# expected = array ( [ [ ( Xh [ 0 ] ** 2 ) , ( Xh [ 0 ] * Xh [ 1 ] ) , ( Xh [ 0 ] * Xh [ 2 ] ) ] , [ ( Xh [ 1 ] * X [ 0 ] ) , ( Xh [ 1 ] ** 2 ) , ( Xh [ 1 ] * Xh [ 2 ] ) ] , [ ( Xh [ 2 ] * Xh [ 0 ] ) , ( Xh [ 2 ] * Xh [ 1 ] ) , ( Xh [ 2 ] ** 2 ) ] ] ) #NEWLINE# actual = f ( Xh ) #NEWLINE# assert numpy . allclose ( actual , expected )