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

QuantEcon / QuantEcon.py / 44057421778
94%

Build:
DEFAULT BRANCH: main
Ran 17 Nov 2026 09:43AM UTC
Jobs 1
Files 95
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

17 Nov 2026 09:38AM UTC coverage: 94.176% (+0.04%) from 94.141%
44057421778

push

github

web-flow
ENH: Add `arnoldi_solve` (#1008)

* ENH: Add `arnoldi_solve`

Add `quantecon.markov.arnoldi_solve`, which computes a stationary
distribution of a Markov chain by restarted Arnoldi iteration, using
ARPACK through `scipy.sparse.linalg.eigs` on the transpose of the
transition matrix. It is meant for chains whose transition matrix is too
large to densify for `gth_solve`.

The matrix may be dense, a sparse array or matrix, or a `LinearOperator`
implementing `rmatvec`, and is used as given. `tol`, `max_iter`, and
`ncv` default to SciPy's own values. The absolute value of the
eigenvector is normalized, so that the result is a stationary
distribution for a reducible chain too.

Sibling of `QuantEcon.arnoldi_solve` in QuantEcon.jl
(QuantEcon/QuantEcon.jl#415).

Assisted-by: Claude Code (Claude Fable 5.1 and 5.2)

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

* FIX: `arnoldi_solve`: Convert the products of a matrix whose dtype ARPACK rejects

`scipy.sparse.linalg.eigs` upcasts the dtypes that cast safely to float64 (integers, float16) and raises `ValueError` for the others, so a `longdouble` matrix failed where `longdouble` is wider than float64 (x86-64 Linux; it is float64 on Windows and on macOS arm64, where the tests passed). For such a dtype the transpose is now wrapped in a `LinearOperator` that converts each product to float64; the matrix is still not copied.

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

* FIX: `arnoldi_solve`: Reject `float16` matrices that are not stochastic in float64 and check for an empty matrix first

The slack of the eigenvalue check no longer allows for the precision of a `float16` matrix. The matrix is used as given, in float64, where its rows sum to 1 only to about 1e-4, and that defect is amplified by slow mixing: on random 50-state chains with staying probability 0.99 the result was off by 2e-2 from `gth_solve` on the same entries, and a nearly uncoupled example returned `[1/3, 2/3, 0]` where the stati... (continued)

52 of 53 new or added lines in 2 files covered. (98.11%)

5740 of 6095 relevant lines covered (94.18%)

0.94 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
98.08
quantecon/markov/arnoldi_solve.py
Jobs
ID Job ID Ran Files Coverage
1 44057421778.1 17 Nov 2026 09:43AM UTC 95
94.18
GitHub Action Run
Source Files on build 44057421778
  • Tree
  • List 95
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #44057421778
  • be331ddc on github
  • Prev Build on main (#41353402460)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc