Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache block fix #5

Open
wants to merge 74 commits into
base: master
Choose a base branch
from
Open
Changes from 7 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7822d91
Parallel Qiskit Aer (GPU + MPI) by using cache blocking transpiler (#…
doichanj Feb 4, 2021
b475f19
Adding gates to the MPS simulator (#1088)
yaelbh Feb 4, 2021
f869a36
adding qutip copyright to mc controller (#1124)
DanPuzzuoli Feb 10, 2021
d9d4593
Fix numpy ABI incompatibility when building with numpy 1.20 (#1125)
vvilpas Feb 10, 2021
cf8edab
Add new save expectation value instructions (#1101)
chriseclectic Feb 10, 2021
600806c
Add ``SaveStatevector`` and ``SaveDensityMatrix`` instructions (#1116)
chriseclectic Feb 11, 2021
d58737a
Add `SaveProbabilities` and `SaveProbabilitiesDict` instructions (#1117)
chriseclectic Feb 11, 2021
09383a8
Fix cache blocking diagonal matrix
doichanj Feb 16, 2021
c2908f9
fix blocking diagonal matrix
doichanj Feb 17, 2021
998d532
Pass CMAKE_GENERATOR_PLATFORM thorugh scikit_build in win32 builds (#…
vvilpas Feb 17, 2021
424ae67
correct block bits after cache block transpiler
doichanj Feb 18, 2021
63e33d3
Add tests for SaveExpectationValueVariance (#1140)
chriseclectic Feb 18, 2021
43a150c
Add `SaveAmplitudes` and `SaveAmplitudesSquared` instructions. (#1129)
chriseclectic Feb 18, 2021
b274872
No numpy install before CMake runs (#1142)
vvilpas Feb 18, 2021
2da63a2
Migrate windows CI to all be in github actions (#1137)
mtreinish Feb 18, 2021
940a8a6
Add _directive attr to SaveData and Snapshot instruction (#1139)
chriseclectic Feb 18, 2021
a5e9f5c
fix save_density_matrix
doichanj Feb 19, 2021
47dba5f
bit scaling of matrix state is not multiplied to num_qubits_ and chun…
doichanj Feb 19, 2021
a0da338
fix MPI compilation
doichanj Feb 19, 2021
185b28e
change MPI tests to multi chunk tests
doichanj Feb 19, 2021
6e34272
Merge remote-tracking branch 'upstream/master' into cache-block-fix
doichanj Feb 19, 2021
12e20d3
modify contribution document
doichanj Feb 19, 2021
70dc825
Implemented save_amplitudes
doichanj Feb 22, 2021
1415180
added MPI support for save_amplitudes
doichanj Feb 22, 2021
32be341
Start updating tests to use configurable simulator backend (#1150)
chriseclectic Feb 22, 2021
2e777bd
explicitly avoid omp use for experiments in serial execution (#1147)
hhorii Feb 22, 2021
0ece80f
Add SaveUnitary and SaveStabilizer instructions (#1136)
chriseclectic Feb 22, 2021
a2f29ee
Fix noise sampling for conditional gates (#1154)
chriseclectic Feb 24, 2021
5923392
Extended stabilizer simulator expval command (#1121)
gadial Feb 24, 2021
5b5658c
Pass some json utils function args by const reference (#1151)
vvilpas Feb 24, 2021
1a6d5df
change default max_memory_mb from half to full system memory (#1152)
hhorii Feb 25, 2021
9c30458
smalle fix for CI test
doichanj Feb 25, 2021
09fd95d
debug for statevector chunk state
doichanj Feb 25, 2021
6dd4708
Fix bug in StatevectorChunk::State::vec2density
doichanj Feb 25, 2021
9749e0f
delete debug message
doichanj Feb 25, 2021
666e99f
Merge remote-tracking branch 'upstream/master' into cache-block-fix
doichanj Feb 25, 2021
96e7cf0
merged with upstream/master
doichanj Feb 25, 2021
756af11
Fix multi-chunk diagonal matrix (#1155)
doichanj Feb 25, 2021
bf92091
resolve conflict
doichanj Feb 26, 2021
857f093
fix merge failure
doichanj Feb 26, 2021
4a41d44
fix again
doichanj Feb 26, 2021
1063501
Add arm64 release wheel jobs (#1162)
mtreinish Feb 26, 2021
892a6fd
Add default save instruction labels (#1161)
chriseclectic Feb 26, 2021
cc7b1af
Add pending deprecation warnings to snapshots (#1158)
chriseclectic Mar 2, 2021
dffb1d7
Fix out of bounds array access. (#1167)
vvilpas Mar 2, 2021
71c940b
Fix memory_leak due to shared_ptr circular references. (#1168)
vvilpas Mar 2, 2021
493b558
prepare for merge upstream
doichanj Mar 3, 2021
57591ee
merge upstream
doichanj Mar 3, 2021
56b44f4
remove debug message
doichanj Mar 3, 2021
bdb7718
remove comparing weak_ptr with nullptr
doichanj Mar 3, 2021
7d1f5b8
remove reset to weak_ptr
doichanj Mar 3, 2021
7267429
Fixed bug in sample_measure_using_probabilities (#1132)
merav-aharoni Mar 3, 2021
43d8307
Merge branch 'master' into cache-block-fix
vvilpas Mar 3, 2021
f8f3bb7
reflect review comments
doichanj Mar 4, 2021
12d18bc
Merge remote-tracking branch 'refs/remotes/origin/cache-block-fix' in…
doichanj Mar 4, 2021
ae36d65
fix expval_pauli for density matrix
doichanj Mar 4, 2021
90831eb
Fix density matrix expval_pauli (#1171)
chriseclectic Mar 4, 2021
5c2f507
Disable all warnings emitted from thrust headers (#1169)
vvilpas Mar 4, 2021
ba56322
merge upstream/master
doichanj Mar 5, 2021
11c5b8a
Remove previously deprecated methods (#1160)
chriseclectic Mar 5, 2021
5a72c02
Fix grammar, capitalization, text inconsistencies (#900)
RafeyIqbalRahman Mar 5, 2021
feb9fb2
Update README.md to mention Linux-only GPU support (#1095)
amirebrahimi Mar 5, 2021
3283d37
Fix density matrix chunk expval_pauli
doichanj Mar 8, 2021
07cc9b8
Fix statevector chunk expval_pauli
doichanj Mar 8, 2021
19e846c
Merge branch 'master' into cache-block-fix
doichanj Mar 8, 2021
7fe4f9e
Fix expval tests (#1173)
chriseclectic Mar 8, 2021
d69f7e9
Fix extended stabilizer method basis gates (#1175)
chriseclectic Mar 9, 2021
3d2575a
Update CODEOWNERS (#1174)
chriseclectic Mar 9, 2021
a41d5c7
Merge branch 'master' into cache-block-fix
chriseclectic Mar 9, 2021
46b24a6
Merge remote-tracking branch 'upstream/master' into cache-block-fix
doichanj Mar 10, 2021
af41169
Merge branch 'cache-block-fix' of github.com:doichanj/qiskit-aer into…
doichanj Mar 10, 2021
acd216d
Fixes of multi-chunk State implementation (#1149)
doichanj Mar 10, 2021
1994b35
Add Fusion variations (#1110)
hhorii Mar 10, 2021
58d44d1
Merge remote-tracking branch 'upstream/master' into cache-block-fix
doichanj Mar 11, 2021
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
18 changes: 8 additions & 10 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -8,15 +8,13 @@

# Generic rule for the repository. This pattern is actually the one that will
# apply unless specialized by a later rule
* @chriseclectic @vvilpas @atilag
* @chriseclectic @vvilpas

# Individual folders on root directory
/qiskit @chriseclectic @atilag @vvilpas
/cmake @atilag @vvilpas
/doc @chriseclectic @atilag @vvilpas
/examples @chriseclectic @atilag @vvilpas
/contrib @chriseclectic @atilag @vvilpas
/test @chriseclectic @atilag @vvilpas
/src @chriseclectic @atilag @vvilpas

# AER specific folders
/qiskit @chriseclectic @vvilpas @mtreinish
/test @chriseclectic @vvilpas @mtreinish
/doc @chriseclectic @vvilpas @mtreinish
/releasenotes @chriseclectic @vvilpas @mtreinish
/cmake @vvilpas
/contrib @chriseclectic @vvilpas @hhorii
/src @chriseclectic @vvilpas @hhorii
169 changes: 84 additions & 85 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ To install from source, follow the instructions in the [contribution guidelines]

## Installing GPU support

In order to install and run the GPU supported simulators, you need CUDA® 10.1 or newer previously installed.
In order to install and run the GPU supported simulators on Linux, you need CUDA® 10.1 or newer previously installed.
CUDA® itself would require a set of specific GPU drivers. Please follow CUDA® installation procedure in the NVIDIA® [web](https://www.nvidia.com/drivers).

If you want to install our GPU supported simulators, you have to install this other package:
@@ -33,6 +33,11 @@ This will overwrite your current `qiskit-aer` package installation giving you
the same functionality found in the canonical `qiskit-aer` package, plus the
ability to run the GPU supported simulators: statevector, density matrix, and unitary.

**Note**: This package is only available on x86_64 Linux. For other platforms
that have CUDA support you will have to build from source. You can refer to
the [contributing guide](https://github.com/Qiskit/qiskit-aer/blob/master/CONTRIBUTING.md#building-with-gpu-support)
for instructions on doing this.

## Simulating your first quantum program with Qiskit Aer
Now that you have Qiskit Aer installed, you can start simulating quantum circuits with noise. Here is a basic example:

4 changes: 2 additions & 2 deletions qiskit/providers/aer/backends/qasm_simulator.py
Original file line number Diff line number Diff line change
@@ -524,8 +524,8 @@ def _method_configuration(method=None):
config.custom_instructions = sorted(['roerror', 'snapshot', 'save_statevector',
'save_expval', 'save_expval_var'])
config.basis_gates = sorted([
'cx', 'cz', 'id', 'x', 'y', 'z', 'h', 's', 'sdg', 'sx', 'swap',
'u0', 'u1', 'p', 'ccx', 'ccz', 'delay'
'cx', 'cz', 'id', 'x', 'y', 'z', 'h', 's', 'sdg', 'sx',
'swap', 'u0', 't', 'tdg', 'u1', 'p', 'ccx', 'ccz', 'delay'
] + config.custom_instructions)

return config
32 changes: 1 addition & 31 deletions qiskit/providers/aer/noise/noise_model.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@

import json
import logging
from warnings import warn

from qiskit.circuit import Instruction
from qiskit.providers import BaseBackend, Backend
@@ -154,7 +153,6 @@ def __init__(self, basis_gates=None):
# dict(str: ReadoutError)
# where the dict keys are the gate qubits.
self._local_readout_errors = {}
self._x90_gates = []

@property
def basis_gates(self):
@@ -361,9 +359,6 @@ def __str__(self):
if self._noise_qubits:
output += "\n Qubits with noise: {}".format(
list(self._noise_qubits))
if self._x90_gates:
output += "\n X-90 based single qubit gates: {}".format(
list(self._x90_gates))
if default_error_ops != []:
output += "\n All-qubits errors: {}".format(default_error_ops)
if local_error_ops != []:
@@ -426,28 +421,6 @@ def add_basis_gates(self, instructions, warnings=True):
"Warning: Adding a gate \"%s\" to basis_gates which is "
"not in QasmSimulator basis_gates.", name)

def set_x90_single_qubit_gates(self, instructions):
"""
Declares X90 based gates for noise model.
Args:
instructions (list[str] or
list[Instruction]): the instructions error applies to.
Raises:
NoiseError: if the input instructions are not valid.
"""
warn('This function is deprecated and will be removed in a future release. '
'To use an X90 based noise model use the Sqrt(X) "sx" gate and one of '
' the single-qubit phase gates "u1", "rx", "p" in the noise model and '
' basis gates to decompose into this gateset for noise simulations.',
DeprecationWarning)
for name, label in self._instruction_names_labels(instructions):
# Add X-90 based gate to noisy gates
self._noise_instructions.add(label)
self._basis_gates.add(name)
self._x90_gates = instructions

def add_all_qubit_quantum_error(self, error, instructions, warnings=True):
"""
Add a quantum error to the noise model that applies to all qubits.
@@ -806,7 +779,7 @@ def to_dict(self, serializable=False):
error_dict["gate_qubits"] = [self._str2qubits(qubits_str)]
error_list.append(error_dict)

ret = {"errors": error_list, "x90_gates": self._x90_gates}
ret = {"errors": error_list}
if serializable:
ret = json.loads(json.dumps(ret, cls=AerJSONEncoder))

@@ -829,9 +802,6 @@ def from_dict(noise_dict):
# Return noise model
noise_model = NoiseModel()

# Set X90 gates
noise_model.set_x90_single_qubit_gates(noise_dict.get('x90_gates', []))

# Get error terms
errors = noise_dict.get('errors', [])

5 changes: 1 addition & 4 deletions qiskit/providers/aer/utils/noise_transformation.py
Original file line number Diff line number Diff line change
@@ -214,10 +214,7 @@ def approximate_noise_model(model, *,
error_dict["gate_qubits"] = [model._str2qubits(qubits_str)]
error_list.append(error_dict)

approx_noise_model = NoiseModel.from_dict({
"errors": error_list,
"x90_gates": model._x90_gates
})
approx_noise_model = NoiseModel.from_dict({"errors": error_list})
# Update basis gates
approx_noise_model._basis_gates = model._basis_gates
return approx_noise_model
6 changes: 6 additions & 0 deletions releasenotes/notes/remove-deprecated-ba6eb1060207af99.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
upgrade:
- |
Removed x90 gate decomposition from noise models that was deprecated
in qiskit-aer 0.7. This decomposition is now done by using regular
noise model basis gates and the qiskit transpiler.
14 changes: 0 additions & 14 deletions src/framework/creg.hpp
Original file line number Diff line number Diff line change
@@ -138,20 +138,6 @@ bool ClassicalRegister::check_conditional(const Operations::Op &op) const {
// Check if op is conditional
if (op.conditional)
return (creg_register_[creg_register_.size() - op.conditional_reg - 1] == '1');

// DEPRECATED: old style conditional
if (op.old_conditional) {
std::string current;
auto mask = Utils::padleft(Utils::hex2bin(op.old_conditional_mask, false),
'0', creg_memory_.size());
for (size_t pos=0; pos < mask.size(); pos++) {
if (mask[pos] == '1')
current.push_back(creg_memory_[pos]);
}
auto val = Utils::padleft(Utils::hex2bin(op.old_conditional_val, false),
'0', current.size());
return (val == current);
}

// Op is not conditional
return true;
18 changes: 2 additions & 16 deletions src/framework/operations.hpp
Original file line number Diff line number Diff line change
@@ -166,11 +166,6 @@ struct Op {
uint_t conditional_reg; // (opt) the (single) register location to look up for conditional
RegComparison bfunc; // (opt) boolean function relation

// DEPRECATED: Old style conditionals (remove in 0.3)
bool old_conditional = false; // is gate old style conditional gate
std::string old_conditional_mask; // hex string for conditional mask
std::string old_conditional_val; // hex string for conditional value

// Measurement
reg_t memory; // (opt) register operation it acts on (measure)
reg_t registers; // (opt) register locations it acts on (measure, conditional)
@@ -586,16 +581,8 @@ void add_conditional(const Allowed allowed, Op& op, const json_t &js) {
throw std::invalid_argument("Invalid instruction: \"" + op.name + "\" cannot be conditional.");
}
// If instruction is allowed to be conditional add parameters
if (js["conditional"].is_number()) {
// New style conditional
op.conditional_reg = js["conditional"];
op.conditional = true;
} else {
// DEPRECATED: old style conditional (remove in 0.3)
JSON::get_value(op.old_conditional_mask, "mask", js["conditional"]);
JSON::get_value(op.old_conditional_val, "val", js["conditional"]);
op.old_conditional = true;
}
op.conditional_reg = js["conditional"];
op.conditional = true;
}
}

@@ -788,7 +775,6 @@ Op json_to_op_roerror(const json_t &js) {
op.name = "roerror";
JSON::get_value(op.memory, "memory", js);
JSON::get_value(op.registers, "register", js);
JSON::get_value(op.probs, "probabilities", js); // DEPRECATED: Remove in 0.4
JSON::get_value(op.probs, "params", js);
// Conditional
add_conditional(Allowed::No, op, js);
169 changes: 3 additions & 166 deletions src/noise/noise_model.hpp
Original file line number Diff line number Diff line change
@@ -120,11 +120,6 @@ class NoiseModel {
void add_readout_error(const ReadoutError &error,
const std::vector<reg_t> &op_qubits = {});

// Set which single qubit gates should use the X90 waltz error model
inline void set_x90_gates(const stringset_t &x90_gates) {
x90_gates_ = x90_gates;
}

//-----------------------------------------------------------------------
// Utils
//-----------------------------------------------------------------------
@@ -173,15 +168,6 @@ class NoiseModel {
NoiseOps sample_noise_helper(const Operations::Op &op,
RngEngine &rng) const;

// Sample a noisy implementation of a two-X90 pulse u3 gate
NoiseOps sample_noise_x90_u3(uint_t qubit, complex_t theta,
complex_t phi, complex_t lamba,
RngEngine &rng) const;

// Sample a noisy implementation of a single-X90 pulse u2 gate
NoiseOps sample_noise_x90_u2(uint_t qubit, complex_t phi, complex_t lambda,
RngEngine &rng) const;

// Add a local quantum error to the noise model for specific qubits
void add_local_quantum_error(const QuantumError &error,
const stringset_t &op_labels,
@@ -233,9 +219,6 @@ class NoiseModel {
// If conversion isn't possible this returns an empty matrix
cmatrix_t op2unitary(const Operations::Op &op) const;

// Table of single-qubit gates to use a Waltz X90 based error model
stringset_t x90_gates_;

// Lookup table for gate strings to enum
enum class WaltzGate {id, x, y, z, h, s, sdg, t, tdg, u0, u1, u2, u3};
const static stringmap_t<WaltzGate> waltz_gate_table_;
@@ -285,47 +268,8 @@ NoiseModel::param_gate_table_ = {
NoiseModel::NoiseOps NoiseModel::sample_noise(const Operations::Op &op,
RngEngine &rng) const {
// Noise operations
NoiseOps noise_ops;
// Look to see if gate is a waltz gate for this error model
// NOTE this is deprecated and waltz gate noise sampling should be removed
auto it = x90_gates_.find(op.name);
if (it == x90_gates_.end()) {
// Non-X90 based gate, run according to base model
noise_ops = sample_noise_helper(op, rng);
} else {
// Decompose ops in terms of their waltz implementation
auto gate = waltz_gate_table_.find(op.name);
if (gate != waltz_gate_table_.end()) {
switch (gate->second) {
case WaltzGate::u3:
noise_ops = sample_noise_x90_u3(op.qubits[0],
op.params[0], op.params[1], op.params[2],
rng);
break;
case WaltzGate::u2:
noise_ops = sample_noise_x90_u2(op.qubits[0],
op.params[0], op.params[1],
rng);
break;
case WaltzGate::x:
noise_ops = sample_noise_x90_u3(op.qubits[0], M_PI, 0., M_PI, rng);
break;
case WaltzGate::y:
noise_ops = sample_noise_x90_u3(op.qubits[0], M_PI, 0.5 * M_PI, 0.5 * M_PI, rng);
break;
case WaltzGate::h:
noise_ops = sample_noise_x90_u2(op.qubits[0], 0., M_PI, rng);
break;
default:
// The rest of the Waltz operations are noise free (u1 only)
noise_ops = {op};
break;
}
} else {
// something went wrong if we end up here
throw std::invalid_argument("Invalid waltz gate.");
}
}
NoiseOps noise_ops = sample_noise_helper(op, rng);

// If original op is conditional, make all the noise operations also conditional
if (op.conditional) {
for (auto& noise_op : noise_ops) {
@@ -772,107 +716,6 @@ NoiseModel::waltz_gate_table_ = {
};


NoiseModel::NoiseOps NoiseModel::sample_noise_x90_u3(uint_t qubit,
complex_t theta,
complex_t phi,
complex_t lambda,
RngEngine &rng) const {
// sample noise for single X90
const auto x90 = Operations::make_unitary({qubit}, Linalg::Matrix::X90, "x90");
switch (method_) {
case Method::superop: {
// The first element of the sample should be the superoperator to combine
auto sample = sample_noise_helper(x90, rng);
// The first element of the sample should be the superoperator to combine
if (sample[0].type != Operations::OpType::superop) {
throw std::runtime_error("Sampling superoperator noise failed.");
}
cmatrix_t& current = sample[0].mats[0];
// Combine with middle u1 gate with two noisy x90 superops
auto mat = Linalg::Matrix::u1(theta + M_PI);
auto super = Utils::tensor_product(AER::Utils::conjugate(mat), mat);
current = current * super * current;

// Prepend with first u1 matrix with superop
mat = Linalg::Matrix::u1(lambda);
super = Utils::tensor_product(AER::Utils::conjugate(mat),
mat);
current = current * super;
// Append third u1 matrix with superop
mat = Linalg::Matrix::u1(phi + M_PI);
super = Utils::tensor_product(AER::Utils::conjugate(mat), mat);
current = super * current;
return sample;
}
default: {
NoiseOps ret;
if (std::abs(lambda) > u1_threshold_
&& std::abs(lambda - 2 * M_PI) > u1_threshold_
&& std::abs(lambda + 2 * M_PI) > u1_threshold_) {
ret.push_back(Operations::make_u1(qubit, lambda)); // add 1st U1
}
auto sample = sample_noise_helper(x90, rng); // sample noise for 1st X90
ret.insert(ret.end(), sample.begin(), sample.end()); // add 1st noisy X90
if (std::abs(theta + M_PI) > u1_threshold_
&& std::abs(theta - M_PI) > u1_threshold_) {
ret.push_back(Operations::make_u1(qubit, theta + M_PI)); // add 2nd U1
}
sample = sample_noise_helper(x90, rng); // sample noise for 2nd X90
ret.insert(ret.end(), sample.begin(), sample.end()); // add 2nd noisy X90
if (std::abs(phi + M_PI) > u1_threshold_
&& std::abs(phi - M_PI) > u1_threshold_) {
ret.push_back(Operations::make_u1(qubit, phi + M_PI)); // add 3rd U1
}
return ret;
}
}
}


NoiseModel::NoiseOps NoiseModel::sample_noise_x90_u2(uint_t qubit,
complex_t phi,
complex_t lambda,
RngEngine &rng) const {
// sample noise for single X90
const auto x90 = Operations::make_unitary({qubit}, Linalg::Matrix::X90, "x90");
auto sample = sample_noise_helper(x90, rng);
switch (method_) {
case Method::superop: {
// The first element of the sample should be the superoperator to combine
if (sample[0].type != Operations::OpType::superop) {
throw std::runtime_error("Sampling superoperator noise failed.");
}
cmatrix_t &current = sample[0].mats[0];
// Combine first u1 matrix with superop
auto mat = Linalg::Matrix::u1(lambda - 0.5 * M_PI);
auto super = Utils::tensor_product(AER::Utils::conjugate(mat),
mat);
current = current * super;
// Combine second u1 matrix with superop
mat = Linalg::Matrix::u1(phi + 0.5 * M_PI);
super = Utils::tensor_product(AER::Utils::conjugate(mat), mat);
current = super * current;
return sample;
}
default: {
NoiseOps ret;
// Standard method doesn't combine any ops
if (std::abs(lambda - 0.5 * M_PI) > u1_threshold_) {
// add 1st u1
ret.push_back(Operations::make_u1(qubit, lambda - 0.5 * M_PI));
}
// add 1st noisy x90
ret.insert(ret.end(), sample.begin(), sample.end());
if (std::abs(phi + 0.5 * M_PI) > u1_threshold_) {
// add 2nd u1
ret.push_back(Operations::make_u1(qubit, phi + 0.5 * M_PI));
}
return ret;
}
}
}


cmatrix_t NoiseModel::op2superop(const Operations::Op &op) const {
switch (op.type) {
case Operations::OpType::superop:
@@ -1114,8 +957,7 @@ void NoiseModel::remap_qubits(const std::unordered_map<uint_t, uint_t> &mapping)
Schemas:
{
"error_model": {
"errors": [error js],
"x90_gates": which gates should be implemented as waltz gates and use the "x90" term
"errors": [error js]
}
}
@@ -1151,11 +993,6 @@ void NoiseModel::load_from_json(const json_t &js) {
throw std::invalid_argument("Invalid noise_params JSON: not an object.");
}

// See if any single qubit gates have a waltz error model applied to them
if (JSON::check_key("x90_gates", js)) {
set_x90_gates(js["x90_gates"]);
}

if (JSON::check_key("errors", js)) {
if (!js["errors"].is_array()) {
throw std::invalid_argument("Invalid noise_params JSON: \"error\" field is not a list");
Original file line number Diff line number Diff line change
@@ -353,7 +353,7 @@ bool State::check_measurement_opt(const std::vector<Operations::Op> &ops) const
{
for (const auto &op: ops)
{
if (op.conditional || op.old_conditional)
if (op.conditional)
{
return false;
}
20 changes: 10 additions & 10 deletions test/terra/backends/qasm_simulator/qasm_save_expval.py
Original file line number Diff line number Diff line change
@@ -46,9 +46,9 @@ def test_save_expval_stabilizer_pauli(self, pauli):

# Stabilizer test circuit
state_circ = qi.random_clifford(2, seed=SEED).to_circuit()
oper = qi.Pauli(pauli)
oper = qi.Operator(qi.Pauli(pauli))
state = qi.Statevector(state_circ)
target = state.expectation_value(oper).real.round(10)
target = state.expectation_value(oper).real

# Snapshot circuit
opts = self.BACKEND_OPTS.copy()
@@ -78,7 +78,7 @@ def test_save_expval_var_stabilizer_pauli(self, pauli):

# Stabilizer test circuit
state_circ = qi.random_clifford(2, seed=SEED).to_circuit()
oper = qi.Pauli(pauli)
oper = qi.Operator(qi.Pauli(pauli))
state = qi.Statevector(state_circ)
expval = state.expectation_value(oper).real
variance = state.expectation_value(oper ** 2).real - expval ** 2
@@ -178,9 +178,9 @@ def test_save_expval_nonstabilizer_pauli(self, pauli):

# Stabilizer test circuit
state_circ = QuantumVolume(2, 1, seed=SEED)
oper = qi.Pauli(pauli)
oper = qi.Operator(qi.Pauli(pauli))
state = qi.Statevector(state_circ)
target = state.expectation_value(oper).real.round(10)
target = state.expectation_value(oper).real

# Snapshot circuit
opts = self.BACKEND_OPTS.copy()
@@ -209,7 +209,7 @@ def test_save_expval_var_nonstabilizer_pauli(self, pauli):

# Stabilizer test circuit
state_circ = QuantumVolume(2, 1, seed=SEED)
oper = qi.Pauli(pauli)
oper = qi.Operator(qi.Pauli(pauli))
state = qi.Statevector(state_circ)
expval = state.expectation_value(oper).real
variance = state.expectation_value(oper ** 2).real - expval ** 2
@@ -244,7 +244,7 @@ def test_save_expval_nonstabilizer_hermitian(self, qubits):
state_circ = QuantumVolume(3, 1, seed=SEED)
oper = qi.random_hermitian(4, traceless=True, seed=SEED)
state = qi.Statevector(state_circ)
target = state.expectation_value(oper, qubits).real.round(10)
target = state.expectation_value(oper, qubits).real

# Snapshot circuit
opts = self.BACKEND_OPTS.copy()
@@ -305,15 +305,15 @@ def test_save_expval_cptp_pauli(self, pauli):
opts = self.BACKEND_OPTS.copy()
if opts.get('method') in SUPPORTED_METHODS:

oper = qi.Pauli(pauli)
oper = qi.Operator(qi.Pauli(pauli))

# CPTP channel test circuit
channel = qi.random_quantum_channel(4, seed=SEED)
state_circ = QuantumCircuit(2)
state_circ.append(channel, range(2))

state = qi.DensityMatrix(state_circ)
target = state.expectation_value(oper).real.round(10)
target = state.expectation_value(oper).real

# Snapshot circuit
circ = transpile(state_circ, self.SIMULATOR)
@@ -337,7 +337,7 @@ def test_save_expval_var_cptp_pauli(self, pauli):
opts = self.BACKEND_OPTS.copy()
if opts.get('method') in SUPPORTED_METHODS:

oper = qi.Pauli(pauli)
oper = qi.Operator(qi.Operator(qi.Pauli(pauli)))

# CPTP channel test circuit
channel = qi.random_quantum_channel(4, seed=SEED)