Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit37c95b6

Browse files
authored
Merge branch 'master' into vector-frd-feedback
2 parents323ae3d +4f681ab commit37c95b6

34 files changed

+258
-667
lines changed

‎.github/workflows/python-package-conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
max-parallel:5
1212
matrix:
13-
python-version:[3.6, 3.9]
13+
python-version:[3.7, 3.9]
1414
slycot:["", "conda"]
1515
array-and-matrix:[0]
1616
include:

‎.travis.yml

Lines changed: 0 additions & 112 deletions
This file was deleted.

‎control/canonical.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
importnumpyasnp
1010

11-
fromnumpyimportzeros,zeros_like,shape,poly,iscomplex,vstack,hstack,dot,\
11+
fromnumpyimportzeros,zeros_like,shape,poly,iscomplex,vstack,hstack, \
1212
transpose,empty,finfo,float64
1313
fromnumpy.linalgimportsolve,matrix_rank,eig
1414

@@ -149,7 +149,7 @@ def observable_form(xsys):
149149
raiseValueError("Transformation matrix singular to working precision.")
150150

151151
# Finally, compute the output matrix
152-
zsys.B=Tzx.dot(xsys.B)
152+
zsys.B=Tzx @xsys.B
153153

154154
returnzsys,Tzx
155155

@@ -189,13 +189,13 @@ def rsolve(M, y):
189189

190190
# Update the system matrices
191191
ifnotinverse:
192-
zsys.A=rsolve(T,dot(T,zsys.A))/timescale
193-
zsys.B=dot(T,zsys.B)/timescale
192+
zsys.A=rsolve(T,T @zsys.A)/timescale
193+
zsys.B=T @zsys.B/timescale
194194
zsys.C=rsolve(T,zsys.C)
195195
else:
196-
zsys.A=solve(T,zsys.A).dot(T)/timescale
196+
zsys.A=solve(T,zsys.A) @T/timescale
197197
zsys.B=solve(T,zsys.B)/timescale
198-
zsys.C=zsys.C.dot(T)
198+
zsys.C=zsys.C @T
199199

200200
returnzsys
201201

@@ -405,8 +405,8 @@ def bdschur(a, condmax=None, sort=None):
405405
permidx=np.hstack([blkidxs[i]foriinsortidx])
406406
rperm=np.eye(amodal.shape[0])[permidx]
407407

408-
tmodal=tmodal.dot(rperm)
409-
amodal=rperm.dot(amodal).dot(rperm.T)
408+
tmodal=tmodal @rperm
409+
amodal=rperm @amodal @rperm.T
410410
blksizes=blksizes[sortidx]
411411

412412
elifsortisNone:

‎control/delay.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#
4343
# $Id$
4444

45-
from __future__importdivision
4645

4746
__all__= ['pade']
4847

‎control/flatsys/flatsys.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@ def traj_const(null_coeffs):
462462
fortype,fun,lb,ubintraj_constraints:
463463
iftype==sp.optimize.LinearConstraint:
464464
# `fun` is A matrix associated with polytope...
465-
values.append(
466-
np.dot(fun,np.hstack([states,inputs])))
465+
values.append(fun @np.hstack([states,inputs]))
467466
eliftype==sp.optimize.NonlinearConstraint:
468467
values.append(fun(states,inputs))
469468
else:

