Skip to content

Refactor is_linear_expression function of expr.py#187

Open
alisa-kirkinskaia wants to merge 1 commit intomasterfrom
fix_check_linearity
Open

Refactor is_linear_expression function of expr.py#187
alisa-kirkinskaia wants to merge 1 commit intomasterfrom
fix_check_linearity

Conversation

@alisa-kirkinskaia
Copy link
Copy Markdown

1. Fix #121:

Fixed a bug in is_linear_expression related to expand() being very slow for some expressions. The bug is caused by the following line:

if not( (a-b).expand() == 0 or a.expand() == b.expand()):

In the fix we avoid comparing the values of a.expand() and b.expand() if (a-b).expand() is 0, as it already means the expression is linear.

2. Refactor is_linear_expression for better readability:

  • Remove unused argument integral
  • Rename variables
  • Add docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stuck or very Slow check is_linear_expression in LinearForm and BilinearForm

1 participant