Skip to content

Commit 363a670

Browse files
committed
Updating code style, removing redundant typehints
1 parent bc5f7fe commit 363a670

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pydmd/varprodmd.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ class _OptimizeHelper: # pylint: disable=too-few-public-methods
8484

8585
__slots__ = ["phi", "phi_inv", "u_svd", "s_inv", "v_svd", "b_matrix", "rho"]
8686

87-
def __init__(self, l_in: int, m_in: int, n_in: int) -> None:
88-
self.phi: np.ndarray = np.empty((m_in, l_in), dtype=np.complex128)
89-
self.u_svd: np.ndarray = np.empty((m_in, l_in), dtype=np.complex128)
90-
self.s_inv: np.ndarray = np.empty((l_in,), dtype=np.complex128)
91-
self.v_svd: np.ndarray = np.empty((l_in, l_in), dtype=np.complex128)
92-
self.b_matrix: np.ndarray = np.empty((l_in, n_in), dtype=np.complex128)
93-
self.rho: np.ndarray = np.empty((m_in, n_in), dtype=np.complex128)
87+
def __init__(self, l_in: int, m_in: int, n_in: int):
88+
self.phi = np.empty((m_in, l_in), dtype=np.complex128)
89+
self.u_svd = np.empty((m_in, l_in), dtype=np.complex128)
90+
self.s_inv = np.empty((l_in,), dtype=np.complex128)
91+
self.v_svd = np.empty((l_in, l_in), dtype=np.complex128)
92+
self.b_matrix = np.empty((l_in, n_in), dtype=np.complex128)
93+
self.rho = np.empty((m_in, n_in), dtype=np.complex128)
9494

9595

9696
def _compute_dmd_rho(
@@ -121,11 +121,11 @@ def _compute_dmd_rho(
121121
:rtype: np.ndarray
122122
"""
123123

124-
__alphas = np.zeros((alphas.shape[-1] // 2,), dtype=np.complex128)
125-
__alphas.real = alphas[: alphas.shape[-1] // 2]
126-
__alphas.imag = alphas[alphas.shape[-1] // 2 :]
124+
_alphas = np.zeros((alphas.shape[-1] // 2,), dtype=np.complex128)
125+
_alphas.real = alphas[: alphas.shape[-1] // 2]
126+
_alphas.imag = alphas[alphas.shape[-1] // 2 :]
127127

128-
phi = np.exp(np.outer(time, __alphas))
128+
phi = np.exp(np.outer(time, _alphas))
129129
u_phi, s_phi, v_phi_t = np.linalg.svd(phi, full_matrices=False)
130130
idx = np.where(s_phi.real != 0.0)[0]
131131
s_phi_inv = np.zeros_like(s_phi)
@@ -180,12 +180,12 @@ def _compute_dmd_jac(
180180
:rtype: np.ndarray
181181
"""
182182

183-
__alphas = np.zeros((alphas.shape[-1] // 2,), dtype=np.complex128)
184-
__alphas.real = alphas[: alphas.shape[-1] // 2]
185-
__alphas.imag = alphas[alphas.shape[-1] // 2 :]
183+
_alphas = np.zeros((alphas.shape[-1] // 2,), dtype=np.complex128)
184+
_alphas.real = alphas[: alphas.shape[-1] // 2]
185+
_alphas.imag = alphas[alphas.shape[-1] // 2 :]
186186
jac_out = np.zeros((2 * np.prod(data.shape), alphas.shape[-1]))
187187

188-
for j in range(__alphas.shape[-1]):
188+
for j in range(_alphas.shape[-1]):
189189
d_phi_j = time * opthelper.phi[:, j]
190190
outer = np.outer(d_phi_j, opthelper.b_matrix[j])
191191
a_j = outer - np.linalg.multi_dot(
@@ -195,7 +195,7 @@ def _compute_dmd_jac(
195195
[
196196
opthelper.u_svd * opthelper.s_inv[None],
197197
np.outer(
198-
opthelper.v_svd[j, :].conj(), d_phi_j.conj() @ opthelper.rho
198+
opthelper.v_svd[j].conj(), d_phi_j.conj() @ opthelper.rho
199199
),
200200
]
201201
)

0 commit comments

Comments
 (0)