35#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LIN_ALG_ALGORITHMS_HPP
36#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_LIN_ALG_ALGORITHMS_HPP
51template <
typename DataType>
59 unsigned int dim = x[0].GetDimension();
60 std::vector<VectorType>
q(x.size(), VectorType());
66 r(0, 0) = x[0].L2Norm();
68 if (r(0, 0) == DataType(0))
73 q[0] = x[0] / r(0, 0);
75 for (
unsigned int j = 1; j < x.size(); ++j)
77 for (
unsigned int i = 0; i <= j - 1; ++i)
79 r(i, j) =
q[i].Dot(x[j]);
83 for (
unsigned int i = 0; i <= j - 1; ++i)
85 y = y - r(i, j) *
q[i];
89 if (r(j, j) == DataType(0))
std::vector< double > q(NPUPPER *NPUPPER)
The above copyright notice and this permission notice shall be included.
std::vector< NekVector< DataType > > GramSchmidtOrthogonalization(const std::vector< NekVector< DataType > > &x)
Calculates the orthogonal, normalized vectors from linearly independent input.