XACC
qalloc.hpp
1 /*******************************************************************************
2  * Copyright (c) 2020 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  * Alexander J. McCaskey - initial API and implementation
12  *******************************************************************************/
13 #ifndef XACC_QALLOC_HPP_
14 #define XACC_QALLOC_HPP_
15 
16 #include <map>
17 
18 namespace xacc {
19 class AcceleratorBuffer;
20 class Observable;
21 namespace internal_compiler {
22 using qubit = std::pair<std::string, std::size_t>;
23 
24 class qreg {
25 protected:
26  AcceleratorBuffer *buffer;
27 
28 public:
29  qreg() = default;
30  qreg(const int n);
31  qreg (const qreg& other);
32  qubit operator[](const std::size_t i);
33  qreg& operator=(const qreg& q);
34  AcceleratorBuffer *results();
35  std::map<std::string, int> counts();
36  double exp_val_z();
37  void reset();
38  int size();
39  void addChild(qreg& q);
40  void setName(const char *name);
41  void setNameAndStore(const char *name);
42  std::string name();
43  void store();
44  void print();
45  double weighted_sum(Observable* obs);
46 };
47 
48 } // namespace internal_compiler
49 } // namespace xacc
50 
51 xacc::internal_compiler::qreg qalloc(const int n) {
53 }
54 
55 // __qpu__ indicates this functions is for the QCOR Clang Syntax Handler
56 // and annotated with quantum for the LLVM IR CodeGen
57 #define __qpu__ [[clang::syntax(qcor)]] __attribute__((annotate("quantum")))
58 
59 #endif
Definition: Accelerator.hpp:25
Definition: qalloc.hpp:24
Definition: Observable.hpp:31
Definition: AcceleratorBuffer.hpp:117