NeuralEngine
A Game Engine with embeded Machine Learning algorithms based on Gaussian Processes.
NeLexicoArray2.inl
1
11// The array dimensions are known at compile time.
12template <typename Real, int NumRows, int NumCols>
13class LexicoArray2<true, Real, NumRows, NumCols>
14{
15public:
16 inline LexicoArray2(Real* matrix);
17
18 inline int GetNumRows() const;
19 inline int GetNumCols() const;
20 inline Real& operator()(int r, int c);
21 inline Real const& operator()(int r, int c) const;
22
23private:
24 Real* mMatrix;
25};
26
27template <typename Real, int NumRows, int NumCols>
28class LexicoArray2<false, Real, NumRows, NumCols>
29{
30public:
31 inline LexicoArray2(Real* matrix);
32
33 inline int GetNumRows() const;
34 inline int GetNumCols() const;
35 inline Real& operator()(int r, int c);
36 inline Real const& operator()(int r, int c) const;
37
38private:
39 Real* mMatrix;
40};
41
42
43template <typename Real> inline
44LexicoArray2<true, Real>::LexicoArray2(int numRows, int numCols, Real* matrix)
45 :
46 mNumRows(numRows),
47 mNumCols(numCols),
48 mMatrix(matrix)
49{
50}
51
52template <typename Real> inline
53int LexicoArray2<true, Real>::GetNumRows() const
54{
55 return mNumRows;
56}
57
58template <typename Real> inline
59int LexicoArray2<true, Real>::GetNumCols() const
60{
61 return mNumCols;
62}
63
64template <typename Real> inline
65Real& LexicoArray2<true, Real>::operator()(int r, int c)
66{
67 return mMatrix[c + mNumCols*r];
68}
69
70template <typename Real> inline
71Real const& LexicoArray2<true, Real>::operator()(int r, int c) const
72{
73 return mMatrix[c + mNumCols*r];
74}
75
76
77
78template <typename Real> inline
79LexicoArray2<false, Real>::LexicoArray2(int numRows, int numCols, Real* matrix)
80 :
81 mNumRows(numRows),
82 mNumCols(numCols),
83 mMatrix(matrix)
84{
85}
86
87template <typename Real> inline
88int LexicoArray2<false, Real>::GetNumRows() const
89{
90 return mNumRows;
91}
92
93template <typename Real> inline
94int LexicoArray2<false, Real>::GetNumCols() const
95{
96 return mNumCols;
97}
98
99template <typename Real> inline
100Real& LexicoArray2<false, Real>::operator()(int r, int c)
101{
102 return mMatrix[r + mNumRows*c];
103}
104
105template <typename Real> inline
106Real const& LexicoArray2<false, Real>::operator()(int r, int c) const
107{
108 return mMatrix[r + mNumRows*c];
109}
110
111
112
113template <typename Real, int NumRows, int NumCols> inline
114LexicoArray2<true, Real, NumRows, NumCols>::LexicoArray2(Real* matrix)
115 :
116 mMatrix(matrix)
117{
118}
119
120template <typename Real, int NumRows, int NumCols> inline
121int LexicoArray2<true, Real, NumRows, NumCols>::GetNumRows() const
122{
123 return NumRows;
124}
125
126template <typename Real, int NumRows, int NumCols> inline
127int LexicoArray2<true, Real, NumRows, NumCols>::GetNumCols() const
128{
129 return NumCols;
130}
131
132template <typename Real, int NumRows, int NumCols> inline
133Real& LexicoArray2<true, Real, NumRows, NumCols>::operator()(int r, int c)
134{
135 return mMatrix[c + NumCols*r];
136}
137
138template <typename Real, int NumRows, int NumCols> inline
139Real const& LexicoArray2<true, Real, NumRows, NumCols>::operator()(int r, int c) const
140{
141 return mMatrix[c + NumCols*r];
142}
143
144
145
146template <typename Real, int NumRows, int NumCols> inline
147LexicoArray2<false, Real, NumRows, NumCols>::LexicoArray2(Real* matrix)
148 :
149 mMatrix(matrix)
150{
151}
152
153template <typename Real, int NumRows, int NumCols> inline
154int LexicoArray2<false, Real, NumRows, NumCols>::GetNumRows() const
155{
156 return NumRows;
157}
158
159template <typename Real, int NumRows, int NumCols> inline
160int LexicoArray2<false, Real, NumRows, NumCols>::GetNumCols() const
161{
162 return NumCols;
163}
164
165template <typename Real, int NumRows, int NumCols> inline
166Real& LexicoArray2<false, Real, NumRows, NumCols>::operator()(int r, int c)
167{
168 return mMatrix[r + NumRows*c];
169}
170
171template <typename Real, int NumRows, int NumCols> inline
172Real const& LexicoArray2<false, Real, NumRows, NumCols>::operator()(int r, int c) const
173{
174 return mMatrix[r + NumRows*c];
175}