qrisp.lanczos.lanczos_expvals#
- lanczos_expvals(H: BlockEncoding | QubitOperator, D: int, operand_prep: Callable[..., Any], mes_kwargs: Dict[str, object] = {}) ArrayLike[source]#
Estimate the expectation values of Chebyshev polynomials \(\langle T_k(H) \rangle_0\) for the exact and efficient Quantum Lanczos method.
This function constructs the Krylov space basis by evaluating the expectation values of Chebyshev polynomials up to order \(2D-1\). It dispatches tasks to
lanczos_even()andlanczos_odd(), which implement the circuit layouts described in Figure 1 in Kirby et al..For each polynomial order \(k = 0, \dotsc, 2D-1\), it prepares and measures circuits corresponding either to \(\bra{\psi\lfloor k/2\rfloor}R\ket{\psi\lfloor k/2\rfloor}\) for even \(k\), or \(\bra{\psi\lfloor k/2\rfloor}U\ket{\psi\lfloor k/2\rfloor}\) for odd \(k\). The measured statistics encode the expectation values \(\langle T_k(H)\rangle_0\).
The function supports two execution modes:
- Tracing Mode (JAX):
Uses
expectation_value()with a JIT-compiled post-processor for high-performance execution.
- Standard Mode:
Uses
multi_measurement()for NISQ hardware execution.
- Parameters:
- HQubitOperator or BlockEncoding
Hamiltonian for which to estimate the ground-state energy. If a QubitOperator is provided, it is automatically converted to a Pauli block-encoding.
- Dint
Krylov space dimension. Determines maximum Chebyshev order \((2D-1)\).
- operand_prepcallable
Function returning the (operand) QuantumVariables in the initial system state \(\ket{\psi_0}\), i.e.,
operands=operand_prep(). Must return a QuantumVariable or a tuple of QuantumVariables.- mes_kwargsdict, optional
The keyword arguments for the measurement function. By default, 100_000
shotsare executed for measuring each expectation value.
- Returns:
- expvalsArrayLike, shape (2D,)
The expectation values \(\langle T_k(H) \rangle_0\) for \(k=0, \dots, 2D-1\).