pytmpinv 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pytmpinv might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytmpinv
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Tabular Matrix Problems via Pseudoinverse Estimation
5
5
  Author-email: The Economist <29724411+econcz@users.noreply.github.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pytmpinv"
3
- version = "1.0.1"
3
+ version = "1.0.2"
4
4
  description = "Tabular Matrix Problems via Pseudoinverse Estimation"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytmpinv
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: Tabular Matrix Problems via Pseudoinverse Estimation
5
5
  Author-email: The Economist <29724411+econcz@users.noreply.github.com>
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
- __version__ = "1.0.1"
1
+ __version__ = "1.0.2"
2
2
 
3
3
  from .tmpinv import tmpinv
4
4
 
@@ -148,7 +148,7 @@ def TMPinvSolve(
148
148
  S = np.asarray(S, dtype=np.float64)
149
149
  if (not np.all((S == -1) | (S == 0) | (S == 1)) or
150
150
  np.abs(S).sum(axis=0).max() > 1 or
151
- np.abs(S).sum(axis=0).max() > 1):
151
+ np.abs(S).sum(axis=1).max() > 1):
152
152
  raise TMPinvInputError("S must be a zero-padded subset of ±I.")
153
153
  if M is not None:
154
154
  M = np.asarray(M, dtype=np.float64)
@@ -287,20 +287,20 @@ def tmpinv(
287
287
  "allowed in tabular matrix programs.")
288
288
 
289
289
  # (result) Perform bound-constrained iterative refinement
290
+ kw = {k: v for k, v in kwargs.items() if k not in {"M", "b_val"}}
290
291
  for _ in range(iteration_limit):
291
292
  M_idx, b_val = [], []
292
293
  x = result.x.reshape(-1, 1)
293
294
  for i, (v, (l, h)) in enumerate(zip(x, bounds)):
295
+ v = float(v.item())
294
296
  if ((l is not None and v < l - tolerance) or \
295
297
  (h is not None and v > h + tolerance)):
296
298
  continue # skip out-of-bounds
297
299
  M_idx.append(i)
298
- b_val.append(float(v.item()))
300
+ b_val.append(v)
299
301
  if len(M_idx) < n_cells:
300
302
  M = np.eye(n_cells, dtype=np.float64)[M_idx]
301
- result = TMPinvSolve(M=M, b_val=b_val,
302
- *args, **{k: v for k, v in kwargs.items()
303
- if k not in {"M", "b_val"}})
303
+ result = TMPinvSolve(M=M, b_val=b_val, *args, **kw)
304
304
  else:
305
305
  break
306
306
 
File without changes
File without changes
File without changes