GQCP
Loading...
Searching...
No Matches
UTransformation.hpp
Go to the documentation of this file.
1// This file is part of GQCG-GQCP.
2//
3// Copyright (C) 2017-2020 the GQCG developers
4//
5// GQCG-GQCP is free software: you can redistribute it and/or modify
6// it under the terms of the GNU Lesser General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// GQCG-GQCP is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU Lesser General Public License for more details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with GQCG-GQCP. If not, see <http://www.gnu.org/licenses/>.
17
18#pragma once
19
20
27#include "Utilities/complex.hpp"
28
29
30namespace GQCP {
31
32
33/*
34 * MARK: UTransformation implementation
35 */
36
42template <typename _Scalar>
44 public SpinResolvedBase<UTransformationComponent<_Scalar>, UTransformation<_Scalar>>,
45 public SpinResolvedBasisTransformable<UTransformation<_Scalar>>,
46 public SpinResolvedJacobiRotatable<UTransformation<_Scalar>> {
47public:
48 // The scalar type used for a transformation coefficient: real or complex.
49 using Scalar = _Scalar;
50
51 // The type of the transformation for which the basis transformation should be defined. A transformation should naturally be transformable with itself.
53
54 // The type of 'this'.
56
57 // The type component this spin resolved object is made of.
59
60
61public:
62 /*
63 * MARK: Constructors
64 */
65
66 // Inherit `SpinResolvedBase`'s constructors.
68
69
70 /*
71 * MARK: Named constructors
72 */
73
82
83 // Wrap the restricted transformation in the correct class and return the result.
84 const UTransformationComponent<Scalar> T_component {T.matrix()};
85 return UTransformation<Scalar>::FromEqual(T_component);
86 }
87
88
97 static UTransformation<Scalar> Identity(const size_t dim_alpha, const size_t dim_beta) {
98
99 const auto T_alpha = UTransformationComponent<Scalar>::Identity(dim_alpha);
100 const auto T_beta = UTransformationComponent<Scalar>::Identity(dim_beta);
101
102 return UTransformation<Scalar> {T_alpha, T_beta};
103 }
104
105
113 static UTransformation<Scalar> Identity(const size_t dim) { return UTransformation<Scalar>::Identity(dim, dim); }
114
115
123 static UTransformation<Scalar> Random(const size_t dim) {
124
125 const auto T_alpha = UTransformationComponent<Scalar>::Random(dim);
126 const auto T_beta = UTransformationComponent<Scalar>::Random(dim);
127
128 return UTransformation<Scalar> {T_alpha, T_beta};
129 }
130
131
139 static UTransformation<Scalar> RandomUnitary(const size_t dim) {
140
141 const auto T_alpha = UTransformationComponent<Scalar>::RandomUnitary(dim);
143
144 return UTransformation<Scalar> {T_alpha, T_beta};
145 }
146
147
148 /*
149 * MARK: Linear algebraic operations
150 */
151
157 bool isUnitary(const double threshold) const { return this->alpha().isUnitary(threshold) && this->beta().isUnitary(threshold); }
158
159
164
165 auto result = *this;
166
167 // The inverse of this compound transformation is the transformation where the alpha- and beta-transformations are inverted.
168 result.alpha() = this->alpha().inverse();
169 result.beta() = this->beta().inverse();
170
171 return result;
172 }
173
174
179 // Since `rotate` and `rotated` are both defined in `SpinResolvedBasisTransformable` and `SpinResolvedJacobiRotatable`, we have to explicitly enable these methods here.
180
181 // Allow the `rotate` method from `SpinResolvedBasisTransformable`, since there's also a `rotate` from `SpinResolvedJacobiRotatable`.
183
184 // Allow the `rotated` method from `SpinResolvedBasisTransformable`, since there's also a `rotated` from `SpinResolvedJacobiRotatable`.
186
187 // Allow the `rotate` method from `SpinResolvedJacobiRotatable`, since there's also a `rotate` from `SpinResolvedBasisTransformable`.
189
190 // Allow the `rotated` method from `SpinResolvedJacobiRotatable`, since there's also a `rotated` from `SpinResolvedBasisTransformable`.
192};
193
194
195/*
196 * MARK: BasisTransformableTraits
197 */
198
202template <typename Scalar>
204
205 // The type of the transformation for which the basis transformation should be defined. A transformation matrix should naturally be transformable with itself.
207};
208
209
210/*
211 * MARK: JacobiRotatableTraits
212 */
213
217template <typename Scalar>
219
220 // The type of Jacobi rotation for which the Jacobi rotation should be defined.
222};
223
224
225/*
226 * MARK: OrbitalRotationGeneratorTraits
227 */
228
232template <typename Scalar>
234
235 // The type of orbital rotation generators associated with a `UTransformation`.
237};
238
239
240} // namespace GQCP
void rotate(const Transformation &U)
Definition: BasisTransformable.hpp:107
Definition: RTransformation.hpp:41
DerivedTransformation inverse() const
Definition: SimpleTransformation.hpp:183
const SquareMatrix< Scalar > & matrix() const
Definition: SimpleTransformation.hpp:168
static DerivedTransformation Random(const size_t dim)
Definition: SimpleTransformation.hpp:129
bool isUnitary(const double threshold=1.0e-12) const
Definition: SimpleTransformation.hpp:192
static DerivedTransformation RandomUnitary(const size_t dim)
Definition: SimpleTransformation.hpp:136
static DerivedTransformation Identity(const size_t dim)
Definition: SimpleTransformation.hpp:122
Definition: SpinResolvedBase.hpp:39
UTransformationComponent< _Scalar > Of
Definition: SpinResolvedBase.hpp:42
static Derived FromEqual(const Of &equal)
Definition: SpinResolvedBase.hpp:118
Definition: SpinResolvedBasisTransformable.hpp:34
Definition: SpinResolvedJacobiRotatable.hpp:35
UTransformation< _Scalar > rotated(const JacobiRotationType &jacobi_rotation) const override
Definition: SpinResolvedJacobiRotatable.hpp:54
Definition: UJacobiRotation.hpp:32
Definition: UOrbitalRotationGenerators.hpp:42
Definition: UTransformationComponent.hpp:41
Definition: UTransformation.hpp:46
static UTransformation< Scalar > Random(const size_t dim)
Definition: UTransformation.hpp:123
static UTransformation< Scalar > RandomUnitary(const size_t dim)
Definition: UTransformation.hpp:139
UTransformation< Scalar > Self
Definition: UTransformation.hpp:55
UTransformation< Scalar > inverse() const
Definition: UTransformation.hpp:163
static UTransformation< Scalar > Identity(const size_t dim)
Definition: UTransformation.hpp:113
_Scalar Scalar
Definition: UTransformation.hpp:49
static UTransformation< Scalar > FromRestricted(const RTransformation< Scalar > &T)
Definition: UTransformation.hpp:81
static UTransformation< Scalar > Identity(const size_t dim_alpha, const size_t dim_beta)
Definition: UTransformation.hpp:97
bool isUnitary(const double threshold) const
Definition: UTransformation.hpp:157
typename SpinResolvedBase< UTransformationComponent< Scalar >, Self >::Of ComponentType
Definition: UTransformation.hpp:58
Definition: BaseOneElectronIntegralBuffer.hpp:25
Definition: BasisTransformable.hpp:37
Definition: JacobiRotatable.hpp:37
Definition: OrbitalRotationGeneratorTraits.hpp:28