T_SFLU¶
wield.control.SFLU.test.T_SFLU
This is a pytest module needing documentation
Functions
Setup 2-node problem, nodes a and b with edges Eaa, Eab, Eba, Ebb. |
|
|
This is a pytest needing documentation |
Details
- T_SFLU_pre1()[source][github]¶
Setup 2-node problem, nodes a and b with edges Eaa, Eab, Eba, Ebb.
code
docstring
""" Setup 2-node problem, nodes a and b with edges Eaa, Eab, Eba, Ebb. """
1def T_SFLU_pre1(): 2 3 4 edges = { 5 ("a", "a_in"): 1, 6 ("a_out", "a"): 1, 7 ("a", "a"): "Eaa", 8 ("b", "a"): "Eba", 9 ("a", "b"): "Eab", 10 ("b", "b"): "Ebb", 11 } 12 sflu = SFLU.SFLU(edges) 13 14 print("-----------------------") 15 dprint(sflu.edges) 16 sflu.reduce("a") 17 print("-----------------------") 18 dprint(sflu.edges) 19 dprint(sflu.row2) 20 dprint(sflu.col2) 21 sflu.reduce("b") 22 print("-----------------------") 23 dprint(sflu.edges) 24 dprint(sflu.row2) 25 dprint(sflu.col2) 26 print("-----------------------oplist") 27 dprint(sflu.oplistE) 28 dprint(sflu.subinverse("a_out", "a_in")) 29 30 return
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.SFLU.test.T_SFLU.T_SFLU_pre1The full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.T_SFLU_pre1
output
----------------------- ----------------------- Captured stderr call {{a<a_in}: 1, {a_out<a}: 1, {a<a}: 'Eaa', {b<a}: 'Eba', {a<b}: 'Eab', {b<b}: 'Ebb'} {{b<b}: Op(op='add', args=(Op(op='mul', args=('Eba', Op(op='invert', args='Eaa'), 'Eab')), 'Ebb')), ('U.a', 'L.a'): Op(op='invert', args='Eaa'), ('b', 'L.a'): Op(op='mul', args=('Eba', Op(op='invert', args='Eaa'))), ('U.a', 'b'): Op(op='mul', args=(Op(op='invert', args='Eaa'), 'Eab')), ('a_out', 'U.a'): 1, ('L.a', 'a_in'): 1} captured errors: def T_SFLU_pre1(): """ Setup 2-node problem, nodes a and b with edges Eaa, Eab, Eba, Ebb. """ edges = { ("a", "a_in"): 1, ("a_out", "a"): 1, ("a", "a"): "Eaa", ("b", "a"): "Eba", ("a", "b"): "Eab", ("b", "b"): "Ebb", } sflu = SFLU.SFLU(edges) print("-----------------------") dprint(sflu.edges) sflu.reduce("a") print("-----------------------") dprint(sflu.edges) > dprint(sflu.row2) E AttributeError: 'SFLU' object has no attribute 'row2' ../../src/wield/control/SFLU/test/T_SFLU.py:48: AttributeError
- T_sympy()[source][github]¶
This is a pytest needing documentation
code
1def T_sympy(): 2 x = sympy.Symbol("x", commutative=False) 3 y = sympy.Symbol("y", commutative=False) 4 5 def symbols(): 6 i = 0 7 while True: 8 yield sympy.Symbol("S_{}".format(i), commutative=False) 9 i += 1 10 11 E = x * y ** 2 - (y ** -2 * x) ** -2 12 dprint(E) 13 subexprs, cse_expr = sympy.cse(E, symbols=symbols()) 14 15 def transform(ex): 16 return re.sub(r"([^*])\*([^*])", r"\1 @ \2", str(ex), count=0) 17 18 for expr in subexprs: 19 print(str(expr[0]), "=", transform(expr[1])) 20 print(transform(cse_expr[0]))
pytest information
This code is wrapped in a pytest function using conventions detailed in Pytest Conventions. The full name of this test, as known by the documentation, is:
wield.control.SFLU.test.T_SFLU.T_sympyThe full name is useful when building documentation, to link a reference to this page using
:func:`name`, or directly include it with an autofunction directive. The collapse nodes below show every instance of the test run. There may only be one, but if the test was run multiple times through pytest parametrizations, the list can be longer.T_sympy
output
S_0 = y**2 x @ S_0 - (S_0**(-1) @ x)**(-2) Captured stderr call x*y**2 - (y**(-2)*x)**(-2)