{"record":{"id":"e7303343e61beceb","repo":"jax-ml/jax","slug":"eigh-tridiagonal-select-v-is-not-implement","errorCode":null,"errorMessage":"eigh_tridiagonal(..., select='v') is not implemented","messagePattern":"eigh_tridiagonal\\(\\.\\.\\., select='v'\\) is not implemented","errorType":"validation","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"jax/_src/scipy/linalg.py","lineNumber":1841,"sourceCode":"  # In the worst case, when the absolute tolerance is eps*lambda_est_max and\n  # lambda_est_max = -lambda_est_min, we have to take as many bisection steps\n  # as there are bits in the mantissa plus 1.\n  # The proof is left as an exercise to the reader.\n  max_it = finfo.nmant + 1\n\n  # Determine the indices of the desired eigenvalues, based on select and\n  # select_range.\n  if select == 'a':\n    target_counts = jnp.arange(n, dtype=np.int32)\n  elif select == 'i':\n    if select_range is None:\n      raise ValueError(\"for select='i', select_range must be specified.\")\n    if select_range[0] > select_range[1]:\n      raise ValueError('Got empty index range in select_range.')\n    target_counts = jnp.arange(select_range[0], select_range[1] + 1, dtype=np.int32)\n  elif select == 'v':\n    # TODO(phawkins): requires dynamic shape support.\n    raise NotImplementedError(\"eigh_tridiagonal(..., select='v') is not \"\n                              \"implemented\")\n  else:\n    raise ValueError(\"'select must have a value in {'a', 'i', 'v'}.\")\n\n  # Run binary search for all desired eigenvalues in parallel, starting from\n  # the interval lightly wider than the estimated\n  # [lambda_est_min, lambda_est_max].\n  fudge = 2.1  # We widen starting interval the Gershgorin interval a bit.\n  norm_slack = jnp.array(n, alpha.dtype) * fudge * finfo.eps * t_norm\n  lower = lambda_est_min - norm_slack - 2 * fudge * pivmin\n  upper = lambda_est_max + norm_slack + fudge * pivmin\n\n  # Pre-broadcast the scalars used in the Sturm sequence for improved\n  # performance.\n  target_shape = np.shape(target_counts)\n  lower = jnp.broadcast_to(lower, shape=target_shape)\n  upper = jnp.broadcast_to(upper, shape=target_shape)\n  mid = 0.5 * (upper + lower)","sourceCodeStart":1823,"sourceCodeEnd":1859,"githubUrl":"https://github.com/jax-ml/jax/blob/1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb/jax/_src/scipy/linalg.py#L1823-L1859","documentation":"jax.scipy.linalg.eigh_tridiagonal does not support select='v' (computing eigenvalues/eigenvectors in a half-open value interval). JAX's implementation relies on static shapes and a bisection counting scheme that needs the count known at trace time, so selecting by value range would require dynamic shape support (per the TODO in the source). Any call with select='v' raises NotImplementedError immediately.","triggerScenarios":"Calling eigh_tridiagonal(d, e, select='v', select_range=(lo, hi)); note select='a' (all) and select='i' (index range) work, only the value-range mode fails.","commonSituations":"Porting SciPy code that uses scipy.linalg.eigh_tridiagonal(..., select='v') for computing spectrum slices of large tridiagonal Hamiltonians (quantum physics, edge-state computations) to JAX.","solutions":["Use select='i' with an index range instead: compute all eigenvalues once (select='a') and map value thresholds to indices, since JAX returns sorted eigenvalues","Use select='a' and post-filter with boolean masks: w, v = eigh_tridiagonal(d, e); mask = (w >= lo) & (w < hi)","Fall back to numpy/scipy for this operation (e.g. via host callback or plain scipy outside jit)","File/star the upstream issue about dynamic shape support (TODO(phawkins))"],"exampleFix":"# before\nw, v = eigh_tridiagonal(d, e, select='v', select_range=(lo, hi))\n# after\nw, v = eigh_tridiagonal(d, e, eigvals_only=False)  # select='a'\nmask = (w >= lo) & (w < hi)\nw, v = w[mask], v[:, mask]","handlingStrategy":"fallback","validationCode":"# No pre-call validation possible (it's an unimplemented feature); check upfront:\ndef has_value_select(): return False  # JAX eigh_tridiagonal select='v'\nif select == 'v':\n    w, v = eigh_tridiagonal(d, e)\n    mask = (w >= lo) & (w < hi)\n    w, v = w[mask], v[:, mask]","typeGuard":null,"tryCatchPattern":"try:\n    w, v = eigh_tridiagonal(d, e, select='v', select_range=(lo, hi))\nexcept NotImplementedError:\n    w, v = eigh_tridiagonal(d, e)\n    m = (w >= lo) & (w < hi); w, v = w[m], v[:, m]","preventionTips":["Check JAX release notes for API gaps before porting SciPy signal/eigen routines","Prefer select='a' plus boolean masking for value-range eigenvalue selection in JAX","Wrap SciPy-derived calls in thin adapter functions so unsupported modes degrade gracefully"],"tags":["jax","eigenvalues","not-implemented","linalg"],"backgroundTag":"unsupported-operation-argument","analyzedSha":"1e1c6a8fc06dfcd1247076ec5cae4640cea5d7bb","analyzedAt":"2026-08-27T09:53:25.647Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}