fmatvec 0.0.0

symbolic_function.h
1 #ifndef _FMATVEC_SYMBOLIC_FUNCTION_H_
2 #define _FMATVEC_SYMBOLIC_FUNCTION_H_
3
4 #include "function.h"
5 #include "ast.h"
6 #include "symbolic.h"
7
8 namespace fmatvec {
9
10 namespace {
11 template<class ATIndep>
12 struct Helper {
13 static void initIndep(ATIndep &x, int size) { x=ATIndep(); }
14 static int size1(const ATIndep &x) { return 1; }
15 static int size2(const ATIndep &x) { return 1; }
16 };
17
18 template<class Shape, class ATIndep>
19 struct Helper<Vector<Shape, ATIndep>> {
20 static void initIndep(Vector<Shape, ATIndep> &x, int size) { x <<= Vector<Shape, ATIndep>(size, NONINIT); }
21 static int size1(const Vector<Shape, ATIndep> &x) { return x.size(); }
22 static int size2(const Vector<Shape, ATIndep> &x) { return 1; }
23 };
24
25 template<class Type, class RowShape, class ColShape, class ATIndep>
26 struct Helper<Matrix<Type, RowShape, ColShape, ATIndep>> {
27 static int size1(const Matrix<Type, RowShape, ColShape, ATIndep> &x) { return x.rows(); }
28 static int size2(const Matrix<Type, RowShape, ColShape, ATIndep> &x) { return x.cols(); }
29 };
30 }
31
32 template<typename Sig>
33 class SymbolicFunction;
34
35 #define RET Ret
36 #define ARG ATArg
37 #define TEMPLATE typename Ret, typename ATArg
38 #define PARDER
39 #define PARDERPARDER
40 #include "symbolic_function1_temp.h"
41 #undef RET
42 #undef ARG
43 #undef TEMPLATE
44 #undef PARDER
45 #undef PARDERPARDER
46
47 #define RET Ret
48 #define ARG Vector<ArgShape, ATArg>
49 #define TEMPLATE typename Ret, typename ArgShape, typename ATArg
50 #define PARDER
51 //#define PARDERPARDER
52 #include "symbolic_function1_temp.h"
53 #undef RET
54 #undef ARG
55 #undef TEMPLATE
56 #undef PARDER
57 #undef PARDERPARDER
58
59 #define RET RowVector<RetShape, ATRet>
60 #define ARG Vector<ArgShape, ATArg>
61 #define TEMPLATE typename RetShape, typename ATRet, typename ArgShape, typename ATArg
62 //#define PARDER
63 //#define PARDERPARDER
64 #include "symbolic_function1_temp.h"
65 #undef RET
66 #undef ARG
67 #undef TEMPLATE
68 #undef PARDER
69 #undef PARDERPARDER
70
71 #define RET Matrix<Type, ColShape, RowShape, ATRet>
72 #define ARG Vector<ArgShape, ATArg>
73 #define TEMPLATE typename Type, typename ColShape, typename RowShape, typename ATRet, typename ArgShape, typename ATArg
74 //#define PARDER
75 //#define PARDERPARDER
76 #include "symbolic_function1_temp.h"
77 #undef RET
78 #undef ARG
79 #undef TEMPLATE
80 #undef PARDER
81 #undef PARDERPARDER
82
83 #define RET Matrix<Rotation, Fixed<3>, Fixed<3>, ATRet>
84 #define ARG Vector<ArgShape, ATArg>
85 #define TEMPLATE typename ATRet, typename ArgShape, typename ATArg
86 #define PARDER
87 //#define PARDERPARDER
88 #include "symbolic_function1_temp.h"
89 #undef RET
90 #undef ARG
91 #undef TEMPLATE
92 #undef PARDER
93 #undef PARDERPARDER
94
95
96
97 #define RET Ret
98 #define ARG1 ATArg1
99 #define ARG2 ATArg2
100 #define TEMPLATE typename Ret, typename ATArg1, typename ATArg2
101 #define PARDER1
102 #define PARDER2
103 #define PARDER1PARDER1
104 #define PARDER2PARDER2
105 #define PARDER1PARDER2
106 #include "symbolic_function2_temp.h"
107 #undef RET
108 #undef ARG1
109 #undef ARG2
110 #undef TEMPLATE
111 #undef PARDER1
112 #undef PARDER2
113 #undef PARDER1PARDER1
114 #undef PARDER2PARDER2
115 #undef PARDER1PARDER2
116
117 #define RET Ret
118 #define ARG1 Vector<Shape, ATArg>
119 #define ARG2 ATArg
120 #define TEMPLATE typename Ret, typename Shape, typename ATArg
121 #define PARDER1
122 #define PARDER2
123 //#define PARDER1PARDER1
124 #define PARDER2PARDER2
125 #define PARDER1PARDER2
126 #include "symbolic_function2_temp.h"
127 #undef RET
128 #undef ARG1
129 #undef ARG2
130 #undef TEMPLATE
131 #undef PARDER1
132 #undef PARDER2
133 #undef PARDER1PARDER1
134 #undef PARDER2PARDER2
135 #undef PARDER1PARDER2
136
137 #define RET Matrix<Rotation, Fixed<3>, Fixed<3>, ATRet>
138 #define ARG1 Vector<Shape, ATArg>
139 #define ARG2 ATArg
140 #define TEMPLATE typename ATRet, typename Shape, typename ATArg
141 #define PARDER1
142 #define PARDER2
143 //#define PARDER1PARDER1
144 #define PARDER2PARDER2
145 #define PARDER1PARDER2
146 #include "symbolic_function2_temp.h"
147 #undef RET
148 #undef ARG1
149 #undef ARG2
150 #undef TEMPLATE
151 #undef PARDER1
152 #undef PARDER2
153 #undef PARDER1PARDER1
154 #undef PARDER2PARDER2
155 #undef PARDER1PARDER2
156
157 #define RET Ret
158 #define ARG1 ATArg
159 #define ARG2 Vector<Shape, ATArg>
160 #define TEMPLATE typename Ret, typename Shape, typename ATArg
161 #define PARDER1
162 #define PARDER2
163 #define PARDER1PARDER1
164 //#define PARDER2PARDER2
165 #define PARDER1PARDER2
166 #include "symbolic_function2_temp.h"
167 #undef RET
168 #undef ARG1
169 #undef ARG2
170 #undef TEMPLATE
171 #undef PARDER1
172 #undef PARDER2
173 #undef PARDER1PARDER1
174 #undef PARDER2PARDER2
175 #undef PARDER1PARDER2
176
177 #define RET Matrix<Rotation, Fixed<3>, Fixed<3>, ATRet>
178 #define ARG1 ATArg
179 #define ARG2 Vector<Shape, ATArg>
180 #define TEMPLATE typename ATRet, typename Shape, typename ATArg
181 #define PARDER1
182 #define PARDER2
183 #define PARDER1PARDER1
184 //#define PARDER2PARDER2
185 #define PARDER1PARDER2
186 #include "symbolic_function2_temp.h"
187 #undef RET
188 #undef ARG1
189 #undef ARG2
190 #undef TEMPLATE
191 #undef PARDER1
192 #undef PARDER2
193 #undef PARDER1PARDER1
194 #undef PARDER2PARDER2
195 #undef PARDER1PARDER2
196
197 #define RET Ret
198 #define ARG1 Vector<Shape1, ATArg>
199 #define ARG2 Vector<Shape2, ATArg>
200 #define TEMPLATE typename Ret, typename Shape1, typename Shape2, typename ATArg
201 #define PARDER1
202 #define PARDER2
203 //#define PARDER1PARDER1
204 //#define PARDER2PARDER2
205 //#define PARDER1PARDER2
206 #include "symbolic_function2_temp.h"
207 #undef RET
208 #undef ARG1
209 #undef ARG2
210 #undef TEMPLATE
211 #undef PARDER1
212 #undef PARDER2
213 #undef PARDER1PARDER1
214 #undef PARDER2PARDER2
215 #undef PARDER1PARDER2
216
217 #define RET Matrix<Rotation, Fixed<3>, Fixed<3>, ATRet>
218 #define ARG1 Vector<Shape1, ATArg>
219 #define ARG2 Vector<Shape2, ATArg>
220 #define TEMPLATE typename ATRet, typename Shape1, typename Shape2, typename ATArg
221 #define PARDER1
222 #define PARDER2
223 //#define PARDER1PARDER1
224 //#define PARDER2PARDER2
225 //#define PARDER1PARDER2
226 #include "symbolic_function2_temp.h"
227 #undef RET
228 #undef ARG1
229 #undef ARG2
230 #undef TEMPLATE
231 #undef PARDER1
232 #undef PARDER2
233 #undef PARDER1PARDER1
234 #undef PARDER2PARDER2
235 #undef PARDER1PARDER2
236
237 #define RET RowVector<RetShape, ATRet>
238 #define ARG1 Vector<Shape, ATArg>
239 #define ARG2 ATArg
240 #define TEMPLATE typename RetShape, typename ATRet, typename Shape, typename ATArg
241 //#define PARDER1
242 #define PARDER2
243 //#define PARDER1PARDER1
244 #define PARDER2PARDER2
245 //#define PARDER1PARDER2
246 #include "symbolic_function2_temp.h"
247 #undef RET
248 #undef ARG1
249 #undef ARG2
250 #undef TEMPLATE
251 #undef PARDER1
252 #undef PARDER2
253 #undef PARDER1PARDER1
254 #undef PARDER2PARDER2
255 #undef PARDER1PARDER2
256
257 #define RET Matrix<Type, RowShape, ColShape, ATRet>
258 #define ARG1 Vector<Shape, ATArg>
259 #define ARG2 ATArg
260 #define TEMPLATE typename Type, typename RowShape, typename ColShape, typename ATRet, typename Shape, typename ATArg
261 //#define PARDER1
262 #define PARDER2
263 //#define PARDER1PARDER1
264 #define PARDER2PARDER2
265 //#define PARDER1PARDER2
266 #include "symbolic_function2_temp.h"
267 #undef RET
268 #undef ARG1
269 #undef ARG2
270 #undef TEMPLATE
271 #undef PARDER1
272 #undef PARDER2
273 #undef PARDER1PARDER1
274 #undef PARDER2PARDER2
275 #undef PARDER1PARDER2
276
277 #define RET RowVector<RetShape, ATRet>
278 #define ARG1 ATArg
279 #define ARG2 Vector<Shape, ATArg>
280 #define TEMPLATE typename RetShape, typename ATRet, typename Shape, typename ATArg
281 #define PARDER1
282 //#define PARDER2
283 #define PARDER1PARDER1
284 //#define PARDER2PARDER2
285 //#define PARDER1PARDER2
286 #include "symbolic_function2_temp.h"
287 #undef RET
288 #undef ARG1
289 #undef ARG2
290 #undef TEMPLATE
291 #undef PARDER1
292 #undef PARDER2
293 #undef PARDER1PARDER1
294 #undef PARDER2PARDER2
295 #undef PARDER1PARDER2
296
297 #define RET Matrix<Type, RowShape, ColShape, ATRet>
298 #define ARG1 ATArg
299 #define ARG2 Vector<Shape, ATArg>
300 #define TEMPLATE typename Type, typename RowShape, typename ColShape, typename ATRet, typename Shape, typename ATArg
301 #define PARDER1
302 //#define PARDER2
303 #define PARDER1PARDER1
304 //#define PARDER2PARDER2
305 //#define PARDER1PARDER2
306 #include "symbolic_function2_temp.h"
307 #undef RET
308 #undef ARG1
309 #undef ARG2
310 #undef TEMPLATE
311 #undef PARDER1
312 #undef PARDER2
313 #undef PARDER1PARDER1
314 #undef PARDER2PARDER2
315 #undef PARDER1PARDER2
316
317 #define RET RowVector<RetShape, ATRet>
318 #define ARG1 Vector<Shape1, ATArg>
319 #define ARG2 Vector<Shape2, ATArg>
320 #define TEMPLATE typename RetShape, typename ATRet, typename Shape1, typename ATArg, typename Shape2
321 //#define PARDER1
322 //#define PARDER2
323 //#define PARDER1PARDER1
324 //#define PARDER2PARDER2
325 //#define PARDER1PARDER2
326 #include "symbolic_function2_temp.h"
327 #undef RET
328 #undef ARG1
329 #undef ARG2
330 #undef TEMPLATE
331 #undef PARDER1
332 #undef PARDER2
333 #undef PARDER1PARDER1
334 #undef PARDER2PARDER2
335 #undef PARDER1PARDER2
336
337 #define RET Matrix<Type, RowShape, ColShape, ATRet>
338 #define ARG1 Vector<Shape1, ATArg>
339 #define ARG2 Vector<Shape2, ATArg>
340 #define TEMPLATE typename Type, typename RowShape, typename ColShape, typename ATRet, typename Shape1, typename ATArg, typename Shape2
341 //#define PARDER1
342 //#define PARDER2
343 //#define PARDER1PARDER1
344 //#define PARDER2PARDER2
345 //#define PARDER1PARDER2
346 #include "symbolic_function2_temp.h"
347 #undef RET
348 #undef ARG1
349 #undef ARG2
350 #undef TEMPLATE
351 #undef PARDER1
352 #undef PARDER2
353 #undef PARDER1PARDER1
354 #undef PARDER2PARDER2
355 #undef PARDER1PARDER2
356
357 }
358
359 #endif
360
361
362
363
364
365 // 1: definition
366 // 2: value
367 // 3: parDer1
368 // 4: dirDer1
369 // 5: parDer2
370 // 6: dirDer2
371 // 7: parDer1ParDer1
372 // 8: parDer1DirDer1
373 // 9: dirDer1DirDer1
374 // 10: parDer2ParDer2
375 // 11: parDer2DirDer2
376 // 12: dirDer2DirDer2
377 // 13: parDer1ParDer2
378 // 14: parDer1DirDer2
379 // 15: dirDer2DirDer1
380 // 16: parDer2DirDer1
381 //
382 // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
383 //
384 // sss s s s s s s s s s s s s s s s
385 // vss v v v v v v v v v v v v v v v
386 // rss r r r r r r r r r r r r r r r
387 // Mss M M M M M M M M M M M M M M M
388 // Rss R v v v v v v v v v v v v v v
389 // svv s r s r s E r s E r s E r s r
390 // vvv v M v M v E M v E M v E M v M
391 // rvv r E r E r E E r E E r E E r E
392 // Mvv M E M E M E E M E E M E E M E
393 // Rvv R M v M v E M v E M v E M v M
394 // ssv s s s r s s s s E r s r s s r
395 // vsv v v v M v v v v E M v M v v M
396 // rsv r r r E r r r r E E r E r r E
397 // Msv M M M E M M M M E E M E M M E
398 // Rsv R v v M v v v v E M v M v v M
399 // svs s r s s s E r s s s s r r s s
400 // vvs v M v v v E M v v v v M M v v
401 // rvs r E r r r E E r r r r E E r r
402 // Mvs M E M M M E E M M M M E E M M
403 // Rvs R M v v v E M v v v v M M v v
404 //
405 // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
406 //
407 //
408 //
409 // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
410 //
411 // aaa s s s s s s s s s s s s s s s
412 // vaa v v v v v v v v v v v v v v v
413 // raa r r r r r r r r r r r r r r r
414 // Maa M M M M M M M M M M M M M M M
415 // Raa R v v v v v v v v v v v v v v
416 //
417 // ava s r s s s E r s s s s r r s s
418 // vva v M v v v E M v v v v M M v v
419 // Rva R M v v v E M v v v v M M v v
420 //
421 // aav s s s r s s s s E r s r s s r
422 // vav v v v M v v v v E M v M v v M
423 // Rav R v v M v v v v E M v M v v M
424 //
425 // avv s r s r s E r s E r s E r s r
426 // vvv v M v M v E M v E M v E M v M
427 // Rvv R M v M v E M v E M v E M v M
428 //
429 // rva r E r r r E E r r r r E E r r
430 // Mva M E M M M E E M M M M E E M M
431 //
432 // rav r r r E r r r r E E r E r r E
433 // Mav M M M E M M M M E E M E M M E
434 //
435 // rvv r E r E r E E r E E r E E r E
436 // Mvv M E M E M E E M E E M E E M E
437 //
438 // 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
fmatvec::Matrix
This is the basic matrix class for arbitrary matrices.
Definition: fmatvec.h:42
fmatvec::Vector
Definition: fmatvec.h:48
fmatvec::Matrix::cols
int cols() const
Number of columns.
fmatvec
Namespace fmatvec.
Definition: _memory.cc:28
fmatvec::SymbolicFunction
Definition: symbolic_function.h:33
fmatvec::Matrix::rows
int rows() const
Number of rows.