pytmpinv 2.6.0__tar.gz → 3.0.0__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.
- {pytmpinv-2.6.0/pytmpinv.egg-info → pytmpinv-3.0.0}/PKG-INFO +1 -1
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/pyproject.toml +1 -1
- {pytmpinv-2.6.0 → pytmpinv-3.0.0/pytmpinv.egg-info}/PKG-INFO +1 -1
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/tmpinv/__init__.py +1 -1
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/tmpinv/tmpinv.py +17 -21
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/LICENSE +0 -0
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/README.md +0 -0
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/pytmpinv.egg-info/SOURCES.txt +0 -0
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/pytmpinv.egg-info/dependency_links.txt +0 -0
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/pytmpinv.egg-info/requires.txt +0 -0
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/pytmpinv.egg-info/top_level.txt +0 -0
- {pytmpinv-2.6.0 → pytmpinv-3.0.0}/setup.cfg +0 -0
|
@@ -212,7 +212,7 @@ def TMPinvSolve(
|
|
|
212
212
|
"m", "p",
|
|
213
213
|
"i", "j",
|
|
214
214
|
"zero_diagonal",
|
|
215
|
-
"symmetric"}}
|
|
215
|
+
"symmetric", "bounds"}}
|
|
216
216
|
|
|
217
217
|
# perform full estimation and return the result
|
|
218
218
|
if reduced is None:
|
|
@@ -269,24 +269,18 @@ def TMPinvSolve(
|
|
|
269
269
|
X_true = np.full((1*m, p), np.nan, dtype=np.float64)
|
|
270
270
|
for idx, row in enumerate(M):
|
|
271
271
|
col = np.argmax(row)
|
|
272
|
-
r, c = col
|
|
273
|
-
X_true[r, c] = b_val.ravel(order='
|
|
274
|
-
if kwargs.get("
|
|
272
|
+
r, c = divmod(col, p) # M has m * p columns
|
|
273
|
+
X_true[r, c] = b_val.ravel(order='C')[idx]
|
|
274
|
+
if kwargs.get("bounds") is not None:
|
|
275
275
|
X_lim = np.full((2*m, p), np.nan, dtype=np.float64)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
r, c =
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
for idx, row in enumerate(kwargs["C_lim"][l_idx:,:]):
|
|
285
|
-
col = np.argmax(row)
|
|
286
|
-
r, c = col % m, col // m
|
|
287
|
-
X_lim[m+r, c] = kwargs["b_lim"].ravel(order='F')[l_idx+idx]
|
|
288
|
-
if S is not None and np.any(S[: S.shape[0] if kwargs.get("b_lim")
|
|
289
|
-
is None else -kwargs["b_lim"].shape[0],:] != 0):
|
|
276
|
+
for flat_idx, (l, h) in enumerate(kwargs.get("bounds")):
|
|
277
|
+
r, c = divmod(flat_idx, p)
|
|
278
|
+
if h is not None: # upper bounds
|
|
279
|
+
X_lim[ r, c] = float(h)
|
|
280
|
+
if l is not None: # lower bounds
|
|
281
|
+
X_lim[m+r, c] = float(l)
|
|
282
|
+
|
|
283
|
+
if S is not None and np.size(S) > 0:
|
|
290
284
|
warnings.warn("User-provided S is ignored in the reduced model.",
|
|
291
285
|
UserWarning)
|
|
292
286
|
|
|
@@ -302,11 +296,11 @@ def TMPinvSolve(
|
|
|
302
296
|
b_subset = [b_row[m_start:m_end].reshape(-1, 1),
|
|
303
297
|
b_col[p_start:p_end].reshape(-1, 1)]
|
|
304
298
|
M_subset = None
|
|
305
|
-
if kwargs.get("
|
|
299
|
+
if kwargs.get("bounds") is not None:
|
|
306
300
|
subset = np.vstack([
|
|
307
301
|
X_lim[ m_start: m_end, p_start:p_end],
|
|
308
302
|
X_lim[m+m_start:m+m_end, p_start:p_end]
|
|
309
|
-
]).ravel(order='
|
|
303
|
+
]).ravel(order='C')
|
|
310
304
|
non_empty = ~np.isnan(subset)
|
|
311
305
|
if non_empty.any():
|
|
312
306
|
b_subset.append(subset[non_empty].reshape(-1, 1))
|
|
@@ -329,7 +323,7 @@ def TMPinvSolve(
|
|
|
329
323
|
S_subset = S_subset[:, ~np.all(S_subset == 0, axis=0)]
|
|
330
324
|
if M is not None:
|
|
331
325
|
subset = X_true[m_start:m_end, p_start:p_end].ravel(
|
|
332
|
-
order='
|
|
326
|
+
order='C'
|
|
333
327
|
)
|
|
334
328
|
non_empty = ~np.isnan(subset)
|
|
335
329
|
if non_empty.any():
|
|
@@ -414,6 +408,7 @@ def tmpinv(
|
|
|
414
408
|
# (result) Perform bound-constrained iterative refinement
|
|
415
409
|
kw = {k: v for k, v in kwargs.items() if k not in {"b_lim", "b_val",
|
|
416
410
|
"C_lim", "S", "M"}}
|
|
411
|
+
kw.update({"bounds": bounds})
|
|
417
412
|
b_lim = np.vstack([np.array([h if h is not None else np.inf for l, h
|
|
418
413
|
in bounds]).reshape(-1, 1),
|
|
419
414
|
np.array([l if l is not None else -np.inf for l, h
|
|
@@ -451,6 +446,7 @@ def tmpinv(
|
|
|
451
446
|
break
|
|
452
447
|
else:
|
|
453
448
|
M, b_val = kwargs.get("M"), kwargs.get("b_val")
|
|
449
|
+
|
|
454
450
|
result = TMPinvSolve(*args, b_lim=(b_lim[finite_rows, :]),
|
|
455
451
|
b_val=b_val,
|
|
456
452
|
C_lim=(C_lim[finite_rows, :]),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|