Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed matrix printing in the LambdaPrinter. #9595

Merged
merged 1 commit into from Jul 3, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion sympy/printing/lambdarepr.py
Expand Up @@ -11,7 +11,8 @@ class LambdaPrinter(StrPrinter):
"""

def _print_MatrixBase(self, expr):
return "%s(%s)" % (expr.__class__.__name__, str(expr.tolist()))
return "%s(%s)" % (expr.__class__.__name__,
self._print((expr.tolist())))

_print_SparseMatrix = \
_print_MutableSparseMatrix = \
Expand Down
6 changes: 6 additions & 0 deletions sympy/printing/tests/test_lambdarepr.py
Expand Up @@ -16,6 +16,12 @@ def test_matrix():
A = Matrix([[x, y], [y*x, z**2]])
assert lambdarepr(A) == "MutableDenseMatrix([[x, y], [x*y, z**2]])"

# Test printing a Matrix that has an element that is printed differently
# with the LambdaPrinter than in the StrPrinter.
p = Piecewise((x, True), evaluate=False)
A = Matrix([p])
assert lambdarepr(A) == "MutableDenseMatrix([[((x) if (True) else None)]])"


def test_piecewise():
# In each case, test eval() the lambdarepr() to make sure there are a
Expand Down