StatMech
Loading...
Searching...
No Matches
EigenExpValues.cuh File Reference

Functions

template<class Matrix1 , class Matrix2 >
auto EigenExpValues (ObjectOnGPU< Matrix1 > const &eigenvectors, ObjectOnGPU< Matrix2 > const &observable) -> Eigen::VectorX< typename Matrix1::RealScalar >
 

Function Documentation

◆ EigenExpValues()

template<class Matrix1 , class Matrix2 >
auto EigenExpValues ( ObjectOnGPU< Matrix1 > const &  eigenvectors,
ObjectOnGPU< Matrix2 > const &  observable 
) -> Eigen::VectorX<typename Matrix1::RealScalar>
inline
11 {
12 auto const dim = eigenvectors.cols();
13 auto tmp1 = observable * eigenvectors;
14 Eigen::VectorX<typename Matrix1::RealScalar> expvals(dim);
15
16 magma_int_t dev = 0;
17 magma_getdevice(&dev);
18 std::vector<magma_queue_t> queue(omp_get_max_threads(), NULL);
19 for(int j = 0; j < queue.size(); ++j) magma_queue_create(dev, &queue[j]);
20#pragma omp parallel for
21 for(int j = 0; j < dim; ++j) {
22 expvals(j)
23 = real(magma_dotc_wrapper(dim, eigenvectors.data() + j * eigenvectors.LD(), 1,
24 tmp1.data() + j * tmp1.LD(), 1, queue[omp_get_thread_num()]));
25 }
26 for(int j = 0; j < queue.size(); ++j) magma_queue_destroy(queue[j]);
27
28 return expvals;
29}