Template Class StateVectorManagedCPU¶
Defined in File StateVectorManagedCPU.hpp
Inheritance Relationships¶
Base Type¶
public Pennylane::StateVectorCPU< double, StateVectorManagedCPU< double > >
(Template Class StateVectorCPU)
Class Documentation¶
-
template<class PrecisionT = double>
class StateVectorManagedCPU : public Pennylane::StateVectorCPU<double, StateVectorManagedCPU<double>>¶ StateVector class where data resides in CPU memory. Memory ownership resides within class.
- Template Parameters
PrecisionT – Precision data type
Public Types
-
using ComplexPrecisionT = std::complex<PrecisionT>¶
Public Functions
-
inline explicit StateVectorManagedCPU(size_t num_qubits, Threading threading = Threading::SingleThread, CPUMemoryModel memory_model = bestCPUMemoryModel())¶
Create a new statevector.
- 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 StateVectorManagedCPU(const StateVectorCPU<PrecisionT, OtherDerived> &other)¶ Construct a statevector from another statevector.
- Template Parameters
OtherDerived – A derived type of StateVectorCPU to use for construction.
- Parameters
other – Another statevector to construct the statevector from
-
inline StateVectorManagedCPU(const ComplexPrecisionT *other_data, 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 statvector 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 StateVectorManagedCPU(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
-
StateVectorManagedCPU(const StateVectorManagedCPU &rhs) = default¶
-
StateVectorManagedCPU(StateVectorManagedCPU&&) noexcept = default¶
-
StateVectorManagedCPU &operator=(const StateVectorManagedCPU&) = default¶
-
StateVectorManagedCPU &operator=(StateVectorManagedCPU&&) noexcept = default¶
-
~StateVectorManagedCPU() = default¶
-
inline auto getData() -> ComplexPrecisionT*¶
-
inline auto getData() const -> const ComplexPrecisionT*¶
-
inline auto getDataVector() -> std::vector<ComplexPrecisionT, Util::AlignedAllocator<ComplexPrecisionT>>&¶
Get underlying data vector.
-
inline auto getDataVector() const -> const std::vector<ComplexPrecisionT, Util::AlignedAllocator<ComplexPrecisionT>>&¶
-
template<class Alloc>
inline void updateData(const std::vector<ComplexPrecisionT, Alloc> &new_data)¶ Update data of the class to new_data.
- Template Parameters
Alloc – Allocator type of std::vector to use for updating data.
- Parameters
new_data – std::vector contains data.
-
inline Util::AlignedAllocator<ComplexPrecisionT> allocator() const¶