pairinteraction
A Rydberg Interaction Calculator
TransformationType.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2024 Pairinteraction Developers
2// SPDX-License-Identifier: LGPL-3.0-or-later
3
4#pragma once
5
6#include <set>
7#include <vector>
8
9namespace pairinteraction {
10enum class TransformationType : unsigned char {
11 IDENTITY = 0,
12 SORT_BY_KET = 1 << 0,
15 SORT_BY_PARITY = 1 << 3,
16 SORT_BY_ENERGY = 1 << 4,
17 ROTATE = 1 << 5,
18 ARBITRARY = 1 << 6
19};
20
22 return static_cast<TransformationType>(static_cast<unsigned char>(x) &
23 static_cast<unsigned char>(y));
24}
26 return static_cast<TransformationType>(static_cast<unsigned char>(x) |
27 static_cast<unsigned char>(y));
28}
30 return static_cast<TransformationType>(~static_cast<unsigned char>(x));
31}
32
33namespace utils {
34inline bool is_sorting(TransformationType label) {
35 static constexpr TransformationType MASK_SORTING = TransformationType::SORT_BY_KET |
39 return (label & ~MASK_SORTING) == TransformationType::IDENTITY;
40}
41
42} // namespace utils
43} // namespace pairinteraction
bool is_sorting(TransformationType label)
constexpr TransformationType operator|(TransformationType x, TransformationType y)
constexpr TransformationType operator~(TransformationType x)
constexpr TransformationType operator&(TransformationType x, TransformationType y)