code: def _rayleigh_ritz_orth(A, S):
      """Solve the Rayleigh-Ritz problem for `A` projected to `S`.
  
      Solves the local eigenproblem for `A` within the subspace `S`, which is
      assumed to be orthonormal (with zero columns allowed), identifying `w, V`
      satisfying
  
      (1) `S.T A S V ~= diag(w) V`
      (2) `V` is standard orthonormal
  
      Note that (2) is simplified to be standard orthonormal because `S` is.
  
      Args:
        A: An operator representing the action of an `n`-sized square matrix.
        S: An orthonormal subspace of R^n represented by an `(n, k)` array, with
           zero columns allowed.
  
      Returns:
        Eigenvectors `V` and eigenvalues `w` satisfying the size-`k` system
        described in this method doc. Note `V` will be full rank, even if `S` isn't.
      """
  
      SAS = _mm(S.T, A(S))
  
      # Solve the projected subsystem.
      # If we could tell to eigh to stop after first k, we would.
      return _eigh_ascending(SAS)
  
imports: from __future__ import annotations
  from typing import Union, Callable
  import functools
  import jax
  import jax.numpy
  from jax.experimental import sparse
  from jax.interpreters import mlir
  from jax.interpreters import xla
  from jax._src import core
  from jax._src.interpreters import ad
  from jax._src.lib import gpu_solver
  import numpy
  from scipy.sparse import csr_matrix, linalg
label_desc: Use image node_id 11 for calling a global function with example usage: _rayleigh_ritz_orth(A, S) and returns: _eigh_ascending