‎control/flatsys/linflat.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __init__(self, linsys, inputs=None, outputs=None, states=None,
110110

111111
# Compute the flat output variable z = C x
112112
Cfz=np.zeros(np.shape(linsys.C));Cfz[0,0]=1
113-
self.Cf=np.dot(Cfz,Tr)
113+
self.Cf=Cfz @Tr
114114

115115
# Compute the flat flag from the state (and input)
116116
defforward(self,x,u):
@@ -122,11 +122,11 @@ def forward(self, x, u):
122122
x=np.reshape(x, (-1,1))
123123
u=np.reshape(u, (1,-1))
124124
zflag= [np.zeros(self.nstates+1)]
125-
zflag[0][0]=np.dot(self.Cf,x)
125+
zflag[0][0]=self.Cf @x
126126
H=self.Cf# initial state transformation
127127
foriinrange(1,self.nstates+1):
128-
zflag[0][i]=np.dot(H,np.dot(self.A,x)+np.dot(self.B,u))
129-
H=np.dot(H,self.A)# derivative for next iteration
128+
zflag[0][i]=H @(self.A @x+self.B @u)
129+
H=H @self.A# derivative for next iteration
130130
returnzflag
131131

132132
# Compute state and input from flat flag
@@ -137,6 +137,6 @@ def reverse(self, zflag):
137137
138138
"""
139139
z=zflag[0][0:-1]
140-
x=np.dot(self.Tinv,z)
141-
u=zflag[0][-1]-np.dot(self.F,z)
140+
x=self.Tinv @z
141+
u=zflag[0][-1]-self.F @z
142142
returnnp.reshape(x,self.nstates),np.reshape(u,self.ninputs)

‎control/frdata.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
# Author: M.M. (Rene) van Paassen (using xferfcn.py as basis)
3636
# Date: 02 Oct 12
3737

38-
from __future__importdivision
3938

4039
"""
4140
Frequency response data representation and functions.
@@ -48,7 +47,7 @@
4847
fromwarningsimportwarn
4948
importnumpyasnp
5049
fromnumpyimportangle,array,empty,ones, \
51-
real,imag,absolute,eye,linalg,where,dot,sort
50+
real,imag,absolute,eye,linalg,where,sort
5251
fromscipy.interpolateimportsplprep,splev
5352
from .ltiimportLTI,_process_frequency_response
5453
from .importconfig
@@ -302,7 +301,7 @@ def __mul__(self, other):
302301
fresp=empty((outputs,inputs,len(self.omega)),
303302
dtype=self.fresp.dtype)
304303
foriinrange(len(self.omega)):
305-
fresp[:, :,i]=dot(self.fresp[:, :,i],other.fresp[:, :,i])
304+
fresp[:, :,i]=self.fresp[:, :,i] @other.fresp[:, :,i]
306305
returnFRD(fresp,self.omega,
307306
smooth=(self.ifuncisnotNone)and
308307
(other.ifuncisnotNone))
@@ -330,7 +329,7 @@ def __rmul__(self, other):
330329
fresp=empty((outputs,inputs,len(self.omega)),
331330
dtype=self.fresp.dtype)
332331
foriinrange(len(self.omega)):
333-
fresp[:, :,i]=dot(other.fresp[:, :,i],self.fresp[:, :,i])
332+
fresp[:, :,i]=other.fresp[:, :,i] @self.fresp[:, :,i]
334333
returnFRD(fresp,self.omega,
335334
smooth=(self.ifuncisnotNone)and
336335
(other.ifuncisnotNone))
@@ -538,6 +537,7 @@ def feedback(self, other=1, sign=-1):
538537
"FRD.feedback, inputs/outputs mismatch")
539538

540539
# TODO: handle omega re-mapping
540+
541541
# reorder array axes in order to leverage numpy broadcasting
542542
myfresp=np.moveaxis(self.fresp,2,0)
543543
otherfresp=np.moveaxis(other.fresp,2,0)

‎control/iosys.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -843,14 +843,14 @@ def _update_params(self, params={}, warning=True):
843843

844844
def_rhs(self,t,x,u):
845845
# Convert input to column vector and then change output to 1D array
846-
xdot=np.dot(self.A,np.reshape(x, (-1,1))) \
847-
+np.dot(self.B,np.reshape(u, (-1,1)))
846+
xdot=self.A @np.reshape(x, (-1,1)) \
847+
+self.B @np.reshape(u, (-1,1))
848848
returnnp.array(xdot).reshape((-1,))
849849

850850
def_out(self,t,x,u):
851851
# Convert input to column vector and then change output to 1D array
852-
y=np.dot(self.C,np.reshape(x, (-1,1))) \
853-
+np.dot(self.D,np.reshape(u, (-1,1)))
852+
y=self.C @np.reshape(x, (-1,1)) \
853+
+self.D @np.reshape(u, (-1,1))
854854
returnnp.array(y).reshape((-1,))
855855

856856

@@ -1197,7 +1197,7 @@ def _out(self, t, x, u):
11971197
ulist,ylist=self._compute_static_io(t,x,u)
11981198

11991199
# Make the full set of subsystem outputs to system output
1200-
returnnp.dot(self.output_map,ylist)
1200+
returnself.output_map @ylist
12011201

12021202
def_compute_static_io(self,t,x,u):
12031203
# Figure out the total number of inputs and outputs
@@ -1239,7 +1239,7 @@ def _compute_static_io(self, t, x, u):
12391239
output_index+=sys.noutputs
12401240

12411241
# Compute inputs based on connection map
1242-
new_ulist=np.dot(self.connect_map,ylist[:noutputs]) \
1242+
new_ulist=self.connect_map @ylist[:noutputs] \
12431243
+np.dot(self.input_map,u)
12441244

12451245
# Check to see if any of the inputs changed

‎control/margins.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
margins.margin
1010
"""
1111

12-
# Python 3 compatibility (needs to go here)
13-
from __future__importprint_function
14-
1512
"""Copyright (c) 2011 by California Institute of Technology
1613
All rights reserved.
1714

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp