Esempio n. 1
0
def test_name_conflict_cust_symbols():
    z1 = x0 + y
    z2 = x2 + x3
    l = [cos(z1) + z1, cos(z2) + z2, x0 + x2]
    substs, reduced = cse(l, symbols("x:10"))
    assert [e.subs(dict(substs)) for e in reduced] == l
Esempio n. 2
0
import pytest
import sys

from sumpy.symbolic import (
    Add, Pow, exp, sqrt, symbols, sympify, cos, sin, Function, USE_SYMENGINE)

if not USE_SYMENGINE:
    from sympy.simplify.cse_opts import sub_pre, sub_post
    from sympy.functions.special.hyper import meijerg
    from sympy.simplify import cse_opts

from sumpy.cse import (
    cse, preprocess_for_cse, postprocess_for_cse)


w, x, y, z = symbols('w,x,y,z')
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12 = symbols('x:13')

sympyonly = (
    pytest.mark.skipif(USE_SYMENGINE, reason="uses a sympy-only feature"))


# Dummy "optimization" functions for testing.


def opt1(expr):
    return expr + y


def opt2(expr):
    return expr*z
Esempio n. 3
0
def test_name_conflict_cust_symbols():
    z1 = x0 + y
    z2 = x2 + x3
    l_ = [cos(z1) + z1, cos(z2) + z2, x0 + x2]
    substs, reduced = cse(l_, symbols("x:10"))
    assert [e.subs(dict(substs)) for e in reduced] == l_
Esempio n. 4
0
# }}}

import pytest
import sys

from sumpy.symbolic import (Add, Pow, exp, sqrt, symbols, sympify, cos, sin,
                            Function, USE_SYMENGINE)

if not USE_SYMENGINE:
    from sympy.simplify.cse_opts import sub_pre, sub_post
    from sympy.functions.special.hyper import meijerg
    from sympy.simplify import cse_opts

from sumpy.cse import (cse, preprocess_for_cse, postprocess_for_cse)

w, x, y, z = symbols("w,x,y,z")
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12 = symbols("x:13")

sympyonly = (pytest.mark.skipif(USE_SYMENGINE,
                                reason="uses a sympy-only feature"))

# Dummy "optimization" functions for testing.


def opt1(expr):
    return expr + y


def opt2(expr):
    return expr * z
Esempio n. 5
0
import pytest
import sys

from sumpy.symbolic import (
    Add, Pow, exp, sqrt, symbols, sympify, cos, sin, Function, USE_SYMENGINE)

if not USE_SYMENGINE:
    from sympy.simplify.cse_opts import sub_pre, sub_post
    from sympy.functions.special.hyper import meijerg
    from sympy.simplify import cse_opts

from sumpy.cse import (
    cse, preprocess_for_cse, postprocess_for_cse)


w, x, y, z = symbols('w,x,y,z')
x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12 = symbols('x:13')

sympyonly = (
    pytest.mark.skipif(USE_SYMENGINE, reason="uses a sympy-only feature"))


# Dummy "optimization" functions for testing.


def opt1(expr):
    return expr + y


def opt2(expr):
    return expr*z