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 gbLAB
14{
15 template<typename T,int N>
16 class GramMatrix : public Eigen::Matrix<T,N,N>
17 {
18
19 template<int dim>
20 static Eigen::Matrix<T,N,N> getMatrix(const std::array<Eigen::Matrix<T,dim,1>,N>& a)
21 {
22 Eigen::Matrix<T,dim,N> X(Eigen::Matrix<T,dim,N>::Zero());
23 for(int k=0;k<N;++k)
24 {
25 X.col(k)=a[k];
26 }
27 return X.transpose()*X;
28 }
29
30
31
32 public:
33
34 template<int dim>
35 GramMatrix(const std::array<Eigen::Matrix<T,dim,1>,N>& a) :
36 /* init */ Eigen::Matrix<T,N,N>(getMatrix(a))
37 {
38
39
40 }
41
42
43 };
44
45
46
47// Rational rat(const long int& n,const long int& d)
48// {
49// return Rational(n,d);
50// }
51
52} // end namespace
53
54
55
56#endif
static Eigen::Matrix< T, N, N > getMatrix(const std::array< Eigen::Matrix< T, dim, 1 >, N > &a)
Definition GramMatrix.h:20
GramMatrix(const std::array< Eigen::Matrix< T, dim, 1 >, N > &a)
Definition GramMatrix.h:35