Skip to content

Commit

Permalink
apply black and clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
hhorii committed Mar 10, 2023
1 parent 1dafc1b commit f3b645a
Show file tree
Hide file tree
Showing 122 changed files with 20,625 additions and 142 deletions.
1 change: 0 additions & 1 deletion qiskit_aer/backends/aer_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,6 @@ class AerSimulator(AerBackend):
def __init__(
self, configuration=None, properties=None, provider=None, **backend_options
):

self._controller = aer_controller_execute()

# Update available methods and devices for class
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/backends/qasm_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ class QasmSimulator(AerBackend):
def __init__(
self, configuration=None, properties=None, provider=None, **backend_options
):

warn(
"The `QasmSimulator` backend will be deprecated in the"
" future. It has been superseded by the `AerSimulator`"
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/backends/statevector_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ class StatevectorSimulator(AerBackend):
def __init__(
self, configuration=None, properties=None, provider=None, **backend_options
):

warn(
"The `StatevectorSimulator` backend will be deprecated in the"
" future. It has been superseded by the `AerSimulator`"
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/backends/unitary_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class UnitarySimulator(AerBackend):
def __init__(
self, configuration=None, properties=None, provider=None, **backend_options
):

warn(
"The `UnitarySimulator` backend will be deprecated in the"
" future. It has been superseded by the `AerSimulator`"
Expand Down
165 changes: 82 additions & 83 deletions qiskit_aer/backends/wrappers/aer_controller_binding.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,91 +368,90 @@ void bind_aer_controller(MODULE m) {
},
[](py::tuple t) {
AER::Config config;
if (t.size() != 79)
if (t.size() != 45)
throw std::runtime_error("Invalid serialization format.");
read_value(t, 0, config.shots);
read_value(t, 1, config.method);
read_value(t, 2, config.device);
read_value(t, 3, config.precision);
read_value(t, 4, config.enable_truncation);
read_value(t, 5, config.zero_threshold);
read_value(t, 6, config.validation_threshold);
read_value(t, 7, config.max_parallel_threads);
read_value(t, 8, config.max_parallel_experiments);
read_value(t, 9, config.max_parallel_shots);
read_value(t, 10, config.max_memory_mb);
read_value(t, 11, config.fusion_enable);
read_value(t, 12, config.fusion_verbose);
read_value(t, 13, config.fusion_max_qubit);
read_value(t, 14, config.fusion_threshold);
read_value(t, 15, config.accept_distributed_results);
read_value(t, 16, config.memory);
read_value(t, 17, config.seed_simulator);
read_value(t, 18, config.cuStateVec_enable);
read_value(t, 19, config.blocking_qubits);
read_value(t, 20, config.blocking_enable);
read_value(t, 21, config.chunk_swap_buffer_qubits);
read_value(t, 22, config.batched_shots_gpu);
read_value(t, 23, config.batched_shots_gpu_max_qubits);
read_value(t, 24, config.num_threads_per_device);
read_value(t, 25, config.statevector_parallel_threshold);
read_value(t, 26, config.statevector_sample_measure_opt);
read_value(t, 27, config.stabilizer_max_snapshot_probabilities);
read_value(t, 28, config.extended_stabilizer_sampling_method);
read_value(t, 29, config.extended_stabilizer_metropolis_mixing_time);
read_value(t, 20, config.extended_stabilizer_approximation_error);
read_value(t, 31, config.extended_stabilizer_norm_estimation_samples);
read_value(t, 32, config.extended_stabilizer_norm_estimation_repetitions);
read_value(t, 33, config.extended_stabilizer_parallel_threshold);
read_value(t, 34, config.extended_stabilizer_probabilities_snapshot_samples);
read_value(t, 35, config.matrix_product_state_truncation_threshold);
read_value(t, 36, config.matrix_product_state_max_bond_dimension);
read_value(t, 37, config.mps_sample_measure_algorithm);
read_value(t, 38, config.mps_log_data);
read_value(t, 39, config.mps_swap_direction);
read_value(t, 30, config.chop_threshold);
read_value(t, 41, config.mps_parallel_threshold);
read_value(t, 42, config.mps_omp_threads);
read_value(t, 43, config.tensor_network_num_sampling_qubits);
read_value(t, 44, config.use_cuTensorNet_autotuning);
read_value(t, 45, config.library_dir);
read_value(t, 46, config.param_table);
read_value(t, 47, config.n_qubits);
read_value(t, 48, config.global_phase);
read_value(t, 49, config.memory_slots);
read_value(t, 50, config._parallel_experiments);
read_value(t, 51, config._parallel_shots);
read_value(t, 52, config._parallel_state_update);
read_value(t, 53, config.fusion_allow_kraus);
read_value(t, 54, config.fusion_allow_superop);
read_value(t, 55, config.fusion_parallelization_threshold);
read_value(t, 56, config._fusion_enable_n_qubits);
read_value(t, 57, config._fusion_enable_n_qubits_1);
read_value(t, 58, config._fusion_enable_n_qubits_2);
read_value(t, 59, config._fusion_enable_n_qubits_3);
read_value(t, 60, config._fusion_enable_n_qubits_4);
read_value(t, 61, config._fusion_enable_n_qubits_5);
read_value(t, 62, config._fusion_enable_diagonal);
read_value(t, 63, config._fusion_min_qubit);
read_value(t, 64, config.fusion_cost_factor);
read_value(t, 65, config._fusion_enable_cost_based);
read_value(t, 66, config._fusion_cost_1);
read_value(t, 67, config._fusion_cost_2);
read_value(t, 68, config._fusion_cost_3);
read_value(t, 69, config._fusion_cost_4);
read_value(t, 70, config._fusion_cost_5);
read_value(t, 71, config._fusion_cost_6);
read_value(t, 72, config._fusion_cost_7);
read_value(t, 73, config._fusion_cost_8);
read_value(t, 74, config._fusion_cost_9);
read_value(t, 75, config._fusion_cost_10);

read_value(t, 0, config.shots);
read_value(t, 1, config.method);
read_value(t, 2, config.device);
read_value(t, 3, config.precision);
read_value(t, 4, config.enable_truncation);
read_value(t, 5, config.zero_threshold);
read_value(t, 6, config.validation_threshold);
read_value(t, 7, config.max_parallel_threads);
read_value(t, 8, config.max_parallel_experiments);
read_value(t, 9, config.max_parallel_shots);
read_value(t, 10, config.max_memory_mb);
read_value(t, 11, config.fusion_enable);
read_value(t, 12, config.fusion_verbose);
read_value(t, 13, config.fusion_max_qubit);
read_value(t, 14, config.fusion_threshold);
read_value(t, 15, config.accept_distributed_results);
read_value(t, 16, config.memory);
read_value(t, 17, config.seed_simulator);
read_value(t, 18, config.cuStateVec_enable);
read_value(t, 19, config.blocking_qubits);
read_value(t, 20, config.blocking_enable);
read_value(t, 21, config.chunk_swap_buffer_qubits);
read_value(t, 22, config.batched_shots_gpu);
read_value(t, 23, config.batched_shots_gpu_max_qubits);
read_value(t, 24, config.num_threads_per_device);
read_value(t, 25, config.statevector_parallel_threshold);
read_value(t, 26, config.statevector_sample_measure_opt);
read_value(t, 27, config.stabilizer_max_snapshot_probabilities);
read_value(t, 28, config.extended_stabilizer_sampling_method);
read_value(t, 29, config.extended_stabilizer_metropolis_mixing_time);
read_value(t, 20, config.extended_stabilizer_approximation_error);
read_value(t, 31, config.extended_stabilizer_norm_estimation_samples);
read_value(t, 32, config.extended_stabilizer_norm_estimation_repetitions);
read_value(t, 33, config.extended_stabilizer_parallel_threshold);
read_value(t, 34, config.extended_stabilizer_probabilities_snapshot_samples);
read_value(t, 35, config.matrix_product_state_truncation_threshold);
read_value(t, 36, config.matrix_product_state_max_bond_dimension);
read_value(t, 37, config.mps_sample_measure_algorithm);
read_value(t, 38, config.mps_log_data);
read_value(t, 39, config.mps_swap_direction);
read_value(t, 30, config.chop_threshold);
read_value(t, 41, config.mps_parallel_threshold);
read_value(t, 42, config.mps_omp_threads);
read_value(t, 43, config.tensor_network_num_sampling_qubits);
read_value(t, 44, config.use_cuTensorNet_autotuning);
read_value(t, 45, config.library_dir);
read_value(t, 46, config.param_table);
read_value(t, 47, config.n_qubits);
read_value(t, 48, config.global_phase);
read_value(t, 49, config.memory_slots);
read_value(t, 50, config._parallel_experiments);
read_value(t, 51, config._parallel_shots);
read_value(t, 52, config._parallel_state_update);
read_value(t, 53, config.fusion_allow_kraus);
read_value(t, 54, config.fusion_allow_superop);
read_value(t, 55, config.fusion_parallelization_threshold);
read_value(t, 56, config._fusion_enable_n_qubits);
read_value(t, 57, config._fusion_enable_n_qubits_1);
read_value(t, 58, config._fusion_enable_n_qubits_2);
read_value(t, 59, config._fusion_enable_n_qubits_3);
read_value(t, 60, config._fusion_enable_n_qubits_4);
read_value(t, 61, config._fusion_enable_n_qubits_5);
read_value(t, 62, config._fusion_enable_diagonal);
read_value(t, 63, config._fusion_min_qubit);
read_value(t, 64, config.fusion_cost_factor);
read_value(t, 65, config._fusion_enable_cost_based);
read_value(t, 66, config._fusion_cost_1);
read_value(t, 67, config._fusion_cost_2);
read_value(t, 68, config._fusion_cost_3);
read_value(t, 69, config._fusion_cost_4);
read_value(t, 70, config._fusion_cost_5);
read_value(t, 71, config._fusion_cost_6);
read_value(t, 72, config._fusion_cost_7);
read_value(t, 73, config._fusion_cost_8);
read_value(t, 74, config._fusion_cost_9);
read_value(t, 75, config._fusion_cost_10);

read_value(t, 76, config.superoperator_parallel_threshold);
read_value(t, 77, config.unitary_parallel_threshold);
read_value(t, 78, config.memory_blocking_bits);
read_value(t, 79, config.extended_stabilizer_norm_estimation_default_samples);
return config;
read_value(t, 76, config.superoperator_parallel_threshold);
read_value(t, 77, config.unitary_parallel_threshold);
read_value(t, 78, config.memory_blocking_bits);
read_value(t, 79, config.extended_stabilizer_norm_estimation_default_samples);
return config;
}));
}
#endif
2 changes: 1 addition & 1 deletion qiskit_aer/jobs/aerjobset.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def _combine_job_results(self, result_list: List[Result]):
_merge_result_list = []

