Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 :
8 : #include "DataStructures/Tensor/Metafunctions.hpp"
9 : #include "DataStructures/Tensor/TypeAliases.hpp"
10 : #include "Utilities/Gsl.hpp"
11 :
12 : /*!
13 : * \brief Orthonormalize a set of vectors using the modified Gram-Schmidt
14 : * process.
15 : *
16 : * The first vector in `basis` is normalized, then each subsequent vector is
17 : * orthogonalized against all previous vectors and then normalized.
18 : */
19 : template <typename DataType, typename Index, size_t NumVectors>
20 1 : void gram_schmidt_orthonormalize(
21 : const std::array<
22 : gsl::not_null<Tensor<DataType, Symmetry<1>, index_list<Index>>*>,
23 : NumVectors>& basis,
24 : const Tensor<DataType, Symmetry<1, 1>,
25 : index_list<change_index_up_lo<Index>,
26 : change_index_up_lo<Index>>>& metric);
|