neuralqx.experimental.vqs.mc.mc_state.expect_grad_biadjoint module¶
Experimental bi-covariance gradient for non-Hermitian operators.
For a generic (not necessarily Hermitian) operator A, define
For a real coordinate \(\eta\), the exact gradient can be written as
where
In force notation:
For real parameters, \(g_j = F_{A,j} + \overline{F_{A^\dagger,j}}\).
This implementation reuses neuralqx.vqs.expect_and_forces() for both
A and A†. For sequences we pass the full list at once, which preserves
existing fused/unfused sequence behavior from the public forces API.
For complex holomorphic models, this module supports complex parameters through
the same force/Wirtinger branch used by neuralqx.vqs.expect_and_forces().
For non-holomorphic models, it emits a warning and defers to the existing
generic non-Hermitian VJP path by returning None to the dispatcher.
When all parameter leaves are complex and holomorphicity is satisfied, the
implementation uses only the forward force term F_A and skips the
adjoint-force evaluation as an optimization.
If an operator does not expose adjoint, this module emits a warning and
returns None so callers can fall back to the generic non-Hermitian VJP
path.
- expect_and_grad_biadjoint(vstate, Ô, chunk_size, *, mutable=False)¶
Compute expectation and exact bi-covariance gradient for one operator.
- Parameters:
Ô (
AbstractOperator) – Operator whose objective is being differentiated.chunk_size (
Optional[int]) – Forwarded toneuralqx.vqs.expect_and_forces().mutable (
Union[bool,str,Collection[str], DenyList]) – Flax mutable collection filter.
- Return type:
- Returns:
A
(stats, grad)tuple when the operator exposes an adjoint, otherwiseNoneto signal fallback to the generic non-Hermitian VJP path. This function also returnsNonewhencfg.EXPERIMENTAL_GRADis disabled, for non-holomorphic models, and for complex-typed operator objectives (exceptSquaredwhich is real-valued by construction).
Notes
For holomorphic models with all-complex parameter leaves, this function uses only
F_A(Wirtinger branch) and skips the adjoint-force pass.
- expect_and_grad_biadjoint_sequence(vstate, Ô_list, chunk_size, *, mutable=False)¶
Compute expectation and exact bi-covariance gradient for a sequence.
- Parameters:
Ô_list (
Sequence[AbstractOperator]) – Sequence of operators whose objective contributions are summed.chunk_size (
Optional[int]) – Forwarded toneuralqx.vqs.expect_and_forces().mutable (
Union[bool,str,Collection[str], DenyList]) – Flax mutable collection filter.
- Return type:
- Returns:
A
(stats, grad)tuple when every operator exposes an adjoint, otherwiseNoneto signal fallback to the generic non-Hermitian VJP path. This function also returnsNonewhencfg.EXPERIMENTAL_GRADis disabled, for non-holomorphic models, and for sequences that contain complex-typed operator terms (exceptSquaredterms).
Notes
For holomorphic models with all-complex parameter leaves, this function uses only forward sequence forces
F_A(Wirtinger branch) and skips the adjoint-force sequence pass.