Class QuantumStateCpu¶
Defined in File state.hpp
Inheritance Relationships¶
Base Type¶
public QuantumStateBase
(Class QuantumStateBase)
Class Documentation¶
-
class
QuantumStateCpu
: public QuantumStateBase¶ Public Functions
-
QuantumStateCpu
(UINT qubit_count_)¶ Constructor
- Parameters
qubit_count_
: Qubit number
-
virtual
~QuantumStateCpu
()¶ Destructor
-
virtual void
set_zero_state
()¶ Initialize the quantum state to the 0 state of the computational basis
-
virtual void
set_computational_basis
(ITYPE comp_basis)¶ Initialize quantum state to basis state of
comp_basis
- Parameters
comp_basis
: An integer indicating the initializing basis
-
virtual void
set_Haar_random_state
()¶ Initialize the quantum state to Haar random sampled quantum states
-
virtual void
set_Haar_random_state
(UINT seed)¶ Initialize the quantum state to Haar random sampled quantum states using seed
-
virtual double
get_zero_probability
(UINT target_qubit_index) const¶ Calculate the probability of observing 0 when measuring the qubit at the index of
target_qubit_index
.The quantum state does not change.
- Return
double
- Parameters
target_qubit_index
:
-
virtual double
get_marginal_probability
(std::vector<UINT> measured_values) const¶ Calculate marginal probabilities when measuring multiple qubits
- Return
Calculated marginal probabilities
- Parameters
measured_values
: An array of 0,1,2 with the same length as the number of qubits. 0,1 means that the value is observed, and 2 means no measurement.
-
virtual double
get_entropy
() const¶ Calculate the entropy of the probability distribution obtained when measuring on the calculation basis.
- Return
Entropy
-
virtual double
get_squared_norm
() const¶ Calculate norm of quantum state
The norm of the quantum state becomes smaller when a non-unitary gate is applied.
- Return
Norm
-
virtual void
normalize
(double squared_norm)¶ Normalize quantum states
- Parameters
norm
: Norm of itself
-
virtual QuantumStateBase *
allocate_buffer
() const¶ Create a quantum state of the same size as a buffer.
- Return
Created quantum state
-
virtual QuantumStateBase *
copy
() const¶ Generate a deep copy of itself
- Return
Deep copy of itself
-
virtual void
load
(const QuantumStateBase *_state)¶ Copy quantum state
state
to itself
-
virtual const std::string
get_device_name
() const¶ Obtain the name of the device that holds the memory where the quantum state is located.
-
virtual void *
data
() const¶ Return the pointer of quantum state as void* type
-
virtual CPPCTYPE *
data_cpp
() const¶ Obtain quantum state as an array of
std::complex<double>
of C++- Return
Pointer of complex vector
-
virtual CTYPE *
data_c
() const¶ Obtain quantum state as an array of complex type of csim
- Return
Pointer of complex vector
-
virtual CTYPE *
duplicate_data_c
() const¶ Secure quantum state as a new array of complex type of csim
- Return
Pointer of complex vector
-
virtual CPPCTYPE *
duplicate_data_cpp
() const¶ Secure quantum state as a new array of
std::complex<double>
of C++- Return
Pointer of complex vector
-
virtual void
add_state
(const QuantumStateBase *state)¶ Add quantum state
-
virtual std::vector<ITYPE>
sampling
(UINT sampling_count)¶ Sampling the computational basis when measuring the quantum state
- Return
List of sampled values
- Parameters
[in] sampling_count
: Number of times sampling is performed
-