for _result in result_list[1:]:
for (_master_result, _sub_result) in zip(
for _master_result, _sub_result in zip(
master_result.results, _result.results
):
_merge_result_list.append(self._merge_exp(_master_result, _sub_result))
Expand Down
2 changes: 0 additions & 2 deletions qiskit_aer/jobs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def wrapper(*args, **kw):


def _copy_qobj_for_noise(qobj, max_shot_size, qobj_id):

num_shot_jobs, shot_mod = divmod(qobj.config.shots, max_shot_size)
qobj_list = []

Expand Down Expand Up @@ -135,7 +134,6 @@ def _check_custom_instruction(experiments, optypes=None):


def _set_seed(qobj_list, seed):

# set seed number to each qobj
seed_shift = 256

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def __init__(


def _expval_params(operator, variance=False):

# Convert O to SparsePauliOp representation
if isinstance(operator, Pauli):
operator = SparsePauliOp(operator)
Expand Down
3 changes: 2 additions & 1 deletion qiskit_aer/noise/device/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ def _basic_device_target_gate_errors(

def _device_depolarizing_error(qubits, error_param, relax_error=None):
"""Construct a depolarizing_error for device.
If un-physical parameters are supplied, they are truncated to the theoretical bound values."""
If un-physical parameters are supplied, they are truncated to the theoretical bound values.
"""

# We now deduce the depolarizing channel error parameter in the
# presence of T1/T2 thermal relaxation. We assume the gate error
Expand Down
2 changes: 0 additions & 2 deletions qiskit_aer/primitives/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ def _call(
parameter_values: Sequence[Sequence[float]],
**run_options,
) -> EstimatorResult:

seed = run_options.pop("seed", None)
if seed is not None:
run_options.setdefault("seed_simulator", seed)
Expand All @@ -127,7 +126,6 @@ def _run(
parameter_values: Sequence[Sequence[float]],
**run_options,
) -> PrimitiveJob:

circuit_indices: list = []
for circuit in circuits:
index = self._circuit_ids.get(_circuit_key(circuit))
Expand Down
2 changes: 0 additions & 2 deletions qiskit_aer/pulse/controllers/digest_pulse_qobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class DigestedPulseQobj:
"""Container class for information extracted from PulseQobj."""

def __init__(self):

# ####################################
# Some "Simulation description"
# ####################################
Expand Down Expand Up @@ -448,7 +447,6 @@ def experiment_to_structs(
else:
# measurements
if inst["name"] == "acquire":

# Better way??
qlist2 = []
mlist2 = []
Expand Down
4 changes: 0 additions & 4 deletions qiskit_aer/pulse/controllers/pulse_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ def pulse_controller(qobj):
pulse_sim_desc.measurement_ops = [None] * n_qubits

for exp in pulse_sim_desc.experiments:

# Add in measurement operators
# Not sure if this will work for multiple measurements
# Note: the extraction of multiple measurements works, but the simulation routines
Expand Down Expand Up @@ -257,7 +256,6 @@ def format_exp_results(exp_results, exp_times, pulse_sim_desc):
# format the data into the proper output
all_results = []
for idx_exp, exp in enumerate(pulse_sim_desc.experiments):

m_lev = pulse_sim_desc.meas_level
m_ret = pulse_sim_desc.meas_return

Expand Down Expand Up @@ -305,9 +303,7 @@ def format_exp_results(exp_results, exp_times, pulse_sim_desc):

# meas_level 1 returns the <n>
elif m_lev == 1:

if m_ret == "avg":

memory = [np.mean(memory, 0)]

# convert into the right [real, complex] pair form for json
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/pulse/controllers/pulse_sim_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def __init__(
seeds=None,
reuse_seeds=False,
):

# set DE specific options
self.de_options = DE_Options(
method=method,
Expand Down
2 changes: 0 additions & 2 deletions qiskit_aer/pulse/de/DE_Methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class ODE_Method(ABC):
method_spec = {"inner_state_spec": {"type": "array"}}

def __init__(self, t0=None, y0=None, rhs=None, options=None):

# set_options is first as options may influence the behaviour of other functions
self.set_options(options)

Expand Down Expand Up @@ -264,7 +263,6 @@ class QiskitZVODE(ODE_Method):
method_spec = {"inner_state_spec": {"type": "array", "ndim": 1}}

def __init__(self, t0=None, y0=None, rhs=None, options=None):

# all de specification arguments are necessary to instantiate scipy ode object
if (t0 is None) or (y0 is None) or (rhs is None):
raise Exception(
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/pulse/de/DE_Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def __init__(
min_step=None,
max_dt=10**-3,
):

self.method = method
self.atol = atol
self.rtol = rtol
Expand Down
1 change: 1 addition & 0 deletions qiskit_aer/qiskit_aer/VERSION.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.12.0
Loading

0 comments on commit f3b645a

Please sign in to comment.