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

QuantEcon / QuantEcon.py / 29307752395
94%

Build:
DEFAULT BRANCH: main
Ran 14 Jul 2026 05:12AM UTC
Jobs 1
Files 157
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

14 Jul 2026 05:08AM UTC coverage: 93.725% (+0.08%) from 93.644%
29307752395

push

github

web-flow
FIX: markov: Fix invalid states in simulate, sparse negative init, __str__ (#860)

* FIX: markov: Fix invalid states in simulate, sparse negative init, __str__

- Clamp the result of searchsorted in the sample-path generation
  kernels, so that random values exceeding the last CDF value (from
  row sums slightly below 1, which pass the allclose validation) map
  to the last state instead of an out-of-range index. Closes the
  general case of #591, of which #592 fixed one instance; an
  out-of-range index moreover corrupted the remainder of the path,
  as the subsequent iterations read out-of-bounds memory as CDFs.
  Apply the same clamp to the initial-state draw in mc_sample_path.
- Normalize negative initial states to {0, ..., n-1} in
  simulate_indices: the sparse kernel read out of bounds for
  negative indices (indptr[i]:indptr[i+1] is empty for i = -1),
  producing undefined sample paths.
- Fix __str__, which returned str() of the bound method __repr__
  instead of its result.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add deterministic clamp-target test; document negative-init behavior

- test_simulate_clamp_maps_to_last_state pins where the leftover
  probability mass goes on a CDF overflow, using a seed whose first
  draw exceeds 1 - 1e-5: the last state of positive probability. The
  sparse case is constructed so that the pre-fix bug produced an
  in-range but wrong state (the next row's first index), a failure
  shape the range assertions of test_simulate_deficient_row_sums
  cannot detect.
- Extend the negative-init normalization comment and the
  simulate_indices docstring to state the intentional observable
  behavior: returned paths contain nonnegative indices only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fall back to last positive-probability state; validate mc_sample_path init

Corrections from review:

- The overflow fallback in the sample-path kernels clamped to the last
  position of the row, which... (continued)

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

8304 of 8860 relevant lines covered (93.72%)

0.94 hits per line

Jobs
ID Job ID Ran Files Coverage
1 29307752395.1 14 Jul 2026 05:12AM UTC 157
93.72
GitHub Action Run
Source Files on build 29307752395
  • Tree
  • List 157
  • Changed 3
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #29307752395
  • bc6073e3 on github
  • Prev Build on main (#29307752781)
  • Next Build on main (#29307752988)
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