Sequential Quantum Gate Decomposer  v1.9.6
Powerful decomposition of general unitarias into one- and two-qubit gates gates
density_operation.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 <memory>
20 #include <string>
21 
22 namespace squander {
23 namespace density {
24 
25 // Forward declaration
26 class DensityMatrix;
27 
42 public:
43  virtual ~IDensityOperation() = default;
44 
52  virtual void apply_to_density(const double *params, int param_count,
53  DensityMatrix &rho) = 0;
54 
59  virtual int get_parameter_num() const = 0;
60 
65  virtual std::string get_name() const = 0;
66 
71  virtual bool is_unitary() const = 0;
72 
77  virtual std::unique_ptr<IDensityOperation> clone() const = 0;
78 };
79 
80 } // namespace density
81 } // namespace squander
82 
virtual std::unique_ptr< IDensityOperation > clone() const =0
Create a deep copy of this operation.
Quantum density matrix ρ for mixed-state representation.
virtual void apply_to_density(const double *params, int param_count, DensityMatrix &rho)=0
Apply this operation to the density matrix.
Interface for any operation that can be applied to a density matrix.
virtual bool is_unitary() const =0
Check if this is a unitary operation (gate) or non-unitary (noise)
virtual int get_parameter_num() const =0
Get number of free parameters this operation requires.
virtual std::string get_name() const =0
Get operation name for debugging/display.