source: soft/giet_vm/applications/rosenfeld/src/ecc_examples.c @ 791

Last change on this file since 791 was 791, checked in by meunier, 8 years ago
  • Added function realloc
  • Started to put the bootloader on 2 Big Pages (warning: does not work yet)
  • Fixed errors in the rosenfeld application
File size: 53.1 KB
Line 
1/* ---------------------- */
2/* --- ecc_examples.c --- */
3/* ---------------------- */
4
5// fonction de test de Lionel Lacassagne
6// version 2014-2015
7
8#include <stdio.h>
9#include <stdlib.h>
10#include <math.h>
11
12#ifdef CLI
13#include "nrc_os_config.h"
14#include "nrc.h"
15#endif
16
17#include "palette.h"
18#include "bmpNR.h"
19#include "histogramNR.h"
20
21#include "ecc_common.h"
22#include "ecc_features.h"
23#include "ecc_generation.h"
24
25
26// --------------------------------------------------------------
27void init_forme1(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
28// --------------------------------------------------------------
29{
30    uint8 **X;
31    int i = 0;
32    int h = 8;
33    int w = 8;
34   
35    X = ui8matrix(    0, h-1, 0, w-1);
36    zero_ui8matrix(X, 0, h-1, 0, w-1);
37   
38    *X0 = X;
39    *i0 = 0; *i1 = h-1;
40    *j0 = 0; *j1 = w-1;
41   
42    //                                 012345678
43    set_ui8vector_str(X[i++], 0, w-1, "111.11.1"); // 0
44    set_ui8vector_str(X[i++], 0, w-1, "11.11.11"); // 1
45    set_ui8vector_str(X[i++], 0, w-1, "1.11.111"); // 2
46    set_ui8vector_str(X[i++], 0, w-1, "111.1111"); // 3
47    set_ui8vector_str(X[i++], 0, w-1, "...11111"); // 4
48    set_ui8vector_str(X[i++], 0, w-1, "11111111"); // 5
49    set_ui8vector_str(X[i++], 0, w-1, "11111111"); // 6
50    set_ui8vector_str(X[i++], 0, w-1, "11111111"); // 7
51   
52    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme1");
53    printf("");
54    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme1.txt");
55}
56// --------------------------------------------------------------
57void init_forme2(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
58// --------------------------------------------------------------
59{
60    uint8 **X;
61    int i =  0;
62    int h = 10;
63    int w = 17;
64   
65    X = ui8matrix(    0, h-1, 0, w-1);
66    zero_ui8matrix(X, 0, h-1, 0, w-1);
67   
68    *X0 = X;
69    *i0 = 0; *i1 = h-1;
70    *j0 = 0; *j1 = w-1;
71   
72    //                                 000000000011111111
73    //                                 012345678901234567
74    set_ui8vector_str(X[i++], 0, w-1, "................1"); // 0
75    set_ui8vector_str(X[i++], 0, w-1, "....1.......1...1"); // 1
76    set_ui8vector_str(X[i++], 0, w-1, "1...1.....1.1.1.1"); // 2
77    set_ui8vector_str(X[i++], 0, w-1, "1.1.1.1...1.11111"); // 3
78    set_ui8vector_str(X[i++], 0, w-1, "11111.1.1.1...1.."); // 4
79    set_ui8vector_str(X[i++], 0, w-1, "..1...11111...1.."); // 5
80    set_ui8vector_str(X[i++], 0, w-1, "..1.....1.....1.."); // 6
81    set_ui8vector_str(X[i++], 0, w-1, "..1111111111111.."); // 7
82    set_ui8vector_str(X[i++], 0, w-1, "........1........"); // 8
83    set_ui8vector_str(X[i++], 0, w-1, "........1........"); // 9
84   
85    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme2"); printf("");
86    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme2.txt");
87}
88// --------------------------------------------------------------
89void init_forme3(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
90// --------------------------------------------------------------
91{
92    uint8 **X;
93    int i =  0;
94    int h = 10;
95    int w = 17;
96   
97    X = ui8matrix(    0, h-1, 0, w-1);
98    zero_ui8matrix(X, 0, h-1, 0, w-1);
99   
100    *X0 = X;
101    *i0 = 0; *i1 = h-1;
102    *j0 = 0; *j1 = w-1;
103   
104    //                                 00000000001111111
105    //                                 01234567890123456
106    set_ui8vector_str(X[i++], 0, w-1, "................."); // 0
107    set_ui8vector_str(X[i++], 0, w-1, "....1.......1...1"); // 1
108    set_ui8vector_str(X[i++], 0, w-1, "1...1.....1.1.1.1"); // 2
109    set_ui8vector_str(X[i++], 0, w-1, "1.1.1.1...1.11111"); // 3
110    set_ui8vector_str(X[i++], 0, w-1, "11111.1.1.1...1.."); // 4
111    set_ui8vector_str(X[i++], 0, w-1, "..1...11111...1.."); // 5
112    set_ui8vector_str(X[i++], 0, w-1, "..1.....1.....1.."); // 6
113    set_ui8vector_str(X[i++], 0, w-1, "..1111111111111.."); // 7
114    set_ui8vector_str(X[i++], 0, w-1, "........1........"); // 8
115    set_ui8vector_str(X[i++], 0, w-1, "........1........"); // 9   
116   
117    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme3"); printf("");
118    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme3.txt");
119}
120// --------------------------------------------------------------
121void init_forme4(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
122// --------------------------------------------------------------
123{
124    uint8 **X;
125    int i =  0;
126    int h =  8;
127    int w = 10;
128   
129    X = ui8matrix(    0, h-1, 0, w-1);
130    zero_ui8matrix(X, 0, h-1, 0, w-1);
131   
132    *X0 = X;
133    *i0 = 0; *i1 = h-1;
134    *j0 = 0; *j1 = w-1;
135   
136    //                                  00000000001
137    //                                  01234567890
138    set_ui8vector_str(X[i++], 0, w-1, "1.1.1 1.1.1"); // 0
139    set_ui8vector_str(X[i++], 0, w-1, "111.111.111"); // 1
140    set_ui8vector_str(X[i++], 0, w-1, "..........."); // 2
141    set_ui8vector_str(X[i++], 0, w-1, "1.1.1 1.1.1"); // 3
142    set_ui8vector_str(X[i++], 0, w-1, "111.111.111"); // 4
143    set_ui8vector_str(X[i++], 0, w-1, "..........."); // 5
144    set_ui8vector_str(X[i++], 0, w-1, "1.1.1 1.1.1"); // 6
145    set_ui8vector_str(X[i++], 0, w-1, "111.111.111"); // 7
146   
147    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme4"); printf("");
148    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme4.txt");
149}
150// -----------------------------------------------------------------------
151void init_forme_backdoor1(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
152// -----------------------------------------------------------------------
153{
154    uint8 **X;
155    int i =  0;
156    int h =  5;
157    int w =  7;
158   
159    X = ui8matrix(    0, h-1, 0, w-1);
160    zero_ui8matrix(X, 0, h-1, 0, w-1);
161   
162    *X0 = X;
163    *i0 = 0; *i1 = h-1;
164    *j0 = 0; *j1 = w-1;
165   
166    //                                 00000000
167    //                                 01234567
168    set_ui8vector_str(X[i++], 0, w-1, "1.....1"); // 0
169    set_ui8vector_str(X[i++], 0, w-1, "1..1.11"); // 1
170    set_ui8vector_str(X[i++], 0, w-1, "1.1111."); // 2
171    set_ui8vector_str(X[i++], 0, w-1, "111...."); // 3
172    set_ui8vector_str(X[i++], 0, w-1, "......."); // 4
173   
174    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor1"); printf("");
175    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor1.txt");
176}
177// -----------------------------------------------------------------------
178void init_forme_backdoor2(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
179// -----------------------------------------------------------------------
180{
181    uint8 **X;
182    int i =  0;
183    int h =  5;
184    int w = 10;
185   
186    X = ui8matrix(    0, h-1, 0, w-1);
187    zero_ui8matrix(X, 0, h-1, 0, w-1);
188   
189    *X0 = X;
190    *i0 = 0; *i1 = h-1;
191    *j0 = 0; *j1 = w-1;
192
193    //                                 00000000001
194    //                                 01234567890
195    set_ui8vector_str(X[i++], 0, w-1, "1........1"); // 0
196    set_ui8vector_str(X[i++], 0, w-1, "1.....1.11"); // 1
197    set_ui8vector_str(X[i++], 0, w-1, "1..1.1111."); // 2
198    set_ui8vector_str(X[i++], 0, w-1, "1.1111...."); // 3
199    set_ui8vector_str(X[i++], 0, w-1, "111......."); // 4
200   
201    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor2"); printf("");
202    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor2.txt");
203}
204// -----------------------------------------------------------------------
205void init_forme_backdoor3(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
206// -----------------------------------------------------------------------
207{
208    uint8 **X;
209    int i =  0;
210    int h =  6;
211    int w = 13;
212   
213    X = ui8matrix(    0, h-1, 0, w-1);
214    zero_ui8matrix(X, 0, h-1, 0, w-1);
215   
216    *X0 = X;
217    *i0 = 0; *i1 = h-1;
218    *j0 = 0; *j1 = w-1;
219   
220    //                                 00000000001111
221    //                                 01234567890123
222    set_ui8vector_str(X[i++], 0, w-1, "1           1"); // 0
223    set_ui8vector_str(X[i++], 0, w-1, "1        1 11"); // 1
224    set_ui8vector_str(X[i++], 0, w-1, "1     1.1111."); // 2
225    set_ui8vector_str(X[i++], 0, w-1, "1  1 1111    "); // 3
226    set_ui8vector_str(X[i++], 0, w-1, "1 1111       "); // 4
227    set_ui8vector_str(X[i++], 0, w-1, "111          "); // 5
228   
229    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor3"); printf("");
230    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor3.txt");
231}
232// ------------------------------------------------------------------------
233void init_forme_backdoor1b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
234// ------------------------------------------------------------------------
235{
236    // backdoor1b = 8C(backdoor1)
237
238    uint8 **X;
239    int i =  0;
240    int h =  4;
241    int w =  9;
242   
243    X = ui8matrix(    0, h-1, 0, w-1);
244    zero_ui8matrix(X, 0, h-1, 0, w-1);
245   
246    *X0 = X;
247    *i0 = 0; *i1 = h-1;
248    *j0 = 0; *j1 = w-1;
249   
250    //                                 0000000000
251    //                                 0123456789
252    set_ui8vector_str(X[i++], 0, w-1, "1.......1"); // 0
253    set_ui8vector_str(X[i++], 0, w-1, "1...1.111"); // 1
254    set_ui8vector_str(X[i++], 0, w-1, "1.11111.."); // 2
255    set_ui8vector_str(X[i++], 0, w-1, "111......"); // 3
256   
257    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor1b"); printf("");
258    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor1b.txt");
259}
260// ------------------------------------------------------------------------
261void init_forme_backdoor2b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
262// ------------------------------------------------------------------------
263{
264    // backdoor2b = 8C(backdoor2)
265   
266    uint8 **X;
267    int i =  0;
268    int h =  5;
269    int w = 13;
270   
271    X = ui8matrix(    0, h-1, 0, w-1);
272    zero_ui8matrix(X, 0, h-1, 0, w-1);
273   
274    *X0 = X;
275    *i0 = 0; *i1 = h-1;
276    *j0 = 0; *j1 = w-1;
277   
278    //                                 00000000001111
279    //                                 01234567890123
280    set_ui8vector_str(X[i++], 0, w-1, "1...........1"); // 0
281    set_ui8vector_str(X[i++], 0, w-1, "1.......1.111"); // 1
282    set_ui8vector_str(X[i++], 0, w-1, "1...1.11111.."); // 2
283    set_ui8vector_str(X[i++], 0, w-1, "1 11111......"); // 3
284    set_ui8vector_str(X[i++], 0, w-1, "111.........."); // 4
285   
286    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor2b"); printf("");
287    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor2b.txt");
288}
289// ------------------------------------------------------------------------
290void init_forme_backdoor3b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
291// ------------------------------------------------------------------------
292{
293    // backdoor3b = 8C(backdoor3)
294   
295    uint8 **X;
296    int i =  0;
297    int h =  6;
298    int w = 17;
299   
300    X = ui8matrix(    0, h-1, 0, w-1);
301    zero_ui8matrix(X, 0, h-1, 0, w-1);
302   
303    *X0 = X;
304    *i0 = 0; *i1 = h-1;
305    *j0 = 0; *j1 = w-1;
306   
307    //                                 000000000011111111
308    //                                 012345678901234567
309    set_ui8vector_str(X[i++], 0, w-1, "1...............1"); // 0
310    set_ui8vector_str(X[i++], 0, w-1, "1...........1.111"); // 1
311    set_ui8vector_str(X[i++], 0, w-1, "1.......1.11111.."); // 2
312    set_ui8vector_str(X[i++], 0, w-1, "1...1.11111......"); // 3
313    set_ui8vector_str(X[i++], 0, w-1, "1 11111.........."); // 4
314    set_ui8vector_str(X[i++], 0, w-1, "111.............."); // 5
315   
316    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor3b"); printf("");
317    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor3b.txt");
318}
319// ----------------------------------------------------------------------------
320void init_forme_LSL_backdoor1b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
321// ----------------------------------------------------------------------------
322{
323    uint8 **X;
324    int i =  0;
325    int h =  5;
326    int w =  8;
327   
328    X = ui8matrix(    0, h-1, 0, w-1);
329    zero_ui8matrix(X, 0, h-1, 0, w-1);
330   
331    *X0 = X;
332    *i0 = 0; *i1 = h-1;
333    *j0 = 0; *j1 = w-1;
334   
335    //                                 000000000
336    //                                 012345678
337    set_ui8vector_str(X[i++], 0, w-1, "1      1"); // 0
338    set_ui8vector_str(X[i++], 0, w-1, "1    1 1"); // 1
339    set_ui8vector_str(X[i++], 0, w-1, "1  1 1 1"); // 2
340    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 "); // 3
341    set_ui8vector_str(X[i++], 0, w-1, " 1      "); // 4
342
343   
344    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_LSL_backdoor1b"); printf("");
345    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_LSL_backdoor1b.txt");
346}
347// ----------------------------------------------------------------------------
348void init_forme_LSL_backdoor2b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
349// ----------------------------------------------------------------------------
350{
351    uint8 **X;
352    int i =  0;
353    int h =  6;
354    int w = 10;
355   
356    X = ui8matrix(    0, h-1, 0, w-1);
357    zero_ui8matrix(X, 0, h-1, 0, w-1);
358   
359    *X0 = X;
360    *i0 = 0; *i1 = h-1;
361    *j0 = 0; *j1 = w-1;
362   
363    //                                 00000000001
364    //                                 01234567890
365    set_ui8vector_str(X[i++], 0, w-1, "1        1"); // 0
366    set_ui8vector_str(X[i++], 0, w-1, "1      1 1"); // 1
367    set_ui8vector_str(X[i++], 0, w-1, "1    1 1 1"); // 2
368    set_ui8vector_str(X[i++], 0, w-1, "1  1 1 1 1"); // 3
369    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1 "); // 4
370    set_ui8vector_str(X[i++], 0, w-1, " 1        "); // 5
371   
372    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_LSL_backdoor2b"); printf("");
373    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_LSL_backdoor2b.txt");
374}
375// ----------------------------------------------------------------------------
376void init_forme_LSL_backdoor3b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
377// ----------------------------------------------------------------------------
378{
379    uint8 **X;
380    int i =  0;
381    int h =  6;
382    int w = 10;
383   
384    X = ui8matrix(    0, h-1, 0, w-1);
385    zero_ui8matrix(X, 0, h-1, 0, w-1);
386   
387    *X0 = X;
388    *i0 = 0; *i1 = h-1;
389    *j0 = 0; *j1 = w-1;
390   
391    //                                 00000000001
392    //                                 01234567890
393    set_ui8vector_str(X[i++], 0, w-1, "1       1"); // 0
394    set_ui8vector_str(X[i++], 0, w-1, "1     1 1"); // 1
395    set_ui8vector_str(X[i++], 0, w-1, "1   1 1 1"); // 2
396    set_ui8vector_str(X[i++], 0, w-1, "1  1 1 1 "); // 3
397    set_ui8vector_str(X[i++], 0, w-1, "1 1      "); // 4
398    set_ui8vector_str(X[i++], 0, w-1, " 1       "); // 5
399   
400    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_LSL_backdoor3b"); printf("");
401    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_LSL_backdoor3b.txt");
402}
403// -----------------------------------------------------------------------
404void init_forme_backdoor7(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
405// -----------------------------------------------------------------------
406{   
407    uint8 **X;
408    int i =  0;
409    int h =  6;
410    int w = 10;
411   
412    X = ui8matrix(    0, h-1, 0, w-1);
413    zero_ui8matrix(X, 0, h-1, 0, w-1);
414   
415    *X0 = X;
416    *i0 = 0; *i1 = h-1;
417    *j0 = 0; *j1 = w-1;
418   
419    //                                 00000000001
420    //                                 01234567890
421    set_ui8vector_str(X[i++], 0, w-1, ".........1"); // 0
422    set_ui8vector_str(X[i++], 0, w-1, ".......1.1"); // 1
423    set_ui8vector_str(X[i++], 0, w-1, ".....1.1.1"); // 2
424    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1.1"); // 3
425    set_ui8vector_str(X[i++], 0, w-1, "1.11111111"); // 4
426    set_ui8vector_str(X[i++], 0, w-1, "111......."); // 5
427   
428    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor7"); printf("");
429    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor8.txt");
430}
431// -----------------------------------------------------------------------
432void init_forme_backdoor8(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
433// -----------------------------------------------------------------------
434{
435    uint8 **X;
436    int i =  0;
437    int h =  7;
438    int w = 10;
439   
440    X = ui8matrix(    0, h-1, 0, w-1);
441    zero_ui8matrix(X, 0, h-1, 0, w-1);
442   
443    *X0 = X;
444    *i0 = 0; *i1 = h-1;
445    *j0 = 0; *j1 = w-1;
446   
447    //                                 00000000001
448    //                                 01234567890
449    set_ui8vector_str(X[i++], 0, w-1, ".........1"); // 0
450    set_ui8vector_str(X[i++], 0, w-1, ".......1.1"); // 1
451    set_ui8vector_str(X[i++], 0, w-1, "1....1.1.1"); // 2
452    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1.1"); // 3
453    set_ui8vector_str(X[i++], 0, w-1, "1.11111111"); // 4
454    set_ui8vector_str(X[i++], 0, w-1, "1.1......."); // 5
455    set_ui8vector_str(X[i++], 0, w-1, "111......."); // 6
456   
457    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor8"); printf("");
458    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor8.txt");
459}
460// -----------------------------------------------------------------------
461void init_forme_backdoor9(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
462// -----------------------------------------------------------------------
463{
464    uint8 **X;
465    int i =  0;
466    int h =  7;
467    int w = 10;
468   
469    X = ui8matrix(    0, h-1, 0, w-1);
470    zero_ui8matrix(X, 0, h-1, 0, w-1);
471   
472    *X0 = X;
473    *i0 = 0; *i1 = h-1;
474    *j0 = 0; *j1 = w-1;
475   
476    //                                 00000000001
477    //                                 01234567890
478    set_ui8vector_str(X[i++], 0, w-1, ".........1"); // 0
479    set_ui8vector_str(X[i++], 0, w-1, ".......1.1"); // 1
480    set_ui8vector_str(X[i++], 0, w-1, ".....1.1.1"); // 2
481    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1.1"); // 3
482    set_ui8vector_str(X[i++], 0, w-1, "1.11111111"); // 4
483    set_ui8vector_str(X[i++], 0, w-1, "1.1......."); // 5
484    set_ui8vector_str(X[i++], 0, w-1, "1.1......."); // 6
485    set_ui8vector_str(X[i++], 0, w-1, "111......."); // 7
486   
487    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor9"); printf("");
488    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor9.txt");
489}
490// ------------------------------------------------------------------------
491void init_forme_backdoor10(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
492// ------------------------------------------------------------------------
493{
494    uint8 **X;
495    int i =  0;
496    int h =  9;
497    int w = 11;
498   
499    X = ui8matrix(    0, h-1, 0, w-1);
500    zero_ui8matrix(X, 0, h-1, 0, w-1);
501   
502    *X0 = X;
503    *i0 = 0; *i1 = h-1;
504    *j0 = 0; *j1 = w-1;
505   
506    //                                 000000000011
507    //                                 012345678901
508    set_ui8vector_str(X[i++], 0, w-1, "1         1"); // 0
509    set_ui8vector_str(X[i++], 0, w-1, "1       1 1"); // 1
510    set_ui8vector_str(X[i++], 0, w-1, "1     1 1 1"); // 2
511    set_ui8vector_str(X[i++], 0, w-1, "1   1 1 1 1"); // 3
512    set_ui8vector_str(X[i++], 0, w-1, "1 1.1 1 1 1"); // 4
513    set_ui8vector_str(X[i++], 0, w-1, "1 111 1 1 1"); // 5
514    set_ui8vector_str(X[i++], 0, w-1, "111 111 1 1"); // 6
515    set_ui8vector_str(X[i++], 0, w-1, "      111 1"); // 7
516    set_ui8vector_str(X[i++], 0, w-1, "        111"); // 8
517   
518    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor10"); printf("");
519    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor10.txt");
520}
521// ------------------------------------------------------------------------
522void init_forme_backdoor11(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
523// ------------------------------------------------------------------------
524{
525    uint8 **X;
526    int i =  0;
527    int h =  9;
528    int w = 11;
529   
530    X = ui8matrix(    0, h-1, 0, w-1);
531    zero_ui8matrix(X, 0, h-1, 0, w-1);
532   
533    *X0 = X;
534    *i0 = 0; *i1 = h-1;
535    *j0 = 0; *j1 = w-1;
536   
537    //                                 000000000011
538    //                                 012345678901
539    set_ui8vector_str(X[i++], 0, w-1, "1         1"); // 0
540    set_ui8vector_str(X[i++], 0, w-1, "1       1 1"); // 1
541    set_ui8vector_str(X[i++], 0, w-1, "1     1 1 1"); // 2
542    set_ui8vector_str(X[i++], 0, w-1, "1   1 1 1 1"); // 3
543    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1 1"); // 4
544    set_ui8vector_str(X[i++], 0, w-1, "1 111 1 1 1"); // 5
545    set_ui8vector_str(X[i++], 0, w-1, "1 1 111 1 1"); // 6
546    set_ui8vector_str(X[i++], 0, w-1, "111   111 1"); // 7
547    set_ui8vector_str(X[i++], 0, w-1, "        111"); // 8
548   
549    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor11"); printf("");
550    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor11.txt");
551}
552// ------------------------------------------------------------------------
553void init_forme_backdoor12(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
554// ------------------------------------------------------------------------
555{
556    uint8 **X;
557    int i =  0;
558    int h =  9;
559    int w = 11;
560   
561    X = ui8matrix(    0, h-1, 0, w-1);
562    zero_ui8matrix(X, 0, h-1, 0, w-1);
563   
564    *X0 = X;
565    *i0 = 0; *i1 = h-1;
566    *j0 = 0; *j1 = w-1;
567   
568    //                                 000000000011
569    //                                 012345678901
570    set_ui8vector_str(X[i++], 0, w-1, "1         1"); // 0
571    set_ui8vector_str(X[i++], 0, w-1, "1       1 1"); // 1
572    set_ui8vector_str(X[i++], 0, w-1, "1     1 1 1"); // 2
573    set_ui8vector_str(X[i++], 0, w-1, "1   1 1 1 1"); // 3
574    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1 1"); // 4
575    set_ui8vector_str(X[i++], 0, w-1, "1 111 1 1 1"); // 5
576    set_ui8vector_str(X[i++], 0, w-1, "1 1 111 1 1"); // 6
577    set_ui8vector_str(X[i++], 0, w-1, "1 1   111 1"); // 7
578    set_ui8vector_str(X[i++], 0, w-1, "111     111"); // 8
579   
580    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor12"); printf("");
581    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor12.txt");
582}
583// ------------------------------------------------------------------------
584void init_forme_backdoor13(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
585// ------------------------------------------------------------------------
586{
587    uint8 **X;
588    int i =  0;
589    int h = 11;
590    int w = 13;
591   
592    X = ui8matrix(    0, h-1, 0, w-1);
593    zero_ui8matrix(X, 0, h-1, 0, w-1);
594   
595    *X0 = X;
596    *i0 = 0; *i1 = h-1;
597    *j0 = 0; *j1 = w-1;
598   
599    //                                 00000000001123
600    //                                 01234567890123
601    set_ui8vector_str(X[i++], 0, w-1, "1           1"); //  0
602    set_ui8vector_str(X[i++], 0, w-1, "1         1 1"); //  1
603    set_ui8vector_str(X[i++], 0, w-1, "1       1 1 1"); //  2
604    set_ui8vector_str(X[i++], 0, w-1, "1     1 1 1 1"); //  3
605    set_ui8vector_str(X[i++], 0, w-1, "1   1 1 1 1 1"); //  4
606    set_ui8vector_str(X[i++], 0, w-1, "1 1.1 1 1 1 1"); //  5
607    set_ui8vector_str(X[i++], 0, w-1, "1 111 1 1 1 1"); //  6
608    set_ui8vector_str(X[i++], 0, w-1, "111 111 1 1 1"); //  7
609    set_ui8vector_str(X[i++], 0, w-1, "      111 1 1"); //  8
610    set_ui8vector_str(X[i++], 0, w-1, "        111 1"); //  9
611    set_ui8vector_str(X[i++], 0, w-1, "          111"); // 10
612   
613    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor13"); printf("");
614    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor13.txt");
615}
616// -------------------------------------------------------------------------
617void init_selkow_backdoor41(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
618// -------------------------------------------------------------------------
619{
620    // plus petite forme qui fait planter Selkow1
621    // avec un graphe de profondeur 4
622   
623    uint8 **X;
624    int i =  0;
625    int h =  4;
626    int w =  6;
627   
628    X = ui8matrix(    0, h-1, 0, w-1);
629    zero_ui8matrix(X, 0, h-1, 0, w-1);
630   
631    *X0 = X;
632    *i0 = 0; *i1 = h-1;
633    *j0 = 0; *j1 = w-1;
634   
635    //                                 0000000
636    //                                 0123456
637    set_ui8vector_str(X[i++], 0, w-1, "1....1"); // 0
638    set_ui8vector_str(X[i++], 0, w-1, "1..1.1"); // 1
639    set_ui8vector_str(X[i++], 0, w-1, "1.1111"); // 2
640    set_ui8vector_str(X[i++], 0, w-1, "111..."); // 3
641   
642    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_selkow_backdoor41"); printf("");
643    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_selkow_backdoor41.txt");
644}
645// -------------------------------------------------------------------------
646void init_selkow_backdoor42(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
647// -------------------------------------------------------------------------
648{
649    // plus petite forme qui fait planter Selkow2
650   
651    uint8 **X;
652    int i =  0;
653    int h =  5;
654    int w =  8;
655   
656    X = ui8matrix(    0, h-1, 0, w-1);
657    zero_ui8matrix(X, 0, h-1, 0, w-1);
658   
659    *X0 = X;
660    *i0 = 0; *i1 = h-1;
661    *j0 = 0; *j1 = w-1;
662   
663    //                                 000000000
664    //                                 012345678
665    set_ui8vector_str(X[i++], 0, w-1, "1......1"); // 0
666    set_ui8vector_str(X[i++], 0, w-1, "1... 1.1"); // 1
667    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1"); // 2
668    set_ui8vector_str(X[i++], 0, w-1, "1.111111"); // 3
669    set_ui8vector_str(X[i++], 0, w-1, "111....."); // 4
670   
671    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_selkow_backdoor42"); printf("");
672    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_selkow_backdoor42.txt");
673}
674// -------------------------------------------------------------------------
675void init_selkow_backdoor43(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
676// -------------------------------------------------------------------------
677{
678    // plus petite forme qui fait planter Selkow3
679   
680    uint8 **X;
681    int i =  0;
682    int h =  6;
683    int w = 10;
684   
685    X = ui8matrix(    0, h-1, 0, w-1);
686    zero_ui8matrix(X, 0, h-1, 0, w-1);
687   
688    *X0 = X;
689    *i0 = 0; *i1 = h-1;
690    *j0 = 0; *j1 = w-1;
691   
692    //                                 00000000001
693    //                                 01234567890
694    set_ui8vector_str(X[i++], 0, w-1, "1........1"); // 0
695    set_ui8vector_str(X[i++], 0, w-1, "1......1.1"); // 1
696    set_ui8vector_str(X[i++], 0, w-1, "1... 1.1.1"); // 2
697    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1.1"); // 3
698    set_ui8vector_str(X[i++], 0, w-1, "1.11111111"); // 4
699    set_ui8vector_str(X[i++], 0, w-1, "111......."); // 5
700   
701    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_selkow_backdoor43"); printf("");
702    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_selkow_backdoor43.txt");
703}
704// -----------------------------------------------------------------------------
705void init_forme_backdoor_rampe4(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
706// -----------------------------------------------------------------------------
707{
708    uint8 **X;
709    int i =  0;
710    int h =  5;
711    int w =  9;
712   
713    X = ui8matrix(    0, h-1, 0, w-1);
714    zero_ui8matrix(X, 0, h-1, 0, w-1);
715   
716    *X0 = X;
717    *i0 = 0; *i1 = h-1;
718    *j0 = 0; *j1 = w-1;
719   
720    //                                 0000000000
721    //                                 0123456789
722    set_ui8vector_str(X[i++], 0, w-1, ".......1"); // 0
723    set_ui8vector_str(X[i++], 0, w-1, ".... 1.1"); // 1
724    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1"); // 2
725    set_ui8vector_str(X[i++], 0, w-1, "1.111111"); // 3
726    set_ui8vector_str(X[i++], 0, w-1, "111....."); // 4
727   
728    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor_ramp4"); printf("");
729    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor_ramp4.txt");
730}
731// -----------------------------------------------------------------------------
732void init_forme_backdoor_rampe5(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
733// -----------------------------------------------------------------------------
734{
735    // backdoor6 = 8C(backdoor3)
736   
737    uint8 **X;
738    int i =  0;
739    int h =  6;
740    int w = 10;
741   
742    X = ui8matrix(    0, h-1, 0, w-1);
743    zero_ui8matrix(X, 0, h-1, 0, w-1);
744   
745    *X0 = X;
746    *i0 = 0; *i1 = h-1;
747    *j0 = 0; *j1 = w-1;
748   
749    //                                 00000000001
750    //                                 01234567890
751    set_ui8vector_str(X[i++], 0, w-1, ".........1"); // 0
752    set_ui8vector_str(X[i++], 0, w-1, ".......1.1"); // 1
753    set_ui8vector_str(X[i++], 0, w-1, ".....1.1.1"); // 2
754    set_ui8vector_str(X[i++], 0, w-1, "1..1.1.1.1"); // 3
755    set_ui8vector_str(X[i++], 0, w-1, "1.11111111"); // 4
756    set_ui8vector_str(X[i++], 0, w-1, "111......."); // 5
757   
758    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_backdoor_ramp6"); printf("");
759    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_backdoor_ramp6.txt");
760}
761
762// --------------------------------------------------------------
763void init_formeM(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
764// --------------------------------------------------------------
765{
766    uint8 **X;
767    int i =  0;
768    int h =  8;
769    int w = 10;
770   
771    X = ui8matrix(    0, h-1, 0, w-1);
772    zero_ui8matrix(X, 0, h-1, 0, w-1);
773   
774    *X0 = X;
775    *i0 = 0; *i1 = h-1;
776    *j0 = 0; *j1 = w-1;
777   
778    //                                 0000000000
779    //                                 0123456789
780    set_ui8vector_str(X[i++], 0, w-1, "........."); // 0
781    set_ui8vector_str(X[i++], 0, w-1, ".11...11."); // 1
782    set_ui8vector_str(X[i++], 0, w-1, ".111.111."); // 2
783    set_ui8vector_str(X[i++], 0, w-1, ".111.111."); // 3
784    set_ui8vector_str(X[i++], 0, w-1, "11.111.11"); // 4
785    set_ui8vector_str(X[i++], 0, w-1, "11.111.11"); // 5
786    set_ui8vector_str(X[i++], 0, w-1, "11..1..11"); // 6
787    set_ui8vector_str(X[i++], 0, w-1, "11.....11"); // 7
788   
789    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_M"); printf("");
790    write_ui8matrix_positive  (X, 0, h-1, 0, w-1, 4, "forme_M.txt");
791}
792// --------------------------------------------------------------
793void init_formeU(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
794// --------------------------------------------------------------
795{   
796    uint8 **X;
797    int i =  0;
798    int h =  5;
799    int w = 12;
800   
801    X = ui8matrix(0, h-1, 0, w-1);
802    zero_ui8matrix(X, 0, h-1, 0, w-1);
803   
804    *X0 = X;
805    *i0 = 0; *i1 = h-1;
806    *j0 = 0; *j1 = w-1;
807   
808    //                                 0000000000111
809    //                                 0123456789012
810    set_ui8vector_str(X[i++], 0, w-1, "1111....1111"); // 0
811    set_ui8vector_str(X[i++], 0, w-1, "...1... 1..."); // 1
812    set_ui8vector_str(X[i++], 0, w-1, "...1....1..."); // 2
813    set_ui8vector_str(X[i++], 0, w-1, "...111111..."); // 3
814    set_ui8vector_str(X[i++], 0, w-1, "............"); // 4
815   
816    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "formeU"); printf("");
817    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "formeU.txt");
818}
819// ---------------------------------------------------------------------
820void init_forme_Bailey1(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
821// ---------------------------------------------------------------------
822{   
823    uint8 **X;
824    int i = 0;
825    int h = 2;
826    int w = 5;
827   
828    X = ui8matrix(0, h-1, 0, w-1);
829    zero_ui8matrix(X, 0, h-1, 0, w-1);
830   
831    *X0 = X;
832    *i0 = 0; *i1 = h-1;
833    *j0 = 0; *j1 = w-1;
834   
835    //                                 0000000000111
836    //                                 0123456789012
837    set_ui8vector_str(X[i++], 0, w-1, "1.1.1"); // 0
838    set_ui8vector_str(X[i++], 0, w-1, "11111"); // 1
839   
840    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey1"); printf("");
841    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey1.txt");
842}
843// ---------------------------------------------------------------------
844void init_forme_Bailey2(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
845// ---------------------------------------------------------------------
846{   
847    uint8 **X;
848    int i = 0;
849    int h = 5;
850    int w = 7;
851   
852    X = ui8matrix(0, h-1, 0, w-1);
853    zero_ui8matrix(X, 0, h-1, 0, w-1);
854   
855    *X0 = X;
856    *i0 = 0; *i1 = h-1;
857    *j0 = 0; *j1 = w-1;
858   
859    //                                 0000000000111
860    //                                 0123456789012
861    set_ui8vector_str(X[i++], 0, w-1, "......1"); // 0
862    set_ui8vector_str(X[i++], 0, w-1, "....1.1"); // 1
863    set_ui8vector_str(X[i++], 0, w-1, "..1.1.1"); // 2
864    set_ui8vector_str(X[i++], 0, w-1, "1.1.1.1"); // 3
865    set_ui8vector_str(X[i++], 0, w-1, "1111111"); // 4
866   
867    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey2"); printf("");
868    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey2.txt");
869}
870// ---------------------------------------------------------------------
871void init_forme_Bailey3(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
872// ---------------------------------------------------------------------
873{   
874    uint8 **X;
875    int i = 0;
876    int h = 7;
877    int w = 7;
878   
879    X = ui8matrix(0, h-1, 0, w-1);
880    zero_ui8matrix(X, 0, h-1, 0, w-1);
881   
882    *X0 = X;
883    *i0 = 0; *i1 = h-1;
884    *j0 = 0; *j1 = w-1;
885   
886    //                                 0000000000111
887    //                                 0123456789012
888    set_ui8vector_str(X[i++], 0, w-1, "1       1"); // 0
889    set_ui8vector_str(X[i++], 0, w-1, "1     1 1"); // 1
890    set_ui8vector_str(X[i++], 0, w-1, "1   1 1 1"); // 2
891    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1"); // 3
892    set_ui8vector_str(X[i++], 0, w-1, "1 1111111"); // 4
893    set_ui8vector_str(X[i++], 0, w-1, "1  1     "); // 5
894    set_ui8vector_str(X[i++], 0, w-1, "1111     "); // 6
895   
896    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey3"); printf("");
897    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey3.txt");
898}
899// ---------------------------------------------------------------------
900void init_forme_Bailey4(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
901// ---------------------------------------------------------------------
902{   
903    uint8 **X;
904    int i = 0;
905    int h = 8;
906    int w = 9;
907   
908    X = ui8matrix(0, h-1, 0, w-1);
909    zero_ui8matrix(X, 0, h-1, 0, w-1);
910   
911    *X0 = X;
912    *i0 = 0; *i1 = h-1;
913    *j0 = 0; *j1 = w-1;
914   
915    //                                 0000000000111
916    //                                 0123456789012
917    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1"); // 0
918    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 111"); // 1
919    set_ui8vector_str(X[i++], 0, w-1, "1 1 1  1 "); // 2
920    set_ui8vector_str(X[i++], 0, w-1, "1 1 1111 "); // 3
921    set_ui8vector_str(X[i++], 0, w-1, "1 1  1   "); // 4
922    set_ui8vector_str(X[i++], 0, w-1, "1 1111   "); // 5
923    set_ui8vector_str(X[i++], 0, w-1, "1  1     "); // 6
924    set_ui8vector_str(X[i++], 0, w-1, "1111     "); // 7
925   
926    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey4"); printf("");
927    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey4.txt");
928}
929// ---------------------------------------------------------------------
930void init_forme_Bailey5(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
931// ---------------------------------------------------------------------
932{   
933    uint8 **X;
934    int i =  0;
935    int h =  8;
936    int w = 17;
937   
938    X = ui8matrix(0, h-1, 0, w-1);
939    zero_ui8matrix(X, 0, h-1, 0, w-1);
940   
941    *X0 = X;
942    *i0 = 0; *i1 = h-1;
943    *j0 = 0; *j1 = w-1;
944   
945    //                                 0000000000111
946    //                                 012345678901234567
947    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1   1 1 1 1"); // 0
948    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 11111 1 1 1"); // 1
949    set_ui8vector_str(X[i++], 0, w-1, "1 1 1  1 1  1 1 1"); // 2
950    set_ui8vector_str(X[i++], 0, w-1, "1 1 1111 1111 1 1"); // 3
951    set_ui8vector_str(X[i++], 0, w-1, "1 1  1     1  1 1"); // 4
952    set_ui8vector_str(X[i++], 0, w-1, "1 1111     1111 1"); // 5
953    set_ui8vector_str(X[i++], 0, w-1, "1  1         1  1"); // 6
954    set_ui8vector_str(X[i++], 0, w-1, "1111         1111"); // 7
955   
956    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey5"); printf("");
957    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey5.txt");
958}
959// ---------------------------------------------------------------------
960void init_forme_Bailey6(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
961// ---------------------------------------------------------------------
962{
963    // a priori plus difficile que Bailey7
964    uint8 **X;
965    int i =  0;
966    int h = 11;
967    int w = 17;
968   
969    X = ui8matrix(0, h-1, 0, w-1);
970    zero_ui8matrix(X, 0, h-1, 0, w-1);
971   
972    *X0 = X;
973    *i0 = 0; *i1 = h-1;
974    *j0 = 0; *j1 = w-1;
975   
976    //                                 000000000011111111
977    //                                 012345678901234567
978    set_ui8vector_str(X[i++], 0, w-1, "1               1"); // 0
979    set_ui8vector_str(X[i++], 0, w-1, "1 1           1 1"); // 1
980    set_ui8vector_str(X[i++], 0, w-1, "1 1 1       1 1 1"); // 2
981    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1   1 1 1 1"); // 3
982    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 11111 1 1 1"); // 4
983    set_ui8vector_str(X[i++], 0, w-1, "1 1 1  1 1  1 1 1"); // 5
984    set_ui8vector_str(X[i++], 0, w-1, "1 1 1111 1111 1 1"); // 6
985    set_ui8vector_str(X[i++], 0, w-1, "1 1  1     1  1 1"); // 7
986    set_ui8vector_str(X[i++], 0, w-1, "1 1111     1111 1"); // 8
987    set_ui8vector_str(X[i++], 0, w-1, "1  1         1  1"); // 9
988    set_ui8vector_str(X[i++], 0, w-1, "1111         1111"); // 10
989   
990    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey6"); printf("");
991    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey6.txt");
992}
993// ---------------------------------------------------------------------
994void init_forme_Bailey6b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
995// ---------------------------------------------------------------------
996{
997    // a priori plus difficile que Bailey7
998    uint8 **X;
999    int i =  0;
1000    int h =  8;
1001    int w = 17;
1002   
1003    X = ui8matrix(0, h-1, 0, w-1);
1004    zero_ui8matrix(X, 0, h-1, 0, w-1);
1005   
1006    *X0 = X;
1007    *i0 = 0; *i1 = h-1;
1008    *j0 = 0; *j1 = w-1;
1009   
1010    //                                 000000000011111111
1011    //                                 012345678901234567
1012    set_ui8vector_str(X[i++], 0, w-1, "1               1"); // 0
1013    set_ui8vector_str(X[i++], 0, w-1, "1 1           1 1"); // 1
1014    set_ui8vector_str(X[i++], 0, w-1, "1 1 1       1 1 1"); // 2
1015    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1   1 1 1 1"); // 3
1016    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 11111 1 1 1"); // 4
1017    set_ui8vector_str(X[i++], 0, w-1, "1 1 111   111 1 1"); // 5
1018    set_ui8vector_str(X[i++], 0, w-1, "1 111       111 1"); // 6
1019    set_ui8vector_str(X[i++], 0, w-1, "111           111"); // 7
1020   
1021    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey6"); printf("");
1022    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey6.txt");
1023}
1024// ---------------------------------------------------------------------
1025void init_forme_Bailey7(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1026// ---------------------------------------------------------------------
1027{
1028    // a priori plus facile que Bailey6
1029    uint8 **X;
1030    int i =  0;
1031    int h =  8;
1032    int w = 17;
1033   
1034    X = ui8matrix(0, h-1, 0, w-1);
1035    zero_ui8matrix(X, 0, h-1, 0, w-1);
1036   
1037    *X0 = X;
1038    *i0 = 0; *i1 = h-1;
1039    *j0 = 0; *j1 = w-1;
1040   
1041    //                                 000000000011111111
1042    //                                 012345678901234567
1043    set_ui8vector_str(X[i++], 0, w-1, "      1   1      "); // 0
1044    set_ui8vector_str(X[i++], 0, w-1, "    1 11111 1    "); // 1
1045    set_ui8vector_str(X[i++], 0, w-1, "  1 1  1 1  1 1  "); // 2
1046    set_ui8vector_str(X[i++], 0, w-1, "1 1 1111 1111 1 1"); // 3
1047    set_ui8vector_str(X[i++], 0, w-1, "1 1  1     1  1 1"); // 4
1048    set_ui8vector_str(X[i++], 0, w-1, "1 1111     1111 1"); // 5
1049    set_ui8vector_str(X[i++], 0, w-1, "1  1         1  1"); // 6
1050    set_ui8vector_str(X[i++], 0, w-1, "1111         1111"); // 7
1051   
1052    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey7"); printf("");
1053    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey7.txt");
1054}
1055// ---------------------------------------------------------------------
1056void init_forme_Bailey8(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1057// ---------------------------------------------------------------------
1058{
1059    uint8 **X;
1060    int i =  0;
1061    int h =  3;
1062    int w = 19;
1063   
1064    X = ui8matrix(0, h-1, 0, w-1);
1065    zero_ui8matrix(X, 0, h-1, 0, w-1);
1066   
1067    *X0 = X;
1068    *i0 = 0; *i1 = h-1;
1069    *j0 = 0; *j1 = w-1;
1070   
1071    //                                 00000000001111111111
1072    //                                 01234567890123456789
1073    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1 1 1 1 1 1"); // 0
1074    set_ui8vector_str(X[i++], 0, w-1, "111 111 111 111 111"); // 1
1075    set_ui8vector_str(X[i++], 0, w-1, "  111 111 111 111  "); // 2
1076   
1077    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey8"); printf("");
1078    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey8.txt");
1079}
1080// ---------------------------------------------------------------------
1081void init_forme_Bailey9(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1082// ---------------------------------------------------------------------
1083{
1084    uint8 **X;
1085    int i =  0;
1086    int h =  4;
1087    int w = 24;
1088   
1089    X = ui8matrix(0, h-1, 0, w-1);
1090    zero_ui8matrix(X, 0, h-1, 0, w-1);
1091   
1092    *X0 = X;
1093    *i0 = 0; *i1 = h-1;
1094    *j0 = 0; *j1 = w-1;
1095   
1096    //                                 000000000011111111112222
1097    //                                 012345678901234567890123
1098    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1 1 1 1 1 1 1 1"); // 0
1099    set_ui8vector_str(X[i++], 0, w-1, "111 111 111 111 111 111"); // 1
1100    set_ui8vector_str(X[i++], 0, w-1, "  111 111     111 111  "); // 2
1101    set_ui8vector_str(X[i++], 0, w-1, "        1111111        "); // 3
1102   
1103    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey9"); printf("");
1104    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey9.txt");
1105}
1106// -----------------------------------------------------------------------
1107void init_forme_Bailey10a(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1108// -----------------------------------------------------------------------
1109{
1110    uint8 **X;
1111    int i =  0;
1112    int h =  5;
1113    int w =  7;
1114   
1115    X = ui8matrix(0, h-1, 0, w-1);
1116    zero_ui8matrix(X, 0, h-1, 0, w-1);
1117   
1118    *X0 = X;
1119    *i0 = 0; *i1 = h-1;
1120    *j0 = 0; *j1 = w-1;
1121   
1122    //                                 00000000
1123    //                                 01234567
1124    set_ui8vector_str(X[i++], 0, w-1, "1     1"); // 0
1125    set_ui8vector_str(X[i++], 0, w-1, "1   1 1"); // 1
1126    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1"); // 2
1127    set_ui8vector_str(X[i++], 0, w-1, "1 111 1"); // 3
1128    set_ui8vector_str(X[i++], 0, w-1, "111 111"); // 4
1129   
1130    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey10a"); printf("");
1131    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey10a.txt");
1132}
1133// -----------------------------------------------------------------------
1134void init_forme_Bailey10b(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1135// -----------------------------------------------------------------------
1136{
1137    // 10b = skrink(10a)
1138   
1139    uint8 **X;
1140    int i =  0;
1141    int h =  4;
1142    int w =  7;
1143   
1144    X = ui8matrix(0, h-1, 0, w-1);
1145    zero_ui8matrix(X, 0, h-1, 0, w-1);
1146   
1147    *X0 = X;
1148    *i0 = 0; *i1 = h-1;
1149    *j0 = 0; *j1 = w-1;
1150   
1151    //                                 00000000
1152    //                                 01234567
1153    set_ui8vector_str(X[i++], 0, w-1, "1     1"); // 1
1154    set_ui8vector_str(X[i++], 0, w-1, "1   1 1"); // 2
1155    set_ui8vector_str(X[i++], 0, w-1, "1 111 1"); // 3
1156    set_ui8vector_str(X[i++], 0, w-1, "111 111"); // 4
1157   
1158    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey10b"); printf("");
1159    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey10b.txt");
1160}
1161// -----------------------------------------------------------------------
1162void init_forme_Bailey10c(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1163// -----------------------------------------------------------------------
1164{
1165    // 10c = skrink(10b)
1166   
1167    uint8 **X;
1168    int i =  0;
1169    int h =  4;
1170    int w =  7;
1171   
1172    X = ui8matrix(0, h-1, 0, w-1);
1173    zero_ui8matrix(X, 0, h-1, 0, w-1);
1174   
1175    *X0 = X;
1176    *i0 = 0; *i1 = h-1;
1177    *j0 = 0; *j1 = w-1;
1178   
1179    //                                 00000000
1180    //                                 01234567
1181    set_ui8vector_str(X[i++], 0, w-1, "1     1"); // 0
1182    set_ui8vector_str(X[i++], 0, w-1, "1 111 1"); // 1
1183    set_ui8vector_str(X[i++], 0, w-1, "111 111"); // 2
1184   
1185   
1186    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey10c"); printf("");
1187    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey10c.txt");
1188}
1189// ------------------------------------------------------------------------
1190void init_forme_Bailey4_v1(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1191// ------------------------------------------------------------------------
1192{   
1193    uint8 **X;
1194    int i =  0;
1195    int h =  4;
1196    int w = 11;
1197   
1198    X = ui8matrix(0, h-1, 0, w-1);
1199    zero_ui8matrix(X, 0, h-1, 0, w-1);
1200   
1201    *X0 = X;
1202    *i0 = 0; *i1 = h-1;
1203    *j0 = 0; *j1 = w-1;
1204   
1205    //                                 0000000000111
1206    //                                 0123456789012
1207    set_ui8vector_str(X[i++], 0, w-1, "  111111111"); // 0
1208    set_ui8vector_str(X[i++], 0, w-1, "  1   1   1"); // 1
1209    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1 1 1"); // 2
1210    set_ui8vector_str(X[i++], 0, w-1, "111 111 111"); // 3
1211   
1212    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey4"); printf("");
1213    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey4.txt");
1214}
1215// ---------------------------------------------------------------------
1216void init_forme_Bailey5_(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1217// ---------------------------------------------------------------------
1218{   
1219    uint8 **X;
1220    int i =  0;
1221    int h =  4;
1222    int w =  7;
1223   
1224    X = ui8matrix(0, h-1, 0, w-1);
1225    zero_ui8matrix(X, 0, h-1, 0, w-1);
1226   
1227    *X0 = X;
1228    *i0 = 0; *i1 = h-1;
1229    *j0 = 0; *j1 = w-1;
1230   
1231    //                                 0000000000111
1232    //                                 0123456789012
1233    set_ui8vector_str(X[i++], 0, w-1, "1      "); // 0
1234    set_ui8vector_str(X[i++], 0, w-1, "1     1"); // 1
1235    set_ui8vector_str(X[i++], 0, w-1, "1 111 1"); // 2
1236    set_ui8vector_str(X[i++], 0, w-1, "111 111"); // 3
1237   
1238    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey5"); printf("");
1239    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey5.txt");
1240}
1241// ---------------------------------------------------------------------
1242void init_forme_Bailey6_(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1243// ---------------------------------------------------------------------
1244{   
1245    uint8 **X;
1246    int i =  0;
1247    int h =  4;
1248    int w =  7;
1249   
1250    X = ui8matrix(0, h-1, 0, w-1);
1251    zero_ui8matrix(X, 0, h-1, 0, w-1);
1252   
1253    *X0 = X;
1254    *i0 = 0; *i1 = h-1;
1255    *j0 = 0; *j1 = w-1;
1256   
1257    //                                 0000000000111
1258    //                                 0123456789012
1259    set_ui8vector_str(X[i++], 0, w-1, "      1"); // 0
1260    set_ui8vector_str(X[i++], 0, w-1, "1     1"); // 1
1261    set_ui8vector_str(X[i++], 0, w-1, "1 111 1"); // 2
1262    set_ui8vector_str(X[i++], 0, w-1, "111 111"); // 3
1263   
1264    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey6"); printf("");
1265    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey6.txt");
1266}
1267// ---------------------------------------------------------------------
1268void init_forme_Bailey7_(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1269// ---------------------------------------------------------------------
1270{   
1271    uint8 **X;
1272    int i =  0;
1273    int h =  4;
1274    int w =  7;
1275   
1276    X = ui8matrix(0, h-1, 0, w-1);
1277    zero_ui8matrix(X, 0, h-1, 0, w-1);
1278   
1279    *X0 = X;
1280    *i0 = 0; *i1 = h-1;
1281    *j0 = 0; *j1 = w-1;
1282   
1283    //                                 0000000000111
1284    //                                 0123456789012
1285    set_ui8vector_str(X[i++], 0, w-1, "1      "); // 0
1286    set_ui8vector_str(X[i++], 0, w-1, "1 111  "); // 1
1287    set_ui8vector_str(X[i++], 0, w-1, "1 1 1 1"); // 2
1288    set_ui8vector_str(X[i++], 0, w-1, "111 111"); // 3
1289   
1290    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey7"); printf("");
1291    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey7.txt");
1292}
1293// -----------------------------------------------------------------------
1294void init_forme_Bailey_10(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1295// -----------------------------------------------------------------------
1296{ 
1297    // 8-connexe
1298    uint8 **X;
1299    int i =  0;
1300    int h =  4;
1301    int w = 17;
1302   
1303    X = ui8matrix(0, h-1, 0, w-1);
1304    zero_ui8matrix(X, 0, h-1, 0, w-1);
1305   
1306    *X0 = X;
1307    *i0 = 0; *i1 = h-1;
1308    *j0 = 0; *j1 = w-1;
1309   
1310    //                                 000000000011111111
1311    //                                 012345678901234567
1312    set_ui8vector_str(X[i++], 0, w-1, ".111.111.111.111."); // 0
1313    set_ui8vector_str(X[i++], 0, w-1, "1...1...1...1...1"); // 1
1314    set_ui8vector_str(X[i++], 0, w-1, "1.11..11..11..11."); // 2
1315   
1316    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_Bailey2"); printf("");
1317    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_Bailey2.txt");
1318}
1319// --------------------------------------------------------------------
1320void init_forme_ipvs_1(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1321// --------------------------------------------------------------------
1322{ 
1323    // 8-connexe
1324    uint8 **X;
1325    int i =  0;
1326    int h =  3;
1327    int w =  8;
1328   
1329    X = ui8matrix(0, h-1, 0, w-1);
1330    zero_ui8matrix(X, 0, h-1, 0, w-1);
1331   
1332    *X0 = X;
1333    *i0 = 0; *i1 = h-1;
1334    *j0 = 0; *j1 = w-1;
1335   
1336    //                                 000000000
1337    //                                 012345678
1338    set_ui8vector_str(X[i++], 0, w-1, "1      1"); // 0
1339    set_ui8vector_str(X[i++], 0, w-1, "1 11111 "); // 1
1340    set_ui8vector_str(X[i++], 0, w-1, " 1  1   "); // 2
1341   
1342    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_ipvs_1"); printf("");
1343    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_ipvs_1.txt");
1344}
1345// --------------------------------------------------------------------
1346void init_forme_ipvs_2(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1347// --------------------------------------------------------------------
1348{ 
1349    // 8-connexe
1350    uint8 **X;
1351    int i =  0;
1352    int h =  4;
1353    int w =  8;
1354   
1355    X = ui8matrix(0, h-1, 0, w-1);
1356    zero_ui8matrix(X, 0, h-1, 0, w-1);
1357   
1358    *X0 = X;
1359    *i0 = 0; *i1 = h-1;
1360    *j0 = 0; *j1 = w-1;
1361   
1362    //                                 000000000
1363    //                                 012345678
1364    set_ui8vector_str(X[i++], 0, w-1, "1 111111"); // 0
1365    set_ui8vector_str(X[i++], 0, w-1, "1 1    1"); // 1
1366    set_ui8vector_str(X[i++], 0, w-1, "1 1  111"); // 2
1367    set_ui8vector_str(X[i++], 0, w-1, " 1  1   "); // 3
1368   
1369    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_ipvs_2"); printf("");
1370    write_ui8matrix_positive(  X, 0, h-1, 0, w-1, 4, "forme_ipvs_2.txt");
1371}
1372// ---------------------------------------------------------------------
1373void init_forme_boulon1(uint8 ***X0, int *i0, int *i1, int *j0, int *j1)
1374// ---------------------------------------------------------------------
1375{ 
1376    uint8 **X;
1377    int i =   0;
1378    int h =  28;
1379    int w =  30;
1380   
1381    X = ui8matrix(0, h-1, 0, w-1);
1382    zero_ui8matrix(X, 0, h-1, 0, w-1);
1383   
1384    *X0 = X;
1385    *i0 = 0; *i1 = h-1;
1386    *j0 = 0; *j1 = w-1;
1387   
1388    //                                 0000000001111111111122222222223
1389    //                                 0123456789012345678901234567890
1390    set_ui8vector_str(X[i++], 0, w-1, "                         111  "); // 00
1391    set_ui8vector_str(X[i++], 0, w-1, "                        11111 "); // 01
1392    set_ui8vector_str(X[i++], 0, w-1, "                      1111111 "); // 02
1393    set_ui8vector_str(X[i++], 0, w-1, "                     11111111 "); // 03
1394    set_ui8vector_str(X[i++], 0, w-1, "                    1111111111"); // 04
1395    set_ui8vector_str(X[i++], 0, w-1, "                   11111111111"); // 05
1396    set_ui8vector_str(X[i++], 0, w-1, "                 1111111111111"); // 06
1397    set_ui8vector_str(X[i++], 0, w-1, "               11111111111111 "); // 07
1398    set_ui8vector_str(X[i++], 0, w-1, "              11111111111111  "); // 08
1399    set_ui8vector_str(X[i++], 0, w-1, "             11111111111111   "); // 09
1400    set_ui8vector_str(X[i++], 0, w-1, "     11    11111111111111     "); // 10
1401    set_ui8vector_str(X[i++], 0, w-1, "    111   11111111111111      "); // 11
1402    set_ui8vector_str(X[i++], 0, w-1, "   11111111111111111111       "); // 12
1403    set_ui8vector_str(X[i++], 0, w-1, " 11111111111111111111         "); // 13
1404    set_ui8vector_str(X[i++], 0, w-1, "1111111111111111111           "); // 14
1405    set_ui8vector_str(X[i++], 0, w-1, " 11111111111111111            "); // 15
1406    set_ui8vector_str(X[i++], 0, w-1, " 1111111111111111             "); // 16
1407    set_ui8vector_str(X[i++], 0, w-1, " 111111111111111              "); // 17
1408    set_ui8vector_str(X[i++], 0, w-1, "  111111111111                "); // 18
1409    set_ui8vector_str(X[i++], 0, w-1, "  1111111111                  "); // 29
1410    set_ui8vector_str(X[i++], 0, w-1, "  1111111111                  "); // 20
1411    set_ui8vector_str(X[i++], 0, w-1, "   111111111                  "); // 21
1412    set_ui8vector_str(X[i++], 0, w-1, "   111111111                  "); // 22
1413    set_ui8vector_str(X[i++], 0, w-1, "    11111111                  "); // 23
1414    set_ui8vector_str(X[i++], 0, w-1, "    1111111                   "); // 24
1415    set_ui8vector_str(X[i++], 0, w-1, "     11111                    "); // 25
1416    set_ui8vector_str(X[i++], 0, w-1, "     111                      "); // 26
1417    set_ui8vector_str(X[i++], 0, w-1, "                              "); // 27
1418   
1419    display_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_boulon1");
1420    printf("");
1421    write_ui8matrix_positive(X, 0, h-1, 0, w-1, 4, "forme_boulon1.txt");
1422}
Note: See TracBrowser for help on using the repository browser.