1; ***************************************************************
2; * Eigen Visualizer
3; *
4; * Author: Hauke Heibel <hauke.heibel@gmail.com>
5; *
6; * Support the enhanced debugging of the following Eigen
7; * types (*: any, +:fixed dimension) :
8; *
9; * - Eigen::Matrix<*,4,1,*,*,*> and Eigen::Matrix<*,1,4,*,*,*>
10; * - Eigen::Matrix<*,3,1,*,*,*> and Eigen::Matrix<*,1,3,*,*,*>
11; * - Eigen::Matrix<*,2,1,*,*,*> and Eigen::Matrix<*,1,2,*,*,*>
12; * - Eigen::Matrix<*,-1,-1,*,*,*>
13; * - Eigen::Matrix<*,+,-1,*,*,*>
14; * - Eigen::Matrix<*,-1,+,*,*,*>
15; * - Eigen::Matrix<*,+,+,*,*,*>
16; *
17; * Matrices are displayed properly independantly of the memory
18; * alignment (RowMajor vs. ColMajor).
19; *
20; * This file is distributed WITHOUT ANY WARRANTY. Please ensure
21; * that your original autoexp.dat file is copied to a safe 
22; * place before proceeding with its modification.
23; ***************************************************************
24
25[Visualizer]
26
27; Fixed size 4-vectors
28Eigen::Matrix<*,4,1,*,*,*>|Eigen::Matrix<*,1,4,*,*,*>{
29   children
30   (
31      #(
32        [internals]: [$c,!],
33         x : ($c.m_storage.m_data.array)[0],
34         y : ($c.m_storage.m_data.array)[1],
35         z : ($c.m_storage.m_data.array)[2],
36         w : ($c.m_storage.m_data.array)[3]
37      )
38   )
39
40   preview
41   (
42      #(
43        "[",
44        4,
45        "](",
46        #array(expr: $e.m_storage.m_data.array[$i], size: 4),
47        ")"
48      )
49   )
50}
51
52; Fixed size 3-vectors
53Eigen::Matrix<*,3,1,*,*,*>|Eigen::Matrix<*,1,3,*,*,*>{
54   children
55   (
56      #(
57        [internals]: [$c,!],
58         x : ($c.m_storage.m_data.array)[0],
59         y : ($c.m_storage.m_data.array)[1],
60         z : ($c.m_storage.m_data.array)[2]
61      )
62   )
63
64   preview
65   (
66      #(
67        "[",
68        3,
69        "](",
70        #array(expr: $e.m_storage.m_data.array[$i], size: 3),
71        ")"
72      )
73   )
74}
75
76; Fixed size 2-vectors
77Eigen::Matrix<*,2,1,*,*,*>|Eigen::Matrix<*,1,2,*,*,*>{
78   children
79   (
80      #(
81        [internals]: [$c,!],
82         x : ($c.m_storage.m_data.array)[0],
83         y : ($c.m_storage.m_data.array)[1]
84      )
85   )
86
87   preview
88   (
89      #(
90        "[",
91        2,
92        "](",
93        #array(expr: $e.m_storage.m_data.array[$i], size: 2),
94        ")"
95      )
96   )
97}
98
99; Fixed size 1-vectors
100Eigen::Matrix<*,1,1,*,*,*>|Eigen::Matrix<*,1,1,*,*,*>{
101   children
102   (
103      #(
104        [internals]: [$c,!],
105         x : ($c.m_storage.m_data.array)[0]
106      )
107   )
108
109   preview
110   (
111      #(
112        "[",
113        1,
114        "](",
115        #array(expr: $e.m_storage.m_data.array[$i], size: 1),
116        ")"
117      )
118   )
119}
120
121; Dynamic matrices (ColMajor and RowMajor support)
122Eigen::Matrix<*,-1,-1,*,*,*>{
123  children
124   (
125      #(
126         [internals]: [$c,!],
127         rows: $c.m_storage.m_rows,
128         cols: $c.m_storage.m_cols,
129         ; Check for RowMajorBit
130         #if ($c.Flags & 0x1) (
131             #array(
132                rank: 2,
133                base: 0,
134                expr: ($c.m_storage.m_data)[($i % $c.m_storage.m_rows)*$c.m_storage.m_cols + (($i- $i % $c.m_storage.m_rows)/$c.m_storage.m_rows)], 
135                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.m_storage.m_cols
136             )
137         ) #else (
138             #array(
139                rank: 2,
140                base: 0,
141                expr: ($c.m_storage.m_data)[$i],
142                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.m_storage.m_cols
143             )
144         )
145      )
146   )
147
148   preview
149   (
150     #(
151         "[",
152           $c.m_storage.m_rows,
153         ",",
154           $c.m_storage.m_cols,
155         "](",
156           #array(
157            expr :    [($c.m_storage.m_data)[$i],g],
158            size :    $c.m_storage.m_rows*$c.m_storage.m_cols
159           ),
160         ")"
161      )
162   )
163}
164
165; Fixed rows, dynamic columns matrix (ColMajor and RowMajor support)
166Eigen::Matrix<*,*,-1,*,*,*>{
167  children
168   (
169      #(
170         [internals]: [$c,!],
171         rows: $c.RowsAtCompileTime,
172         cols: $c.m_storage.m_cols,
173         ; Check for RowMajorBit
174         #if ($c.Flags & 0x1) (
175             #array(
176                rank: 2,
177                base: 0,
178                expr: ($c.m_storage.m_data)[($i % $c.RowsAtCompileTime)*$c.m_storage.m_cols + (($i- $i % $c.RowsAtCompileTime)/$c.RowsAtCompileTime)],
179                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.m_storage.m_cols
180             )
181         ) #else (
182             #array(
183                rank: 2,
184                base: 0,
185                expr: ($c.m_storage.m_data)[$i],
186                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.m_storage.m_cols
187             )
188         )
189      )
190   )
191
192   preview
193   (
194     #(
195         "[",
196           $c.RowsAtCompileTime,
197         ",",
198           $c.m_storage.m_cols,
199         "](",
200           #array(
201            expr :    [($c.m_storage.m_data)[$i],g],
202            size :    $c.RowsAtCompileTime*$c.m_storage.m_cols
203           ),
204         ")"
205      )
206   )
207}
208
209; Dynamic rows, fixed columns matrix (ColMajor and RowMajor support)
210Eigen::Matrix<*,-1,*,*,*,*>{
211  children
212   (
213      #(
214         [internals]: [$c,!],
215         rows: $c.m_storage.m_rows,
216         cols: $c.ColsAtCompileTime,
217         ; Check for RowMajorBit
218         #if ($c.Flags & 0x1) (
219             #array(
220                rank: 2,
221                base: 0,
222                expr: ($c.m_storage.m_data)[($i % $c.m_storage.m_rows)*$c.ColsAtCompileTime + (($i- $i % $c.m_storage.m_rows)/$c.m_storage.m_rows)], 
223                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.ColsAtCompileTime
224             )
225         ) #else (
226             #array(
227                rank: 2,
228                base: 0,
229                expr: ($c.m_storage.m_data)[$i],
230                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.ColsAtCompileTime
231             )
232         )
233      )
234   )
235
236   preview
237   (
238     #(
239         "[",
240           $c.m_storage.m_rows,
241         ",",
242           $c.ColsAtCompileTime,
243         "](",
244           #array(
245            expr :    [($c.m_storage.m_data)[$i],g],
246            size :    $c.m_storage.m_rows*$c.ColsAtCompileTime
247           ),
248         ")"
249      )
250   )
251}
252
253; Fixed size matrix (ColMajor and RowMajor support)
254Eigen::Matrix<*,*,*,*,*,*>{
255  children
256   (
257      #(
258         [internals]: [$c,!],
259         rows: $c.RowsAtCompileTime,
260         cols: $c.ColsAtCompileTime,
261         ; Check for RowMajorBit
262         #if ($c.Flags & 0x1) (
263             #array(
264                rank: 2,
265                base: 0,
266                expr: ($c.m_storage.m_data.array)[($i % $c.RowsAtCompileTime)*$c.ColsAtCompileTime + (($i- $i % $c.RowsAtCompileTime)/$c.RowsAtCompileTime)], 
267                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.ColsAtCompileTime
268             )
269         ) #else (
270             #array(
271                rank: 2,
272                base: 0,
273                expr: ($c.m_storage.m_data.array)[$i],
274                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.ColsAtCompileTime
275             )
276         )
277      )
278   )
279
280   preview
281   (
282     #(
283         "[",
284           $c.RowsAtCompileTime,
285         ",",
286           $c.ColsAtCompileTime,
287         "](",
288           #array(
289            expr :    [($c.m_storage.m_data.array)[$i],g],
290            size :    $c.RowsAtCompileTime*$c.ColsAtCompileTime
291           ),
292         ")"
293      )
294   )
295}
296