Template Class SparseHamiltonianMPI¶
Defined in File ObservablesGPUMPI.hpp
Class Documentation¶
-
template<class StateVectorT>
class SparseHamiltonianMPI : public SparseHamiltonianBase<StateVectorT>¶ Sparse representation of Hamiltonian<StateVectorT>
Public Types
-
using PrecisionT = typename StateVectorT::PrecisionT¶
-
using ComplexT = typename StateVectorT::ComplexT¶
-
using IdxT = typename std::conditional<std::is_same<PrecisionT, float>::value, int32_t, int64_t>::type¶
Public Functions
-
template<typename T1, typename T2, typename T3 = T2, typename T4>
inline explicit SparseHamiltonianMPI(T1 &&data, T2 &&indices, T3 &&offsets, T4 &&wires)¶ Create a SparseHamiltonianMPI from data, indices and offsets in CSR format.
- Parameters
data – Arguments to construct data
indices – Arguments to construct indices
offsets – Arguments to construct offsets
wires – Arguments to construct wires
-
inline void applyInPlace(StateVectorT &sv) const override¶
Updates the statevector SV:->SV’, where SV’ = a*H*SV, and where H is a sparse Hamiltonian.
Public Static Functions
-
static inline auto create(std::initializer_list<ComplexT> data, std::initializer_list<IdxT> indices, std::initializer_list<IdxT> offsets, std::initializer_list<std::size_t> wires) -> std::shared_ptr<SparseHamiltonianMPI<StateVectorT>>¶
Convenient wrapper for the constructor as the constructor does not convert the std::shared_ptr with a derived class correctly.
This function is useful as std::make_shared does not handle brace-enclosed initializer list correctly.
- Parameters
data – Argument to construct data
indices – Argument to construct indices
offsets – Argument to construct ofsets
wires – Argument to construct wires
-
using PrecisionT = typename StateVectorT::PrecisionT¶