Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
noise_channel.h
Go to the documentation of this file.
1 /*
2 Copyright 2025 SQUANDER Contributors
3 
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 */
16 
17 #pragma once
18 
19 #include "density_matrix.h"
20 #include <string>
21 
22 namespace squander {
23 namespace density {
24 
31 class NoiseChannel {
32 public:
33  virtual ~NoiseChannel() = default;
34 
39  virtual void apply(DensityMatrix &rho) = 0;
40 
44  virtual std::string get_name() const = 0;
45 };
46 
67 public:
74  DepolarizingChannel(int qbit_num, double error_rate);
75 
76  void apply(DensityMatrix &rho) override;
77  std::string get_name() const override { return "Depolarizing"; }
78 
79  double get_error_rate() const { return error_rate_; }
80  int get_qbit_num() const { return qbit_num_; }
81 
82 private:
83  int qbit_num_;
84  double error_rate_;
85 };
86 
106 public:
113  AmplitudeDampingChannel(int target_qbit, double gamma);
114 
115  void apply(DensityMatrix &rho) override;
116  std::string get_name() const override { return "AmplitudeDamping"; }
117 
118  double get_gamma() const { return gamma_; }
119  int get_target_qbit() const { return target_qbit_; }
120 
121 private:
123  double gamma_;
124 };
125 
146 public:
153  PhaseDampingChannel(int target_qbit, double lambda);
154 
155  void apply(DensityMatrix &rho) override;
156  std::string get_name() const override { return "PhaseDamping"; }
157 
158  double get_lambda() const { return lambda_; }
159  int get_target_qbit() const { return target_qbit_; }
160 
161 private:
163  double lambda_;
164 };
165 
166 } // namespace density
167 } // namespace squander
virtual std::string get_name() const =0
Get channel name.
double lambda_
λ = 1 - exp(-t/T2)
virtual ~NoiseChannel()=default
std::string get_name() const override
Get channel name.
Definition: noise_channel.h:77
std::string get_name() const override
Get channel name.
Amplitude damping (T1 relaxation): |1⟩ → |0⟩ decay.
Depolarizing channel: ρ → (1-p)ρ + p·I/2^n.
Definition: noise_channel.h:66
virtual void apply(DensityMatrix &rho)=0
Apply noise channel to density matrix.
Base class for quantum noise channels.
Definition: noise_channel.h:31
Quantum density matrix ρ for mixed-state representation.
double gamma_
γ = 1 - exp(-t/T1)
std::string get_name() const override
Get channel name.
Phase damping (T2 dephasing): loss of coherence.