Qrack  1.7
General classical-emulating-quantum development framework
qfactory.hpp
Go to the documentation of this file.
1 //
3 // (C) Daniel Strano and the Qrack contributors 2017, 2018. All rights reserved.
4 //
5 // This is a multithreaded, universal quantum register simulation, allowing
6 // (nonphysical) register cloning and direct measurement of probability and
7 // phase, to leverage what advantages classical emulation of qubits can have.
8 //
9 // Licensed under the GNU General Public License V3.
10 // See LICENSE.md in the project root or https://www.gnu.org/licenses/gpl-3.0.en.html
11 // for details.
12 
13 #pragma once
14 
15 #include "qengine_cpu.hpp"
16 
17 #if ENABLE_OPENCL
18 #include "qengine_opencl_multi.hpp"
19 #endif
20 
21 #include "qunit.hpp"
22 
23 namespace Qrack {
24 
26 template <typename... Ts>
28 {
29  switch (engine) {
30  case QINTERFACE_CPU:
31  return std::make_shared<QEngineCPU>(args...);
32 #if ENABLE_OPENCL
33  case QINTERFACE_OPENCL:
34  return std::make_shared<QEngineOCL>(args...);
36  return std::make_shared<QEngineOCLMulti>(args...);
37 #endif
38  case QINTERFACE_QUNIT:
39  return std::make_shared<QUnit>(subengine, args...);
40  default:
41  return NULL;
42  }
43 }
44 
45 } // namespace Qrack
Create a QEngineOCL, derived from QEngineCPU, leveraging OpenCL hardware to increase the speed of cer...
Definition: qinterface.hpp:64
QInterfaceEngine
Enumerated list of supported engines.
Definition: qinterface.hpp:54
Create a QUnit, which utilizes other QInterface classes to minimize the amount of work that&#39;s needed ...
Definition: qinterface.hpp:80
QInterfacePtr CreateQuantumInterface(QInterfaceEngine engine, QInterfaceEngine subengine, Ts...args)
Factory method to create specific engine implementations.
Definition: qfactory.hpp:27
std::shared_ptr< QInterface > QInterfacePtr
Definition: qinterface.hpp:46
Definition: complex16simd.hpp:21
Create a QEngineOCLMUlti, composed from multiple QEngineOCLs, using OpenCL in parallel across 2^N dev...
Definition: qinterface.hpp:70
Create a QEngineCPU leveraging only local CPU and memory resources.
Definition: qinterface.hpp:59