Changeset 623 for branches


Ignore:
Timestamp:
12/26/12 19:53:09 (3 years ago)
Author:
mmckerns
Message:

some cleanup of imports in symbolic; _symbolic.solve now imported to solve

Location:
branches/decorate
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/decorate/_symbolic.py

    r622 r623  
    99# >>> soln = symsol([eq2, eq1], [x1, x2, x3]) 
    1010 
    11 from symbolic import * 
    1211from mystic.tools import permutations 
     12from mystic.tools import list_or_tuple_or_ndarray 
    1313#from wrapper import isbounded 
    1414#from penalty import issolution 
     
    5151        raise NotImplementedError, "cannot classify inequalities"  
    5252 
     53    from symbolic import replace_variables, get_variables 
    5354    #XXX: use solve? or first if not in form xi = ... ? 
    5455    if list_or_tuple_or_ndarray(variables): 
     
    171172        raise NotImplementedError, "cannot simplify inequalities"  
    172173 
     174    from symbolic import replace_variables, get_variables 
    173175    #XXX: if constraints contain x1,x2,x4 for 'x', should x3 be in code,xlist? 
    174176    if list_or_tuple_or_ndarray(variables): 
     
    274276        target = list(target) # not the best for ndarray, but should work 
    275277 
     278    from symbolic import replace_variables, get_variables 
    276279    if list_or_tuple_or_ndarray(variables): 
    277280        if nvars: variables = variables[:nvars] 
     
    439442        target = list(target) # not the best for ndarray, but should work 
    440443 
     444    from symbolic import replace_variables, get_variables 
    441445    if list_or_tuple_or_ndarray(variables): 
    442446        if nvars: variables = variables[:nvars] 
     
    468472    locals = kwds.get('locals', None) 
    469473    if locals is None: locals = {} 
    470     # if sympy not installed, call generate_constraint 
     474    # if sympy not installed, return original constraints 
    471475    try: 
    472476        code = """from sympy import Eq, Symbol;""" 
     
    697701        target = list(target) # not the best for ndarray, but should work 
    698702 
     703    from symbolic import replace_variables, get_variables 
    699704    if list_or_tuple_or_ndarray(variables): 
    700705        if nvars: variables = variables[:nvars] 
  • branches/decorate/symbolic.py

    r620 r623  
    66from __future__ import division 
    77from numpy import ndarray, asarray 
     8from _symbolic import solve 
     9from mystic.tools import list_or_tuple_or_ndarray, flatten 
    810 
    911# XXX: another function for the inverse... symbolic to matrix? (good for scipy) 
     
    8587 
    8688 
    87 from mystic.tools import list_or_tuple_or_ndarray, flatten 
    8889def replace_variables(constraints, variables=None, markers='$'): 
    8990    """Replace variables in constraints string with a marker. 
  • branches/decorate/test_symbolic.py

    r622 r623  
    11from symbolic import * 
    2 from _symbolic import * 
    32from mystic.math import almostEqual 
    43from penalty import as_constraint 
Note: See TracChangeset for help on using the changeset viewer.