[docs]classNativeTensorNetworkEngine(TensorNetworkEngine):""" Thin adapter that exposes the minimal API required by HybridSurrogate while reusing the existing evolutors.tensor_network implementation. """
[docs]defbuild_circuit_mps(self,n:int,initial_state_amplitudes:Any,initial_state_circuit:Any,max_bond_dimension:int|None=None,):""" Create a CircuitMPS initialised with `initial_state`. `initial_state` is passed as-is to CircuitMPS (the caller creates the array of single-qubit amplitudes as before). """returnCircuitMPS(n=n,initial_state=initial_state_amplitudes,max_bond_dimension=max_bond_dimension,)
[docs]defpauli_mpo(self,pauli_string:str|object):"""Return the existing PauliMPO for the given pauli_string."""returnPauliMPO(pauli_string)
[docs]defexpval(self,state_circuit:CircuitMPS,operator:PauliMPO):"""Compute the expectation value of `operator` on `state`."""returnstate_circuit.expval(operator)
[docs]defpauli_rot(self,state_circuit:CircuitMPS,generator:str,angle:float,max_bond_dimension:int,):"""Apply a Pauli rotation specified by `generator` and `angle` to the MPS."""returnstate_circuit.pauli_rot(generator,angle)