Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion qiskit/algorithms/optimizers/spsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SPSA(Optimizer):

SPSA can be used in the presence of noise, and it is therefore indicated in situations
involving measurement uncertainty on a quantum computation when finding a minimum.
If you are executing a variational algorithm using a Quantum ASseMbly Language (QASM)
If you are executing a variational algorithm using an OpenQASM
Comment thread
jlapeyre marked this conversation as resolved.
simulator or a real device, SPSA would be the most recommended choice among the optimizers
provided here.

Expand Down
4 changes: 2 additions & 2 deletions qiskit/assembler/assemble_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _assemble_circuit(
if calibrations:
config.calibrations = calibrations

# Convert conditionals from QASM-style (creg ?= int) to qobj-style
# Convert conditionals from OpenQASM2-style (creg ?= int) to qobj-style
# (register_bit ?= 1), by assuming device has unlimited register slots
# (supported only for simulators). Map all measures to a register matching
# their clbit_index, create a new register slot for every conditional gate
Expand Down Expand Up @@ -213,7 +213,7 @@ def _extract_common_calibrations(
and delete them from their local experiments.

Args:
experiments: The list of Qasm experiments that are being assembled into one qobj
experiments: The list of OpenQASM experiments that are being assembled into one qobj

Returns:
The input experiments with modified calibrations, and common calibrations, if there
Expand Down
24 changes: 12 additions & 12 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,11 +1575,11 @@ def qasm(
filename: Optional[str] = None,
encoding: Optional[str] = None,
) -> Optional[str]:
"""Return OpenQASM string.
"""Return OpenQASM2 string.
Comment thread
jakelishman marked this conversation as resolved.
Outdated

Args:
formatted (bool): Return formatted Qasm string.
filename (str): Save Qasm to file with name 'filename'.
formatted (bool): Return formatted OpenQASM 2.0 string.
filename (str): Save OpenQASM 2.0 to file with name 'filename'.
encoding (str): Optionally specify the encoding to use for the
output file if ``filename`` is specified. By default this is
set to the system's default encoding (ie whatever
Expand All @@ -1597,7 +1597,7 @@ def qasm(
"""

if self.num_parameters > 0:
raise QasmError("Cannot represent circuits with unbound parameters in OpenQASM 2.")
raise QasmError("Cannot represent circuits with unbound parameters in OpenQASM 2.0")

existing_gate_names = [
"barrier",
Expand Down Expand Up @@ -1732,7 +1732,7 @@ def qasm(
if not HAS_PYGMENTS:
raise MissingOptionalLibraryError(
libname="pygments>2.4",
name="formatted QASM output",
name="formatted OpenQASM2 output",
Comment thread
jakelishman marked this conversation as resolved.
Outdated
pip_install="pip install pygments",
)
code = pygments.highlight(
Expand Down Expand Up @@ -2406,24 +2406,24 @@ def remove_final_measurements(self, inplace: bool = True) -> Optional["QuantumCi

@staticmethod
def from_qasm_file(path: str) -> "QuantumCircuit":
"""Take in a QASM file and generate a QuantumCircuit object.
"""Take in a OpenQASM2 file and generate a QuantumCircuit object.
Comment thread
jakelishman marked this conversation as resolved.
Outdated
Comment thread
jakelishman marked this conversation as resolved.
Outdated

Args:
path (str): Path to the file for a QASM program
path (str): Path to the file for a OpenQASM2 program
Return:
QuantumCircuit: The QuantumCircuit object for the input QASM
QuantumCircuit: The QuantumCircuit object for the input OpenQASM2
"""
qasm = Qasm(filename=path)
return _circuit_from_qasm(qasm)

@staticmethod
def from_qasm_str(qasm_str: str) -> "QuantumCircuit":
"""Take in a QASM string and generate a QuantumCircuit object.
"""Take in a OpenQASM2 string and generate a QuantumCircuit object.
Comment thread
jakelishman marked this conversation as resolved.
Outdated

Args:
qasm_str (str): A QASM program string
qasm_str (str): A OpenQASM2 program string
Comment thread
jakelishman marked this conversation as resolved.
Outdated
Return:
QuantumCircuit: The QuantumCircuit object for the input QASM
QuantumCircuit: The QuantumCircuit object for the input OpenQASM2
Comment thread
jakelishman marked this conversation as resolved.
Outdated
"""
qasm = Qasm(data=qasm_str)
return _circuit_from_qasm(qasm)
Expand Down Expand Up @@ -4820,7 +4820,7 @@ def _get_composite_circuit_qasm_from_instruction(instruction: Instruction) -> st
def _insert_composite_gate_definition_qasm(
string_temp: str, existing_composite_circuits: List[Instruction], extension_lib: str
) -> str:
"""Insert composite gate definition QASM code right after extension library in the header"""
"""Insert composite gate definition OpenQASM2 code right after extension library in the header"""

gate_definition_string = ""

Expand Down
2 changes: 1 addition & 1 deletion qiskit/compiler/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def assemble(
``n_qubits.``
schedule_los: Experiment level (ie circuit or schedule) LO frequency configurations for
qubit drive and measurement channels. These values override the job level values from
``default_qubit_los`` and ``default_meas_los``. Frequencies are in Hz. Settable for qasm
``default_qubit_los`` and ``default_meas_los``. Frequencies are in Hz. Settable for OpenQASM2
and pulse jobs.
meas_level: Set the appropriate level of the measurement output for pulse experiments.
meas_return: Level of measurement data for the backend to return.
Expand Down
2 changes: 1 addition & 1 deletion qiskit/converters/ast_to_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def _process_node(self, node):
return None

def _gate_rules_to_qiskit_circuit(self, node, params):
"""From a gate definition in qasm, to a QuantumCircuit format."""
"""From a gate definition in OpenQASM, to a QuantumCircuit format."""
rules = []
qreg = QuantumRegister(node["n_bits"])
bit_args = {node["bits"][i]: q for i, q in enumerate(qreg)}
Expand Down
4 changes: 2 additions & 2 deletions qiskit/extensions/hamiltonian_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ def _define(self):
self.definition = qc

def qasm(self):
"""Raise an error, as QASM is not defined for the HamiltonianGate."""
raise ExtensionError("HamiltonianGate has no QASM definition.")
"""Raise an error, as OpenQASM2 is not defined for the HamiltonianGate."""
raise ExtensionError("HamiltonianGate has no OpenQASM2 definition.")
Comment thread
jakelishman marked this conversation as resolved.
Outdated

def validate_parameter(self, parameter):
"""Hamiltonian parameter has to be an ndarray, operator or float."""
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/fake_provider/fake_qasm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@


class FakeQasmBackend(FakeBackend):
"""A fake qasm backend."""
"""A fake OpenQASM backend."""

dirname = None
conf_filename = None
Expand Down
2 changes: 1 addition & 1 deletion qiskit/providers/fake_provider/fake_qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# that they have been altered from the originals.

"""
Fake qasm simulator.
Fake OpenQASM simulator.
"""

from qiskit.providers.models import GateConfig, QasmBackendConfiguration
Expand Down
10 changes: 5 additions & 5 deletions qiskit/providers/models/backendconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class GateConfig:
"""Class representing a Gate Configuration

Attributes:
name: the gate name as it will be referred to in Qasm.
name: the gate name as it will be referred to in OpenQASM.
parameters: variable names for the gate parameters (if any).
qasm_def: definition of this gate in terms of Qasm primitives U
qasm_def: definition of this gate in terms of OpenQASM 2 primitives U
and CX.
"""

Expand All @@ -52,10 +52,10 @@ def __init__(
"""Initialize a GateConfig object

Args:
name (str): the gate name as it will be referred to in Qasm.
name (str): the gate name as it will be referred to in OpenQASM.
parameters (list): variable names for the gate parameters (if any)
as a list of strings.
qasm_def (str): definition of this gate in terms of Qasm primitives
qasm_def (str): definition of this gate in terms of OpenQASM2 primitives
U and CX.
coupling_map (list): An optional coupling map for the gate. In
the form of a list of lists of integers representing the qubit
Expand Down Expand Up @@ -195,7 +195,7 @@ def __repr__(self):


class QasmBackendConfiguration:
"""Class representing a Qasm Backend Configuration.
"""Class representing a OpenQASM Backend Configuration.
Comment thread
jakelishman marked this conversation as resolved.
Outdated

Attributes:
backend_name: backend name.
Expand Down
2 changes: 1 addition & 1 deletion qiskit/qasm/node/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""QASM nodes."""
"""OpenQASM2 nodes."""

from .barrier import Barrier
from .binaryop import BinaryOp
Expand Down
2 changes: 1 addition & 1 deletion qiskit/qasm/node/binaryoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ def operation(self):
raise NodeException(f"internal error: undefined operator '{self.value}'") from ex

def qasm(self):
"""Return the QASM representation."""
"""Return the OpenQASM2 representation."""
Comment thread
jakelishman marked this conversation as resolved.
Outdated
return self.value
6 changes: 3 additions & 3 deletions qiskit/qasm/node/unaryoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Node for an OPENQASM unary operator."""
"""Node for an OpenQASM2 unary operator."""

import operator

Expand All @@ -25,7 +25,7 @@


class UnaryOperator(Node):
"""Node for an OPENQASM unary operator.
"""Node for an OpenQASM2 unary operator.

This node has no children. The data is in the value field.
"""
Expand All @@ -45,5 +45,5 @@ def operation(self):
raise NodeException(f"internal error: undefined prefix '{self.value}'") from ex

def qasm(self):
"""Return QASM representation."""
"""Return OpenQASM2 representation."""
return self.value
2 changes: 1 addition & 1 deletion qiskit/qasm/qasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, filename=None, data=None):
if filename is None and data is None:
raise QasmError("Missing input file and/or data")
if filename is not None and data is not None:
raise QasmError("File and data must not both be specified initializing qasm")
raise QasmError("File and data must not both be specified initializing OpenQASM 2")
self._filename = filename
self._data = data

Expand Down
2 changes: 1 addition & 1 deletion qiskit/qasm3/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __init__(self, values: List[Expression]):


class Constant(Expression, enum.Enum):
"""A constant value defined by the QASM 3 spec."""
"""A constant value defined by the OpenQASM 3 spec."""

PI = enum.auto()
EULER = enum.auto()
Expand Down
10 changes: 5 additions & 5 deletions qiskit/qasm3/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def __init__(
basis_gates: the basic defined gate set of the backend.
disable_constants: if ``True``, always emit floating-point constants for numeric
parameter values. If ``False`` (the default), then values close to multiples of
QASM 3 constants (``pi``, ``euler``, and ``tau``) will be emitted in terms of those
OpenQASM 3 constants (``pi``, ``euler``, and ``tau``) will be emitted in terms of those
constants instead, potentially improving accuracy in the output.
alias_classical_registers: If ``True``, then classical bit and classical register
declarations will look similar to quantum declarations, where the whole set of bits
Expand All @@ -149,13 +149,13 @@ def __init__(
self.indent = indent

def dumps(self, circuit):
"""Convert the circuit to QASM 3, returning the result as a string."""
"""Convert the circuit to OpenQASM 3, returning the result as a string."""
with io.StringIO() as stream:
self.dump(circuit, stream)
return stream.getvalue()

def dump(self, circuit, stream):
"""Convert the circuit to QASM 3, dumping the result to a file or text stream."""
"""Convert the circuit to OpenQASM 3, dumping the result to a file or text stream."""
builder = QASM3Builder(
circuit,
includeslist=self.includes,
Expand Down Expand Up @@ -861,7 +861,7 @@ def build_for_loop(self, instruction: CircuitInstruction) -> ast.ForLoopStatemen
else:
loop_parameter_ast = self._register_variable(loop_parameter)
if isinstance(indexset, range):
# QASM 3 uses inclusive ranges on both ends, unlike Python.
# OpenQASM 3 uses inclusive ranges on both ends, unlike Python.
indexset_ast = ast.Range(
start=self.build_integer(indexset.start),
end=self.build_integer(indexset.stop - 1),
Expand All @@ -872,7 +872,7 @@ def build_for_loop(self, instruction: CircuitInstruction) -> ast.ForLoopStatemen
indexset_ast = ast.IndexSet([self.build_integer(value) for value in indexset])
except QASM3ExporterError:
raise QASM3ExporterError(
"The values in QASM 3 'for' loops must all be integers, but received"
"The values in OpenQASM 3 'for' loops must all be integers, but received"
f" '{indexset}'."
) from None
body_ast = self.build_program_block(loop_circuit)
Expand Down
6 changes: 3 additions & 3 deletions qiskit/qasm3/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Printers for QASM 3 AST nodes."""
"""Printers for OpenQASM 3 AST nodes."""

import io
from typing import Sequence
Expand All @@ -19,7 +19,7 @@


class BasicPrinter:
"""A QASM 3 AST visitor which writes the tree out in text mode to a stream, where the only
"""A OpenQASM 3 AST visitor which writes the tree out in text mode to a stream, where the only
formatting is simple block indentation."""

_CONSTANT_LOOKUP = {
Expand Down Expand Up @@ -85,7 +85,7 @@ def visit(self, node: ast.ASTNode) -> None:
however, if you want to build up a file bit-by-bit manually.

Args:
node (ASTNode): the node to convert to QASM 3 and write out to the stream.
node (ASTNode): the node to convert to OpenQASM 3 and write out to the stream.

Raises:
RuntimeError: if an AST node is encountered that the visitor is unable to parse. This
Expand Down
2 changes: 1 addition & 1 deletion qiskit/qobj/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, **kwargs):
self.__dict__.update(kwargs)

def to_dict(self):
"""Return a dictionary format representation of the QASM Qobj.
"""Return a dictionary format representation of the OpenQASM2 Qobj.
Comment thread
jlapeyre marked this conversation as resolved.
Outdated

Returns:
dict: The dictionary form of the QobjHeader.
Expand Down
Loading