tket
Loading...
Searching...
No Matches
ResourceData.hpp
Go to the documentation of this file.
1// Copyright Quantinuum
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#pragma once
16
17#include <concepts>
18#include <map>
19
21
22namespace tket {
23
24template <typename T>
25concept arithmetic = std::integral<T> or std::floating_point<T>;
26
27template <arithmetic T>
31 bool operator==(const ResourceBounds<T>& other) const {
32 return min == other.min && max == other.max;
33 }
34 ResourceBounds() : min(0), max(0) {}
35 ResourceBounds(T val) : min(val), max(val) {}
36 ResourceBounds(T minval, T maxval) : min(minval), max(maxval) {}
37};
38
40 std::map<OpType, ResourceBounds<unsigned>> OpTypeCount;
42 std::map<OpType, ResourceBounds<unsigned>> OpTypeDepth;
44 bool operator==(const ResourceData& other) const;
45};
46
47template <arithmetic T>
48void to_json(nlohmann::json& j, const ResourceBounds<T>& bounds) {
49 j["min"] = bounds.min;
50 j["max"] = bounds.max;
51}
52template <arithmetic T>
53void from_json(const nlohmann::json& j, ResourceBounds<T>& bounds) {
54 bounds.min = j.at("min").get<T>();
55 bounds.max = j.at("max").get<T>();
56}
57
58JSON_DECL(ResourceData)
59
60} // namespace tket
#define JSON_DECL(T)
Definition Json.hpp:22
Defines tket::DeviceCharacterisation, used in NoiseAwarePlacement and in commute_SQ_gates_through_SWA...
Definition Path.cpp:22
void from_json(const nlohmann::json &j, Architecture::Connection &link)
void to_json(nlohmann::json &j, const Architecture::Connection &link)
ResourceBounds(T minval, T maxval)
bool operator==(const ResourceBounds< T > &other) const
ResourceBounds< unsigned > GateDepth
bool operator==(const ResourceData &other) const
ResourceBounds< unsigned > TwoQubitGateDepth
std::map< OpType, ResourceBounds< unsigned > > OpTypeDepth
std::map< OpType, ResourceBounds< unsigned > > OpTypeCount