From fe4fd66dcec165e2d0a7740890ab5560fe68d318 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 12 Oct 2015 20:58:54 -0400 Subject: [PATCH] Clean up some imports and fix another test failure. --- mjo/all.py | 26 ++++++++++++++------------ mjo/cone/all.py | 16 ++++++++++++++++ mjo/cone/cone.py | 7 ------- mjo/cone/symmetric_psd.py | 8 -------- mjo/symbolic.py | 8 ++++---- 5 files changed, 34 insertions(+), 31 deletions(-) create mode 100644 mjo/cone/all.py diff --git a/mjo/all.py b/mjo/all.py index 580cca5..1a46f59 100644 --- a/mjo/all.py +++ b/mjo/all.py @@ -3,15 +3,17 @@ Import all of the other code, so that the user doesn't have to do it in his script. Instead, he can just `from mjo.all import *`. """ -from cone.cone import * -from cone.completely_positive import * -from cone.doubly_nonnegative import * -from cone.permutation_invariant import * -from cone.rearrangement import * -from cone.symmetric_psd import * -from interpolation import * -from misc import * -from orthogonal_polynomials import * -from plot import * -from symbol_sequence import * -from symbolic import * +# Sage doesn't load ~/.sage/init.sage during testing (sage -t), so we +# have to explicitly mangle our sitedir here so that "mjo.foo" +# resolves. +from os.path import abspath +from site import addsitedir +addsitedir(abspath('../')) + +from mjo.cone.all import * +from mjo.interpolation import * +from mjo.misc import * +from mjo.orthogonal_polynomials import * +from mjo.plot import * +from mjo.symbol_sequence import * +from mjo.symbolic import * diff --git a/mjo/cone/all.py b/mjo/cone/all.py new file mode 100644 index 0000000..c8957a0 --- /dev/null +++ b/mjo/cone/all.py @@ -0,0 +1,16 @@ +""" +All imports from mjo.cone modules. +""" + +# Sage doesn't load ~/.sage/init.sage during testing (sage -t), so we +# have to explicitly mangle our sitedir here so that "mjo.foo" resolves. +from os.path import abspath +from site import addsitedir +addsitedir(abspath('../../')) + +from mjo.cone.cone import * +from mjo.cone.completely_positive import * +from mjo.cone.doubly_nonnegative import * +from mjo.cone.permutation_invariant import * +from mjo.cone.rearrangement import * +from mjo.cone.symmetric_psd import * diff --git a/mjo/cone/cone.py b/mjo/cone/cone.py index 32e1386..49df3e9 100644 --- a/mjo/cone/cone.py +++ b/mjo/cone/cone.py @@ -1,10 +1,3 @@ -# Sage doesn't load ~/.sage/init.sage during testing (sage -t), so we -# have to explicitly mangle our sitedir here so that "mjo.cone" -# resolves. -from os.path import abspath -from site import addsitedir -addsitedir(abspath('../../')) - from sage.all import * def is_lyapunov_like(L,K): diff --git a/mjo/cone/symmetric_psd.py b/mjo/cone/symmetric_psd.py index b3f05f6..e4be629 100644 --- a/mjo/cone/symmetric_psd.py +++ b/mjo/cone/symmetric_psd.py @@ -6,14 +6,6 @@ all symmetric positive-semidefinite matrices (as a subset of from sage.all import * -# Sage doesn't load ~/.sage/init.sage during testing (sage -t), so we -# have to explicitly mangle our sitedir here so that "mjo.symbolic" -# resolves. -from os.path import abspath -from site import addsitedir -addsitedir(abspath('../../')) - - def is_symmetric_psd(A): """ Determine whether or not the matrix ``A`` is symmetric diff --git a/mjo/symbolic.py b/mjo/symbolic.py index e2645a3..992260e 100644 --- a/mjo/symbolic.py +++ b/mjo/symbolic.py @@ -15,15 +15,15 @@ def set_simplification_domain(d): With the default 'complex' domain, we don't simplify this:: - sage: (abs(x)^2).simplify() - abs(x)^2 + sage: sqrt(x^2).simplify() + sqrt(x^2) But in the 'real' domain, we do:: sage: set_simplification_domain('real') 'real' - sage: (abs(x)^2).simplify() - x^2 + sage: sqrt(x^2).simplify() + abs(x) sage: set_simplification_domain('complex') 'complex' -- 2.43.2