Skip to content

Commit

Permalink
Merge pull request #136 from tinosulzer/remove-alen
Browse files Browse the repository at this point in the history
remove alen from imports
  • Loading branch information
aragilar authored Jun 24, 2022
2 parents 269e149 + 862f076 commit 290334c
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 36 deletions.
6 changes: 3 additions & 3 deletions docs/examples/ddaspk/planarpendulum_ddaspk.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#python 2.7 support
from __future__ import print_function, division

from numpy import (arange, zeros, array, sin, empty, alen)
from numpy import (arange, zeros, array, sin, empty)
from scikits.odes import dae
import pylab

Expand Down Expand Up @@ -69,8 +69,8 @@ def res(self, t, x, xdot, tmp):
- (x[0]**2 + x[1]**2)*x[4] - x[1] * PlanarPendulum.g

problem = PlanarPendulum()
z = empty((1+len(problem.stop_t), alen(problem.z0)), float)
zprime = empty((1+len(problem.stop_t), alen(problem.z0)), float)
z = empty((1+len(problem.stop_t), len(problem.z0)), float)
zprime = empty((1+len(problem.stop_t), len(problem.z0)), float)
algvar = -1

ig = dae('ddaspk', problem.res)
Expand Down
7 changes: 3 additions & 4 deletions docs/examples/doublependulum.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@

#imports
import numpy as np
from numpy import (arange, zeros, array, sin, cos, asarray, sqrt, pi, empty,
alen)
from numpy import (arange, zeros, array, sin, cos, asarray, sqrt, pi, empty)
from scikits.odes.sundials import ida
from scikits.odes import dae
import pylab
Expand Down Expand Up @@ -382,8 +381,8 @@ def main():

#solve the same with ddaspk
if alsoddaspk:
ddaspkz = empty((alen(problem.stop_t), problem.neq), float)
ddaspkzprime = empty((alen(problem.stop_t), problem.neq), float)
ddaspkz = empty((len(problem.stop_t), problem.neq), float)
ddaspkzprime = empty((len(problem.stop_t), problem.neq), float)

problem.set_res(res)
ig = dae('ddaspk', problem.ddaspk_res)
Expand Down
27 changes: 13 additions & 14 deletions ipython_examples/Double Pendulum as DAE with roots.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion scikits/odes/dae.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
__version__ = "$Id$"
__docformat__ = "restructuredtext en"

from numpy import asarray, array, zeros, sin, int32, isscalar, empty, alen
from numpy import asarray, array, zeros, sin, int32, isscalar, empty
from copy import copy
import re, sys

Expand Down
12 changes: 6 additions & 6 deletions scikits/odes/ddaspkint.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
__version__ = "$Id$"
__docformat__ = "restructuredtext en"

from numpy import asarray, array, zeros, sin, int32, isscalar, empty, alen
from numpy import asarray, array, zeros, sin, int32, isscalar, empty
from copy import copy
from .dae import DaeBase
import re, sys
Expand Down Expand Up @@ -386,12 +386,12 @@ def solve(self, tspan, y0, yp0, hook_fn = None):
""" See dae.DaeBase
"""

t_retn = empty([alen(tspan), ], float)
y_retn = empty([alen(tspan), alen(y0)], float)
yp_retn = empty([alen(tspan), alen(y0)], float)
t_retn = empty([len(tspan), ], float)
y_retn = empty([len(tspan), len(y0)], float)
yp_retn = empty([len(tspan), len(y0)], float)

y_ic0_retn = empty(alen(y0), float)
yp_ic0_retn = empty(alen(y0), float)
y_ic0_retn = empty(len(y0), float)
yp_ic0_retn = empty(len(y0), float)
tinit = self.init_step(tspan[0], y0, yp0, y_ic0_retn, yp_ic0_retn)

t_retn[0] = tinit
Expand Down
12 changes: 6 additions & 6 deletions scikits/odes/lsodiint.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def adda(t, y, ml, mu, p, nrowp):
__version__ = "$Id$"
__docformat__ = "restructuredtext en"

from numpy import asarray, array, zeros, sin, int32, isscalar, empty, alen
from numpy import asarray, array, zeros, sin, int32, isscalar, empty
from copy import copy
from .dae import DaeBase
import re, sys
Expand Down Expand Up @@ -289,12 +289,12 @@ def solve(self, tspan, y0, yp0, hook_fn = None):
""" See dae.DaeBase
"""

t_retn = empty([alen(tspan), ], float)
y_retn = empty([alen(tspan), alen(y0)], float)
yp_retn = empty([alen(tspan), alen(y0)], float)
t_retn = empty([len(tspan), ], float)
y_retn = empty([len(tspan), len(y0)], float)
yp_retn = empty([len(tspan), len(y0)], float)

y_ic0_retn = empty(alen(y0), float)
yp_ic0_retn = empty(alen(y0), float)
y_ic0_retn = empty(len(y0), float)
yp_ic0_retn = empty(len(y0), float)
tinit = self.init_step(tspan[0], y0, yp0, y_ic0_retn, yp_ic0_retn)

t_retn[0] = tinit
Expand Down
2 changes: 1 addition & 1 deletion scikits/odes/tests/test_on_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

from numpy import (arange, zeros, array, dot, sqrt, cos, sin, allclose,
empty, alen)
empty)

from numpy.testing import TestCase, run_module_suite

Expand Down
2 changes: 1 addition & 1 deletion scikits/odes/tests/test_on_funcs_ida.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import numpy as np

from numpy import (arange, zeros, array, dot, sqrt, cos, sin, allclose,
empty, alen)
empty)

from numpy.testing import TestCase, run_module_suite

Expand Down

0 comments on commit 290334c

Please sign in to comment.