|
| 1 | +// Copyright 2024 Xanadu Quantum Technologies Inc. |
| 2 | + |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | + |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +/** |
| 16 | + * @file ExactTNCuda.hpp |
| 17 | + * ExactTN class with cuTensorNet backend. Note that current implementation only |
| 18 | + * support the open boundary condition. |
| 19 | + */ |
| 20 | + |
| 21 | +#pragma once |
| 22 | + |
| 23 | +#include <vector> |
| 24 | + |
| 25 | +#include "DevTag.hpp" |
| 26 | +#include "TNCuda.hpp" |
| 27 | +#include "TNCudaBase.hpp" |
| 28 | +#include "TensorCuda.hpp" |
| 29 | +#include "Util.hpp" |
| 30 | + |
| 31 | +/// @cond DEV |
| 32 | +namespace { |
| 33 | +using namespace Pennylane::LightningGPU; |
| 34 | +using namespace Pennylane::LightningTensor::TNCuda; |
| 35 | +using namespace Pennylane::LightningTensor::TNCuda::Util; |
| 36 | +} // namespace |
| 37 | +/// @endcond |
| 38 | + |
| 39 | +namespace Pennylane::LightningTensor::TNCuda { |
| 40 | + |
| 41 | +/** |
| 42 | + * @brief Managed memory Exact Tensor Network class using cutensornet high-level |
| 43 | + * APIs. |
| 44 | + * |
| 45 | + * @tparam Precision Floating-point precision type. |
| 46 | + */ |
| 47 | + |
| 48 | +template <class Precision> |
| 49 | +class ExactTNCuda final : public TNCuda<Precision, ExactTNCuda<Precision>> { |
| 50 | + private: |
| 51 | + using BaseType = TNCuda<Precision, ExactTNCuda>; |
| 52 | + |
| 53 | + public: |
| 54 | + constexpr static auto method = "exacttn"; |
| 55 | + |
| 56 | + using CFP_t = decltype(cuUtil::getCudaType(Precision{})); |
| 57 | + using ComplexT = std::complex<Precision>; |
| 58 | + using PrecisionT = Precision; |
| 59 | + |
| 60 | + public: |
| 61 | + ExactTNCuda() = delete; |
| 62 | + |
| 63 | + explicit ExactTNCuda(std::size_t numQubits) : BaseType(numQubits) {} |
| 64 | + |
| 65 | + explicit ExactTNCuda(std::size_t numQubits, DevTag<int> dev_tag) |
| 66 | + : BaseType(numQubits, dev_tag) {} |
| 67 | + |
| 68 | + ~ExactTNCuda() = default; |
| 69 | +}; |
| 70 | +} // namespace Pennylane::LightningTensor::TNCuda |
0 commit comments