{"record":{"id":"1b3a6fac602ebc38","repo":"jax-ml/jax","slug":"only-the-eigvals-none-case-of-eigh-is-implemented","errorCode":null,"errorMessage":"Only the eigvals=None case of eigh is implemented.","messagePattern":"Only the eigvals=None case of eigh is implemented\\.","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/scipy/linalg.py","lineNumber":403,"sourceCode":"          eigvals: None, type: int) -> Array: ...\n\n@overload\ndef _eigh(a: ArrayLike, b: ArrayLike | None, lower: bool, eigvals_only: Literal[False],\n          eigvals: None, type: int) -> tuple[Array, Array]: ...\n\n@overload\ndef _eigh(a: ArrayLike, b: ArrayLike | None, lower: bool, eigvals_only: bool,\n          eigvals: None, type: int) -> Array | tuple[Array, Array]: ...\n\n@jit(static_argnames=('lower', 'eigvals_only', 'eigvals', 'type'))\ndef _eigh(a: ArrayLike, b: ArrayLike | None, lower: bool, eigvals_only: bool,\n          eigvals: None, type: int) -> Array | tuple[Array, Array]:\n  if b is not None:\n    raise NotImplementedError(\"Only the b=None case of eigh is implemented\")\n  if type != 1:\n    raise NotImplementedError(\"Only the type=1 case of eigh is implemented.\")\n  if eigvals is not None:\n    raise NotImplementedError(\n        \"Only the eigvals=None case of eigh is implemented.\")\n\n  a, = promote_dtypes_inexact(jnp.asarray(a))\n  v, w = lax_linalg.eigh(a, lower=lower)\n\n  if eigvals_only:\n    return w\n  else:\n    return w, v\n\n@overload\ndef eigh(a: ArrayLike, b: ArrayLike | None = None, lower: bool = True,\n         eigvals_only: Literal[False] = False, overwrite_a: bool = False,\n         overwrite_b: bool = False, turbo: bool = True, eigvals: None = None,\n         type: int = 1, check_finite: bool = True) -> tuple[Array, Array]: ...\n\n@overload\ndef eigh(a: ArrayLike, b: ArrayLike | None = None, lower: bool = True, *,","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/scipy/linalg.py#L385-L421","documentation":"jax.scipy.linalg.eigh does not support the eigvals subset parameter; only eigvals=None (all eigenvalues) is implemented. SciPy uses eigvals=(lo, hi) to return a range of eigenvalues/eigenvectors, which requires dynamic-shape support JAX lacks.","triggerScenarios":"Calling jax.scipy.linalg.eigh(a, eigvals=(0, 2)) or any non-None eigvals tuple.","commonSituations":"Porting SciPy spectral code (e.g. computing only lowest-k eigenpairs for dimensionality reduction or graph Laplacians) to JAX and passing the SciPy-style eigvals argument.","solutions":["Compute all eigenpairs, then slice: w, v = eigh(a); w = w[:k]; v = v[:, :k]","Use an iterative method better suited to partial spectra, e.g. JAX implementations of Lanczos/LOBPCG (jax.scipy.sparse.linalg.lobpcg)","Call scipy.linalg.eigh host-side outside jit if GPU execution is unnecessary"],"exampleFix":"// before\nw, v = jax.scipy.linalg.eigh(a, eigvals=(0, 2))\n// after\nw, v = jax.scipy.linalg.eigh(a)\nw, v = w[:3], v[:, :3]","handlingStrategy":"validation","validationCode":"assert eigvals is None, 'jax eigh does not support eigvals; slice results instead'","typeGuard":"null","tryCatchPattern":null,"preventionTips":["Compute full spectra then slice; it is the JAX-idiomatic pattern","Use lobpcg for large sparse lowest-k problems"],"tags":["jax","linalg","eigenvalue","not-implemented"],"backgroundTag":"unsupported-parameter-value","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}