Template Class StateVectorLQubitManaged¶
Defined in File StateVectorLQubitManaged.hpp
Inheritance Relationships¶
Base Type¶
public Pennylane::LightningQubit::StateVectorLQubit< double, StateVectorLQubitManaged< double > >
(Template Class StateVectorLQubit)
Class Documentation¶
-
template<class fp_t = double>
class StateVectorLQubitManaged : public Pennylane::LightningQubit::StateVectorLQubit<double, StateVectorLQubitManaged<double>>¶ StateVector class where data resides in CPU memory. Memory ownership resides within class.
- Template Parameters
fp_t – Precision data type
Public Types
-
using ComplexT = std::complex<PrecisionT>¶
-
using StateVectorT = StateVectorLQubitManaged<PrecisionT>¶
Public Functions
-
inline explicit StateVectorLQubitManaged(std::size_t num_qubits, Threading threading = Threading::SingleThread, CPUMemoryModel memory_model = bestCPUMemoryModel())¶
Create a new statevector in the computational basis state |0…0>
- Parameters
num_qubits – Number of qubits
threading – Threading option the statevector to use
memory_model – Memory model the statevector will use
-
template<class OtherDerived>
inline explicit StateVectorLQubitManaged(const StateVectorLQubit<PrecisionT, OtherDerived> &other)¶ Construct a statevector from another statevector.
- Template Parameters
OtherDerived – A derived type of StateVectorLQubit to use for construction.
- Parameters
other – Another statevector to construct the statevector from
-
inline StateVectorLQubitManaged(const ComplexT *other_data, std::size_t other_size, Threading threading = Threading::SingleThread, CPUMemoryModel memory_model = bestCPUMemoryModel())¶
Construct a statevector from data pointer.
- Parameters
other_data – Data pointer to construct the statevector from.
other_size – Size of the data
threading – Threading option the statevector to use
memory_model – Memory model the statevector will use
-
template<class Alloc>
inline explicit StateVectorLQubitManaged(const std::vector<std::complex<PrecisionT>, Alloc> &other, Threading threading = Threading::SingleThread, CPUMemoryModel memory_model = bestCPUMemoryModel())¶ Construct a statevector from a data vector.
- Template Parameters
Alloc – Allocator type of std::vector to use for constructing statevector.
- Parameters
other – Data to construct the statevector from
threading – Threading option the statevector to use
memory_model – Memory model the statevector will use
-
StateVectorLQubitManaged(const StateVectorLQubitManaged &rhs) = default¶
-
StateVectorLQubitManaged(StateVectorLQubitManaged&&) noexcept = default¶
-
StateVectorLQubitManaged &operator=(const StateVectorLQubitManaged&) = default¶
-
StateVectorLQubitManaged &operator=(StateVectorLQubitManaged&&) noexcept = default¶
-
~StateVectorLQubitManaged() = default¶
-
inline auto getDataVector() -> std::vector<ComplexT, AlignedAllocator<ComplexT>>&¶
Get underlying data vector.
-
inline void updateData(const ComplexT *new_data, std::size_t new_size)¶
Update data of the class to new_data.
- Parameters
new_data – data pointer to new data.
new_size – size of underlying data storage.