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.
12 template <typename Real, int NumRows, int NumCols>
13 class LexicoArray2<true, Real, NumRows, NumCols>
14{
15 public:
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
23 private:
24 Real* mMatrix;
25};
26
27 template <typename Real, int NumRows, int NumCols>
28 class LexicoArray2<false, Real, NumRows, NumCols>
29{
30 public:
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
38 private:
39 Real* mMatrix;
40};
41
42
43 template <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
52 template <typename Real> inline
53 int LexicoArray2<true, Real>::GetNumRows() const
54{
55 return mNumRows;
56}
57
58 template <typename Real> inline
59 int LexicoArray2<true, Real>::GetNumCols() const
60{
61 return mNumCols;
62}
63
64 template <typename Real> inline
65Real& LexicoArray2<true, Real>::operator()(int r, int c)
66{
67 return mMatrix[c + mNumCols*r];
68}
69
70 template <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
78 template <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
87 template <typename Real> inline
88 int LexicoArray2<false, Real>::GetNumRows() const
89{
90 return mNumRows;
91}
92
93 template <typename Real> inline
94 int LexicoArray2<false, Real>::GetNumCols() const
95{
96 return mNumCols;
97}
98
99 template <typename Real> inline
100Real& LexicoArray2<false, Real>::operator()(int r, int c)
101{
102 return mMatrix[r + mNumRows*c];
103}
104
105 template <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
113 template <typename Real, int NumRows, int NumCols> inline
114LexicoArray2<true, Real, NumRows, NumCols>::LexicoArray2(Real* matrix)
115 :
116 mMatrix(matrix)
117{
118}
119
120 template <typename Real, int NumRows, int NumCols> inline
121 int LexicoArray2<true, Real, NumRows, NumCols>::GetNumRows() const
122{
123 return NumRows;
124}
125
126 template <typename Real, int NumRows, int NumCols> inline
127 int LexicoArray2<true, Real, NumRows, NumCols>::GetNumCols() const
128{
129 return NumCols;
130}
131
132 template <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
138 template <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
146 template <typename Real, int NumRows, int NumCols> inline
147LexicoArray2<false, Real, NumRows, NumCols>::LexicoArray2(Real* matrix)
148 :
149 mMatrix(matrix)
150{
151}
152
153 template <typename Real, int NumRows, int NumCols> inline
154 int LexicoArray2<false, Real, NumRows, NumCols>::GetNumRows() const
155{
156 return NumRows;
157}
158
159 template <typename Real, int NumRows, int NumCols> inline
160 int LexicoArray2<false, Real, NumRows, NumCols>::GetNumCols() const
161{
162 return NumCols;
163}
164
165 template <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
171 template <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}