Skip to content

Commit

Permalink
some further renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
positr0nium committed Apr 19, 2024
1 parent 818153e commit f5c7c8e
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 166 deletions.
10 changes: 5 additions & 5 deletions src/qrisp/jax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
********************************************************************************/
"""

from qrisp.jax.primitive import *
from qrisp.jax.qubit import *
from qrisp.jax.quantum_register import *
from qrisp.jax.quantum_state import *
from qrisp.jax.catalyst_gates import *
from qrisp.jax.quantum_primitive import *
from qrisp.jax.abstract_qubit import *
from qrisp.jax.abstract_quantum_register import *
from qrisp.jax.abstract_quantum_circuit import *
from qrisp.jax.measurement_primitive import *
from qrisp.jax.catalyst_converter import *


File renamed without changes.
File renamed without changes.
File renamed without changes.
150 changes: 0 additions & 150 deletions src/qrisp/jax/catalyst_gates.py

This file was deleted.

42 changes: 42 additions & 0 deletions src/qrisp/jax/measurement_primitive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
\********************************************************************************
* Copyright (c) 2023 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
********************************************************************************/
"""

from jax.core import ShapedArray

from qrisp.jax import AbstractQuantumCircuit, AbstractQubit, QuantumPrimitive

# Create the primitive
Measurement_p = QuantumPrimitive("measure")

@Measurement_p.def_abstract_eval
def measure_abstract_eval(state, qb):
"""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.
"""

assert isinstance(qb, AbstractQubit)
return AbstractQuantumCircuit(), ShapedArray((), bool)

Measurement_p.num_qubits = 1
Measurement_p.multiple_results = True
11 changes: 0 additions & 11 deletions src/qrisp/jax/primitive.py

This file was deleted.

24 changes: 24 additions & 0 deletions src/qrisp/jax/quantum_primitive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
\********************************************************************************
* Copyright (c) 2023 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
********************************************************************************/
"""

from jax.core import Primitive

# Wrapper to identify Qrisp primitives
class QuantumPrimitive(Primitive):
pass

0 comments on commit f5c7c8e

Please sign in to comment.