a "h @sdZddlmZddlmZmZddlmZmZm Z m Z e dZ e j ddZ de _e jd d Ze d Zej d d ZejddZdS)a& ******************************************************************************** * Copyright (c) 2025 the Qrisp authors * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License, v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is * available at https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ******************************************************************************** ) ShapedArray)ResetQubit)AbstractQuantumCircuit AbstractQubitQuantumPrimitiveAbstractQubitArraymeasurecCsLt|trtdttfSt|tr6tdddtfStdt|dS)Abstract evaluation of the primitive. This function does not need to be JAX traceable. It will be invoked with abstractions of the actual arguments. Args: xs, ys, zs: abstractions of the arguments. Result: a ShapedArray for the result of the primitive. int64)dtypez.Tried to call measurement primitive with type N) isinstancerrboolrr Exceptiontype) meas_objectqcr r b/Users/natalie/Documents/masters/GDP/code/first_try/qrisp/jasp/primitives/measurement_primitive.pymeasure_abstract_eval!s   rTcCsddlm}m}d}t||r(|g}d}t||r|rN|||jd|fSg}tt|D]"}|||||jdq^||fSnJd}tt|D] }|d||||g7}q|rt ||fS||fSdS)Nr)rQuantumCircuitFT) qrisprrrr clbitsrangelenappendr)rrrrZ return_bool clbit_listiresr r rmeasure_implementation:s(     r!resetcCstS)r )r) reset_objectrr r rreset_abstract_evalZs r$cCs6t|tr|g}tt|D]}|||gq|S)N)rrrrr")r#rrr r rreset_implementationhs  r%N)__doc__jax.corer qrisp.circuitrrqrisp.jasp.primitivesrrrrZ Measurement_pdef_abstract_evalrmultiple_resultsdef_implr!Zreset_pr$r%r r r rs