Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • pystencils pystencils
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 18
    • Issues 18
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • pycodegen
  • pystencilspystencils
  • Issues
  • #60

Closed
Open
Created Mar 27, 2022 by Markus Holzer@holzerOwner

SymPy CSE does not work as good as it used to work

https://github.com/sympy/sympy/commit/19c715920e52337d124dda63abdc056f56ec094e

has a negative impact on our CSE routine. An example would be test_simplifications_srt_d2q9_incompressible in lbmpy

The following example should demonstrate the change, before 19c715920e52337d124dda63abdc056f56ec094e:

import sympy as sp
var = sp.symbols("a b c d")

test = -var[0] + var[3]/9 + var[2]**2/2 + var[2]/3, -var[1] + var[3]/9 + var[2]**2/2 - var[2]/3
sp.cse(test)
>>> ([(x0, c/3), (x1, c**2/2 + d/9)], [-a + x0 + x1, -b - x0 + x1])

After 19c715920e52337d124dda63abdc056f56ec094e:

import sympy as sp
var = sp.symbols("a b c d")

test = -var[0] + var[3]/9 + var[2]**2/2 + var[2]/3, -var[1] + var[3]/9 + var[2]**2/2 - var[2]/3
sp.cse(test)
>>> ([(x0, c/3), (x1, c**2)], [-a + d/9 + x0 + x1/2, -b + d/9 - x0 + x1/2])

The second latest master version does not find the replacements for the divisions.

An issue in Sympy was created here: https://github.com/sympy/sympy/issues/23297

Edited Mar 27, 2022 by Markus Holzer
Assignee
Assign to
Time tracking