oILAB
Loading...
Searching...
No Matches
GramMatrix.h
Go to the documentation of this file.
1/* This file is part of gbLAB.
2 *
3 * gbLAB is distributed without any warranty under the MIT License.
4 */
5
6
7#ifndef gbLAB_GramMatrix_h_
8#define gbLAB_GramMatrix_h_
9
10#include <Eigen/Core>
11#include <array>
12
13namespace oILAB {
14template <typename T, int N> class GramMatrix : public Eigen::Matrix<T, N, N> {
15
16 template <int dim>
17 static Eigen::Matrix<T, N, N>
18 getMatrix(const std::array<Eigen::Matrix<T, dim, 1>, N> &a) {
19 Eigen::Matrix<T, dim, N> X(Eigen::Matrix<T, dim, N>::Zero());
20 for (int k = 0; k < N; ++k) {
21 X.col(k) = a[k];
22 }
23 return X.transpose() * X;
24 }
25
26public:
27 template <int dim>
28 GramMatrix(const std::array<Eigen::Matrix<T, dim, 1>, N> &a)
29 : /* init */ Eigen::Matrix<T, N, N>(getMatrix(a)) {}
30
31
32 };
33
34
35
36// Rational rat(const long int& n,const long int& d)
37// {
38// return Rational(n,d);
39// }
40
41 } // namespace oILAB
42
43#endif
GramMatrix(const std::array< Eigen::Matrix< T, dim, 1 >, N > &a)
Definition GramMatrix.h:28
static Eigen::Matrix< T, N, N > getMatrix(const std::array< Eigen::Matrix< T, dim, 1 >, N > &a)
Definition GramMatrix.h:18