forked from NVIDIA/cuda-quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcudm_expectation.h
More file actions
35 lines (31 loc) · 1.42 KB
/
cudm_expectation.h
File metadata and controls
35 lines (31 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/****************************************************************-*- C++ -*-****
* Copyright (c) 2022 - 2025 NVIDIA Corporation & Affiliates. *
* All rights reserved. *
* *
* This source code and the accompanying materials are made available under *
* the terms of the Apache License 2.0 which accompanies this distribution. *
******************************************************************************/
#pragma once
#include <complex>
#include <cudensitymat.h>
namespace cudaq {
class cudm_expectation {
cudensitymatHandle_t m_handle{nullptr};
cudensitymatOperator_t m_hamOp{nullptr};
cudensitymatExpectation_t m_expectation{nullptr};
cudensitymatWorkspaceDescriptor_t m_workspace{nullptr};
public:
cudm_expectation(cudensitymatHandle_t handle, cudensitymatOperator_t op);
cudm_expectation(const cudm_expectation &) = delete;
cudm_expectation &operator=(const cudm_expectation &) = delete;
cudm_expectation(cudm_expectation &&src) {
std::swap(m_handle, src.m_handle);
std::swap(m_hamOp, src.m_hamOp);
std::swap(m_expectation, src.m_expectation);
std::swap(m_workspace, src.m_workspace);
}
~cudm_expectation();
void prepare(cudensitymatState_t state);
std::complex<double> compute(cudensitymatState_t state, double time);
};
} // namespace cudaq