C++ core

namespace core
class CppCore
#include <cpp_core.hpp>

Subclassed by mindquantum::python::CppCore

Public Types

using gate_t = ops::Command::gate_t

Provide ProjectQ’s functionality in C++.

using engine_list_t = std::vector<cengines::engine_t>
using circuit_t = td::Circuit
using instruction_t = CircuitManager::instruction_t
using Complex = std::complex<double>
using c_type = std::complex<double>
using ArrayType = std::vector<c_type, ::projectq::aligned_allocator<c_type, 64>>
using MatrixType = std::vector<ArrayType>

Public Functions

CppCore()
CppCore(CppCore const&) = delete
CppCore operator=(CppCore const&) = delete
inline bool sim_backend() const
void set_engine_list(const engine_list_t &engine_list)
void set_simulator_backend(::projectq::Simulator &sim)
void allocate_qubit(unsigned id)

Allocate a single qubit.

void apply_command(const ops::Command &cmd)

Apply a ProjectQ command.

void flush()

Execute stored gates.

void traverse_engine_list()

Go through all engines in engine_list_.

Gets called in beginning of flush()

std::map<unsigned, bool> get_measure_info()

Return measurement outcomes.

Returns

A map where the key values are the measured qubits’ IDs and the mapped values are the measurement outcomes

void set_output_stream(std::string_view file_name)

Set output file name (stdout for printing to standard output)

void write(std::string_view format)

Output Quantum circuit to standard output.

Parameters

format – in which to output circuit

inline auto cheat()

Return state vector.

Returns

A map where the key values are the allocated qubits’ ids and the mapped values are their positions in the ket: |q_n, q_(n-1), …, q_1, q_0>

Returns

The current state vector of the allocated qubits