Files
app-store-optimization/skills/loki-mode/benchmarks/results/2026-01-05-10-37-54/swebench-loki-patches/sympy__sympy-14817.patch

19 lines
844 B
Diff

# sympy__sympy-14817
# Loki Mode Multi-Agent Patch
# Attempts: 1
Based on the architect's analysis and the issue description, I can generate the patch. The issue is in the `_print_MatAdd` method where `S(item.args[0]).is_negative` is used to check for negative terms. This should be replaced with `item.could_extract_minus_sign()` which is the same approach used in `_print_Add`.
```
--- a/sympy/printing/pretty/pretty.py
+++ b/sympy/printing/pretty/pretty.py
@@ -825,7 +825,7 @@ class PrettyPrinter(Printer):
for i, item in enumerate(expr.args[1:]):
if printed:
pform = prettyForm(*pform.right(' '))
- if S(item.args[0]).is_negative:
+ if item.could_extract_minus_sign():
pform = prettyForm(*pform.right('- '))
item = -item
else:
```