• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

QuantEcon / QuantEcon.py / 28773049436
94%

Build:
DEFAULT BRANCH: main
Ran 06 Jul 2026 06:48AM UTC
Jobs 1
Files 156
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

06 Jul 2026 06:44AM UTC coverage: 93.561% (+0.5%) from 93.053%
28773049436

push

github

web-flow
BUG: Fix DLE.compute_sequence under NumPy >= 2.4 (#839) (#842)

* BUG: Fix DLE.compute_sequence under NumPy >= 2.4 (#839)

The asset-price terms in `DLE.compute_sequence` (`R1_Price`, `R2_Price`,
`R5_Price`, and the optional `Pay_Price` / `Pay_Gross`) each evaluate to a
size-1 array rather than a Python scalar: `self.beta` is a (1, 1) array and
`e1` is a row vector, so the matmul chain reduces to shape (1,) or (1, 1).

Assigning such an array into a scalar slot used to work because NumPy
silently converted a size-1 `ndim > 0` array to a scalar. That conversion
was deprecated in NumPy 1.25 and became a hard error in NumPy 2.4, so the
assignments now raise `ValueError: setting an array element with a sequence`
(underlying `TypeError: only 0-dimensional arrays can be converted to Python
scalars`). NumPy 2.3.x still works, which is why this is a 2.3 -> 2.4
regression.

Coerce each price expression to a scalar with `.item()` before assignment.
This works regardless of the intermediate shape (unlike redefining `e1` as
1-D, which is insufficient because `self.beta` is itself a (1, 1) array) and
reproduces the pre-2.4 values exactly. Also covers the `Pay` branch, which
has the same size-1 assignment pattern.

Adds regression tests for both the default and `Pay` paths of
compute_sequence, which previously had no coverage.

Fixes #839

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* PERF: Hoist loop-invariant terms in DLE price loop (#842)

Per Copilot review: precompute `e1 @ self.Mc` and the matrix powers of
`self.A0` once (they do not depend on `i`), and compute the denominator
`e1 @ self.Mc @ xp[:, i]` once per iteration instead of three times. The
results are bit-identical to the previous code (verified on a fixed
trajectory); the change avoids redundant work and clarifies intent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* BUG: Preserve inf/nan on zero denominator in DLE price loop

Move ``.item()`` outside the division in the R... (continued)

32 of 32 new or added lines in 2 files covered. (100.0%)

8093 of 8650 relevant lines covered (93.56%)

0.94 hits per line

Jobs
ID Job ID Ran Files Coverage
1 28773049436.1 06 Jul 2026 06:48AM UTC 156
93.56
GitHub Action Run
Source Files on build 28773049436
  • Tree
  • List 156
  • Changed 3
  • Source Changed 2
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #28773049436
  • 018b4124 on github
  • Prev Build on main (#28773031584)
  • Next Build on main (#28773098921)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc