XACC
aswap.hpp
1 /*******************************************************************************
2  * Copyright (c) 2019 UT-Battelle, LLC.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and Eclipse Distribution License v1.0 which accompanies this
6  * distribution. The Eclipse Public License is available at
7  * http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution
8  *License is available at https://eclipse.org/org/documents/edl-v10.php
9  *
10  * Contributors:
11  * Thien Nguyen - initial API and implementation
12  *******************************************************************************/
13 
14 #pragma once
15 
16 #include "Circuit.hpp"
17 #include "IRProvider.hpp"
18 
19 namespace xacc {
20 namespace circuits {
21 
23 {
24 public:
25  ASWAP();
26  bool expand(const xacc::HeterogeneousMap& runtimeOptions) override;
27  const std::vector<std::string> requiredKeys() override;
28  const std::vector<std::string>& getParamList() const { return m_paramList; }
29  DEFINE_CLONE(ASWAP);
30 private:
31  void initializeParamList();
32  void constructCircuit();
33  // A few short-hand funcs to help circuit construction
34  void CNOT(int in_q1, int in_q2);
35  void X(int in_qubit);
36  void H(int in_qubit);
37  void Rx(int in_qubit, const std::string& in_param);
38  void Rx(int in_qubit, double in_angle);
39  void Ry(int in_qubit, const std::string& in_param);
40  void Ry(int in_qubit, double in_angle);
41  void Rz(int in_qubit, const std::string& in_param);
42  void Rz(int in_qubit, double in_angle);
43 
44  // Add an A gate (see FIG. 2) between two arbitrary qubits
45  // The rotation gates are parameterized by the variable names provided.
46  void addAGate(int in_q1, int in_q2, const std::string& in_thetaParam, const std::string& in_phiParam);
47 private:
48  int m_nbQubits;
49  size_t m_nbParticles;
50  bool m_timeReversalSymmetry;
51  double m_szSymmetry;
52  std::vector<std::string> m_paramList;
53  std::shared_ptr<xacc::IRProvider> m_gateRegistry;
54 };
55 
56 } // namespace circuits
57 } // namespace xacc
Definition: Circuit.hpp:29
Definition: Accelerator.hpp:25
Definition: heterogeneous.hpp:45
Definition: aswap.hpp:22