Skip to content

Increase the usage of augmented assignment statements #18

Description

@elfring

👀 Some source code analysis tools can help to find opportunities for improving software components.
💭 I propose to increase the usage of augmented assignment statements accordingly.

diff --git a/PythonLinearNonlinearControl/controllers/mpc.py b/PythonLinearNonlinearControl/controllers/mpc.py
index c1e0db3..7f8c001 100644
--- a/PythonLinearNonlinearControl/controllers/mpc.py+++ b/PythonLinearNonlinearControl/controllers/mpc.py@@ -167,7 +167,7 @@ class LinearMPC(Controller):
H = np.matmul(self.theta_mat.T, np.matmul(self.Qs, self.theta_mat)) \
+ self.Rs
- H = H * 0.5+ H *= 0.5
# constraints
A = []
diff --git a/PythonLinearNonlinearControl/controllers/nmpc_cgmres.py b/PythonLinearNonlinearControl/controllers/nmpc_cgmres.py
index 70e722b..74432af 100644
--- a/PythonLinearNonlinearControl/controllers/nmpc_cgmres.py+++ b/PythonLinearNonlinearControl/controllers/nmpc_cgmres.py@@ -126,7 +126,7 @@ class NMPCCGMRES(Controller):
for j in range(i + 1):
hs[j, i] = np.dot(Av, vs[:, j])
- sum_Av = sum_Av + hs[j, i] * vs[:, j]+ sum_Av += hs[j, i] * vs[:, j]
v_est = Av - sum_Av

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions