Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

563604 views
1
#include <typedef.h>
2
#include <getput.h>
3
#include <matrix.h>
4
#include <sort.h>
5
#include <bravais.h>
6
#include <base.h>
7
#include <longtools.h>
8
#include <datei.h>
9
#include <presentation.h>
10
11
12
extern int INFO_LEVEL;
13
extern int SFLAG;
14
15
#define DEBUG FALSE
16
17
18
static matrix_TYP *search_inverse(bahn *s,
19
matrix_TYP *x)
20
{
21
22
int i;
23
24
for (i=0;i<s->length;i++)
25
if (s->representatives[i] == x)
26
return s->rep_invs[i];
27
28
return (matrix_TYP *) -1;
29
30
} /* search_inverse(...) */
31
32
33
34
static void con_reduce(int *w){
35
36
int i = 1;
37
38
while (i){
39
if (w[1] == -w[w[0]]){
40
for (i=1;i<w[0];i++) w[i] = w[i+1];
41
w[0] -= 2;
42
}
43
else{
44
i = 0;
45
}
46
}
47
48
return;
49
50
} /* con_reduce */
51
52
53
void normalize_word(int *w){
54
55
int i,
56
j;
57
58
for (i=w[0];i>1;i--){
59
if (w[i] == -w[i-1]){
60
for (j=i+1;j<=w[0];j++) w[j-2] = w[j];
61
w[0] -= 2;
62
i = w[0] + 1;
63
}
64
}
65
66
return;
67
68
} /* normalize_word(int *w) */
69
70
71
72
static void order(int **w,
73
int *l)
74
{
75
76
int i,
77
*P,
78
good = 1;
79
80
while (good){
81
good = 0;
82
83
for (i=0;i<l[0]-1;i++){
84
if (w[i][0] > w[i+1][0]){
85
P = w[i];
86
w[i] = w[i+1];
87
w[i+1] = P;
88
good = 1;
89
}
90
}
91
}
92
93
94
return;
95
96
} /* order(...) */
97
98
static int skip_sub_relator(int *w1,int *w2){
99
100
int i,j,n,*wn;
101
102
n = w1[0]/2 + 1;
103
104
for (i=0;i<(w2[0] - n +1);i++){
105
if (!memcmp(w1+1,w2+1+i,n*sizeof(int))){
106
wn = (int *) malloc((1+w1[0]+w2[0]) * sizeof(int));
107
wn[0] = w1[0]+w2[0];
108
memcpy(wn+1,w2+1,i * sizeof(int));
109
for (j=1;j<=w1[0];j++)
110
wn[j+i] = -w1[w1[0] - j + 1];
111
memcpy(wn+i+1+w1[0],w2+i+1,(w2[0] - i) * sizeof(int));
112
113
normalize_word(wn);
114
if (wn[0] >= w2[0]){
115
fprintf(stderr,"error\n");
116
exit(3);
117
}
118
119
memcpy(w2,wn,(wn[0] + 1) * sizeof(int));
120
free(wn);
121
return TRUE;
122
}
123
124
}
125
126
return FALSE;
127
} /* skip_sub_relator(...) */
128
129
130
static int skip_sub_relator_inv(int *w1,int *w2){
131
132
int i,
133
j;
134
135
static int wi[11];
136
137
if (w1[0] > 10) return FALSE;
138
139
for (i=1,j=w1[0] ; i<=w1[0] ; i++,j--)
140
wi[i] = -w1[j];
141
wi[0] = w1[0];
142
143
return skip_sub_relator(wi,w2);
144
145
} /* skip_sub_relator_inv(...) */
146
147
148
149
void simplify_presentation(int **w,
150
int *l){
151
int i,
152
j,
153
good = 1;
154
155
while (good){
156
good = 0;
157
158
/* search for trivial relators */
159
for (i=0;i<l[0];i++){
160
if (w[i][0] == 0){
161
free(w[i]);
162
l[0]--;
163
w[i] = w[l[0]];
164
good = 1;
165
i = l[0] + 1;
166
}
167
}
168
169
/* oder the relators according to their length */
170
order(w,l);
171
172
173
/* see if one of the short relators is a subrelator of a longer one */
174
for (i=0;i<l[0] - 1; i++){
175
for (j=l[0]-1;j>i ; j--){
176
if (w[i][0] > 0 &&
177
w[j][0] > 0){
178
if(skip_sub_relator(w[i],w[j]) || skip_sub_relator_inv(w[i],w[j]))
179
good = TRUE;
180
}
181
}
182
}
183
184
for (i=0;i<l[0];i++){
185
normalize_word(w[i]);
186
con_reduce(w[i]);
187
}
188
189
j = 0 ;
190
for (i=0;i<l[0];j+=w[i][0] , i++);
191
192
if (DEBUG)
193
fprintf(stderr,"%d relators of total length %d\n",i,j);
194
195
}
196
197
198
return;
199
200
} /* simplify_presentation(...) */
201
202
203
static int *relator3(int k,
204
int *w1,
205
int *w2){
206
207
int i,
208
j,
209
*res;
210
211
212
res = (int *) calloc( w1[0] + w2[0] + 2, sizeof(int));
213
res[0] = w1[0] + w2[0] + 1;
214
215
memcpy(res+2,w1+1,w1[0] * sizeof(int));
216
res[1] = k+1;
217
218
for (i=1,j=res[0];i<=w2[0];j--,i++)
219
res[j] = -w2[i];
220
221
return res;
222
223
} /* relator3 (....) */
224
225
static int *relator2(int *w1,
226
int *wz,
227
int *w2){
228
229
int i,
230
j,
231
*res;
232
233
234
res = (int *) calloc( w1[0] + w2[0] + wz[0] + 1 , sizeof(int));
235
res[0] = w1[0] + w2[0] + wz[0];
236
237
memcpy(res+1,w1+1,w1[0] * sizeof(int));
238
memcpy(res+1+w1[0],wz+1,wz[0] * sizeof(int));
239
240
for (i=1,j=res[0];i<=w2[0];j--,i++)
241
res[j] = -w2[i];
242
243
return res;
244
245
} /* relator2 (....) */
246
247
248
/**************************************************************************
249
@
250
@--------------------------------------------------------------------------
251
@
252
@ void put_presentation(int **w,
253
@ int l,
254
@ bravais_TYP *G,
255
@ char *O)
256
@
257
@
258
@
259
@
260
@--------------------------------------------------------------------------
261
@
262
***************************************************************************/
263
void put_presentation(int **w,
264
int l,
265
bravais_TYP *G,
266
char *O){
267
268
int i;
269
270
271
if (strchr(O,'G')){
272
if (strchr(O,'4')){
273
printf("F := FreeGroup(%d);\n",G->gen_no);
274
printf("g := GeneratorsOfGroup(F);");
275
}
276
277
printf("rel := [\n");
278
}
279
280
for (i=0;i<l-1;i++){
281
put_word(w[i],O);
282
283
if (strchr(O,'G')){
284
printf(",\n");
285
}
286
}
287
288
put_word(w[i],O);
289
if (strchr(O,'G')){
290
printf("];\n");
291
}
292
293
294
if (strchr(O,'G')){
295
296
printf("G := F/ rel;\n");
297
298
if (strchr(O,'V')){
299
printf("p := PresentationFpGroup(G);\n");
300
printf("TzGoGo(p);\n");
301
printf("G := FpGroupPresentation(p);\n");
302
}
303
304
if (strchr(O,'S')){
305
printf("Size(G);\n");
306
}
307
308
if (strchr(O,'Q')){
309
printf("quit;\n");
310
}
311
}
312
313
return;
314
315
} /* put_presentation(...) */
316
317
318
319
320
static int *get_word_to_generator(bahn *A,
321
matrix_TYP *h)
322
{
323
324
int i;
325
326
for (i=0;i<A->length && mat_comp(A->representatives[i],h) ; i++);
327
328
if (i == A->length){
329
fprintf(stderr,"error\n");
330
exit(3);
331
}
332
333
return A->words[i];
334
335
} /* get_word_to_generator */
336
337
338
339
int *mul_word(int *w1,
340
int *w2){
341
342
int *w;
343
344
345
w = (int *) malloc((w1[0]+w2[0]+1) * sizeof(int));
346
347
w[0] = w1[0]+w2[0];
348
349
memcpy(w+1,w1+1,w1[0]*sizeof(int));
350
memcpy(w+1+w1[0],w2+1,w2[0]*sizeof(int));
351
352
return w;
353
354
}
355
356
357
static int needed(matrix_TYP **VL,
358
matrix_TYP *x,
359
matrix_TYP **GEN){
360
361
int i = 0,
362
j,
363
k,
364
RES = FALSE;
365
366
matrix_TYP *y;
367
368
369
i=0;
370
while(VL[i]){
371
y = mat_mul(x,VL[i]);
372
373
j=0;
374
while(VL[j] && y){
375
if (!mat_comp(VL[j],y)){
376
free_mat(y);
377
y = NULL;
378
}
379
j++;
380
}
381
if (y){
382
VL[j] = y;
383
RES = TRUE;
384
}
385
386
i++;
387
}
388
389
if (RES){
390
391
i=0;
392
while(GEN[i]) i++;
393
GEN[i] = x;
394
395
i = 0;
396
while (VL[i]){
397
398
k = 0;
399
while(GEN[k]){
400
y = mat_mul(GEN[k],VL[i]);
401
402
j=0;
403
while(VL[j] && y){
404
if (!mat_comp(VL[j],y)){
405
free_mat(y);
406
y = NULL;
407
}
408
j++;
409
}
410
if (y){
411
VL[j] = y;
412
}
413
k++;
414
}
415
i++;
416
}
417
}
418
419
return RES;
420
421
} /* needed (.....) */
422
423
424
/*************************************************************************
425
@
426
@-------------------------------------------------------------------------
427
@
428
@
429
@-------------------------------------------------------------------------
430
@
431
**************************************************************************/
432
static void con_relations(bravais_TYP *G,
433
matrix_TYP **GGENINV,
434
matrix_TYP **GEN,
435
matrix_TYP **GENINV,
436
int **GW,
437
bahn **s,
438
int level,
439
int ***w,
440
int *l,
441
int *speicher,
442
matrix_TYP **GENU,
443
int **GENUW,
444
int GENU_NO)
445
{
446
447
448
matrix_TYP **VS,
449
**GENUH,
450
*y,
451
*x;
452
453
454
int i,
455
j,
456
k,
457
*w2 = NULL,
458
*w3,
459
**GENUWH,
460
found = GENU_NO;
461
462
463
464
VS = (matrix_TYP **) calloc(s[level]->length+1,sizeof(matrix_TYP *));
465
VS[0] = s[level]->orbit[0];
466
467
GENUWH = (int **) malloc((GENU_NO+s[level]->length) * sizeof(int *));
468
GENUH = (matrix_TYP **) calloc((GENU_NO+s[level]->length),
469
sizeof(matrix_TYP*));
470
memcpy(GENUH,GENU,GENU_NO * sizeof(matrix_TYP *));
471
memcpy(GENUWH,GENUW,GENU_NO * sizeof(int *));
472
473
/* see which conjugate we will need */
474
for (i=0;i<found;i++){
475
k = TRUE;
476
for (j=0;j<s[level]->gen_no && k;j++){
477
478
x = mat_kon(GEN[j],GENUH[i],GENINV[j]);
479
480
if (needed(VS,x,GENUH+GENU_NO)){
481
GENUWH[found] = relator2(GW[j],GENUWH[i],GW[j]);
482
483
if (DEBUG){
484
y = mapped_word(GENUWH[found],G->gen,GGENINV);
485
486
if (mat_comp(x,y)){
487
fprintf(stderr,"error in pres\n");
488
exit(3);
489
}
490
free_mat(y);
491
}
492
493
found++;
494
}
495
else{
496
free_mat(x);
497
}
498
499
for (k=0;VS[k];k++);
500
k = (k==s[level]->length);
501
502
}
503
}
504
505
506
if (DEBUG)
507
fprintf(stderr,"GENU_NO %d found %d level %d\n",GENU_NO,found,level);
508
509
/* conjugate relations */
510
for (i=0;i<found;i++){
511
for (j=0;j<s[level]->gen_no;j++){
512
513
x = mat_kon(GEN[j],GENUH[i],GENINV[j]);
514
515
/* find a word in the generators, and check a bit */
516
if (!is_element(x,G,s,&w2)){
517
fprintf(stderr,"error in pres\n");
518
exit(3);
519
}
520
521
if (DEBUG){
522
y = mapped_word(w2,G->gen,GGENINV);
523
524
if (mat_comp(x,y)){
525
fprintf(stderr,"error in pres\n");
526
exit(3);
527
}
528
free_mat(y);
529
}
530
531
w3 = relator2(GW[j],GENUWH[i],GW[j]);
532
533
if (DEBUG){
534
y = mapped_word(w3,G->gen,GGENINV);
535
536
if (mat_comp(x,y)){
537
fprintf(stderr,"error in pres\n");
538
exit(3);
539
}
540
free_mat(y);
541
}
542
543
if ( *l == *speicher){
544
*speicher += 256;
545
*w = (int **) realloc(*w,*speicher * sizeof(int *));
546
}
547
548
549
k = 0;
550
w[0][*l] = relator2(&k,w3,w2);
551
552
normalize_word(w[0][*l]);
553
con_reduce(w[0][*l]);
554
555
if (DEBUG){
556
y = mapped_word(w[0][*l],G->gen,GGENINV);
557
Check_mat(y);
558
if (!y->flags.Diagonal){
559
fprintf(stderr,"error in pres\n");
560
exit(3);
561
}
562
free_mat(y);
563
}
564
565
if (w[0][*l][0] == 0){
566
free(w[0][*l]);
567
}
568
else{
569
/* put_word(w[0][*l],"M"); */
570
(*l)++;
571
}
572
573
free(w3);
574
free(w2); w2 = NULL;
575
free_mat(x);
576
}
577
}
578
579
580
for (i=GENU_NO;i<found;i++){
581
free_mat(GENUH[i]);
582
free(GENUWH[i]);
583
}
584
free(GENUH);
585
free(GENUWH);
586
587
for (i=1;i<s[level]->length;i++)
588
if (VS[i]) free_mat(VS[i]);
589
free(VS);
590
591
return;
592
593
}
594
595
596
597
matrix_TYP *pres_on_many_generators(bravais_TYP *G,
598
int *OPT){
599
600
601
bravais_TYP *H;
602
bahn **s;
603
matrix_TYP **basis;
604
int i,j;
605
int k,l;
606
int zeile;
607
matrix_TYP *RES;
608
int MAX = G->gen_no + 2;
609
int *w;
610
611
s = NULL;
612
H = copy_bravais(G);
613
614
basis = get_base(H);
615
616
617
if (H->gen_no > H->dim){
618
H->order = red_gen(H,basis,&s,0);
619
for (i=0;i<H->dim;i++){
620
free_bahn(s[i]);
621
free(s[i]);
622
}
623
free(s);
624
}
625
626
s = strong_generators(basis,H,TRUE);
627
628
/* the situation is: H = G as a group, and the generators of H form a subset of the generators of G */
629
630
/* calculate a presentation for H on the generators of H */
631
RES = pres(s,H,OPT);
632
633
zeile = RES->rows;
634
real_mat(RES,RES->rows + G->gen_no , RES->cols);
635
636
/* add relations of the form g_i = word(h_j) for those g_i which are not in the generators of H, */
637
/* but represent the g_i by i+MAX */
638
/* mathemetically this is an tietze tranformation of the third (?) kind, add a generator */
639
/* <h_i|rs> \cong <h_i,g| rs,g=w(h_i) > */
640
for (i=0;i<G->gen_no;i++){
641
642
/* is_element calculates a word such that g_i = w(h_j) */
643
w = NULL;
644
if(!is_element(G->gen[i],H,s,&w)){
645
fprintf(stderr,"error in pres_on_many_generators(...)\n");
646
exit(3);
647
}
648
649
if (RES->cols <= w[0]){
650
real_mat(RES,RES->rows,w[0]+1);
651
}
652
653
/* the relation is now g_i^(-1) * w(h_J) = 1 */
654
memcpy(RES->array.SZ[zeile],w,(w[0]+1) * sizeof(int));
655
RES->array.SZ[zeile][0] = -i - 1 - MAX;
656
657
/* for sanitary reasons remove those relations which look like g_i * g_i^(-1) */
658
if (w[0] == 1 && w[1] == i+1){
659
RES->array.SZ[zeile][0] = 0;
660
RES->array.SZ[zeile][1] = 0;
661
}
662
else{
663
zeile++;
664
}
665
666
free(w);
667
}
668
669
if (zeile < RES->rows)
670
real_mat(RES,zeile,RES->cols);
671
672
673
/* translate this presentation in the generators of G */
674
/* on strange thing : to be able to do this in one go, we represent the j-th generator of G */
675
/* by the number j+MAX temporaly */
676
for (i=0; i< H->gen_no ; i++){
677
678
/* search for a j with H->gen[i] == G->gen[j] */
679
for (j=0; j< G->gen_no && mat_comp(H->gen[i],G->gen[j]) ; j++);
680
681
/* replace every occurence of i+1 or -(i+1) in RES with (j+1)+MAX or -(j+1)-MAX respectively */
682
for (k=0;k<RES->rows;k++){
683
for (l=0;l<RES->cols;l++){
684
if (RES->array.SZ[k][l] == i+1)
685
RES->array.SZ[k][l] = j + 1 + MAX;
686
else if (RES->array.SZ[k][l] == -i-1)
687
RES->array.SZ[k][l] = -j - 1 - MAX;
688
}
689
}
690
}
691
692
/* now RES contains relations for G with the strange thing that the number j generator has been
693
replaced with the generator j+MAX temporaly if it is also a generator of H */
694
for (k=0;k<RES->rows;k++){
695
for (l=0;l<RES->cols;l++){
696
if (RES->array.SZ[k][l] > MAX)
697
RES->array.SZ[k][l] -= MAX;
698
else if (RES->array.SZ[k][l] < -MAX)
699
RES->array.SZ[k][l] += MAX;
700
}
701
}
702
703
704
705
/* clean up */
706
for (i=0;i<H->dim;i++){
707
free_mat(basis[i]);
708
free_bahn(s[i]);
709
free(s[i]);
710
}
711
free(basis);
712
free(s);
713
free_bravais(H);
714
715
return RES;
716
717
718
} /* pres_on_many_generators(...) */
719
720
721
/************************************************************************
722
@
723
@------------------------------------------------------------------------
724
@
725
@ matrix_TYP *pres(bahn **s,
726
@ bravais_TYP *G,
727
@ int *OPT)
728
@
729
@
730
@
731
@------------------------------------------------------------------------
732
@
733
*************************************************************************/
734
matrix_TYP *pres(bahn **s,
735
bravais_TYP *G,
736
int *OPT){
737
738
matrix_TYP *M,
739
*x,
740
*y,
741
*g,
742
**GENU,
743
**GENUINV,
744
**GENINV = NULL;
745
746
static int has_been_called_recursively;
747
748
int i,
749
ii,
750
j,
751
k,
752
l = 0,
753
GENU_NO = 0,
754
**GENUW,
755
**GW,
756
speicher = 256 - 8,
757
*w2 = NULL,
758
**w;
759
760
if ((!has_been_called_recursively && G->gen_no > G->dim) || s == NULL){
761
/* many gerators, treat it differently */
762
/* and prevent using users the form pres_on_many_generators just because they are too lazy to calculate */
763
/* s, and calculate it for them */
764
has_been_called_recursively = TRUE;
765
return pres_on_many_generators(G,OPT);
766
}
767
768
has_been_called_recursively = FALSE;
769
770
GENU = (matrix_TYP **) malloc(sizeof(matrix_TYP *));
771
GENUINV = (matrix_TYP **) malloc(sizeof(matrix_TYP *));
772
GENUW = (int **) malloc(sizeof(int *));
773
774
GENINV = (matrix_TYP **) calloc(G->gen_no,sizeof(matrix_TYP*));
775
776
for (i=0;i<G->gen_no;i++)
777
GENINV[i] = long_mat_inv(G->gen[i]);
778
779
/* alloc space for the result */
780
w = (int **) calloc(speicher , sizeof(int*));
781
782
s[0]->gen_no = G->gen_no;
783
784
for (i=G->dim-1;i>=0;i--){
785
for (j=0;j<s[i]->length;j++){
786
787
/* relations of the first kind */
788
if (i==0){
789
ii=G->gen_no;
790
}
791
else{
792
ii = G->gen_no + s[i]->gen_no;
793
}
794
for (k=0;k<ii;k++){
795
796
if ( l == speicher){
797
speicher += 256;
798
w = (int **) realloc(w,speicher * sizeof(int*));
799
}
800
801
if (k < G->gen_no){
802
g = G->gen[k];
803
}
804
else{
805
g = s[i]->generators[k - G->gen_no];
806
}
807
808
x = mat_mul(g,s[i]->representatives[j]);
809
810
if (!is_element(x,G,s,&w2)){
811
fprintf(stderr,"error in pres\n");
812
exit(3);
813
}
814
815
if (DEBUG){
816
y = mapped_word(w2,G->gen,GENINV);
817
818
if (mat_comp(x,y)){
819
fprintf(stderr,"error in pres\n");
820
exit(3);
821
}
822
free_mat(y);
823
824
}
825
826
827
if (k<G->gen_no){
828
w[l] = relator3(k,s[i]->words[j],w2);
829
}
830
else{
831
w[l] = relator2(get_word_to_generator(s[i],g),s[i]->words[j],w2);
832
}
833
834
normalize_word(w[l]);
835
con_reduce(w[l]);
836
837
if (DEBUG){
838
y = mapped_word(w[l],G->gen,GENINV);
839
Check_mat(y);
840
if (!y->flags.Diagonal){
841
fprintf(stderr,"error in pres\n");
842
exit(3);
843
}
844
free_mat(y);
845
}
846
847
if (w[l][0] == 0){
848
free(w[l]);
849
}
850
else{
851
/* put_word(w[l],"M"); */
852
l++;
853
}
854
855
free_mat(x);
856
free(w2); w2 = NULL;
857
858
}
859
860
861
}
862
863
if (i<G->dim -1 ){
864
/* relations of the second kind, conjugation */
865
GENU = (matrix_TYP **) realloc(GENU,(GENU_NO+1+s[i+1]->gen_no)
866
*sizeof(matrix_TYP *));
867
GENUW = (int **) realloc(GENUW,(GENU_NO+1+s[i+1]->gen_no)
868
*sizeof(int*));
869
870
for (k=0;k<s[i+1]->gen_no;k++){
871
GENU[GENU_NO + k] = s[i+1]->generators[k];
872
GENUW[GENU_NO + k] = get_word_to_generator(s[i+1],
873
s[i+1]->generators[k]);
874
}
875
GENU_NO += s[i+1]->gen_no;
876
877
GW = (int **) malloc(s[i]->gen_no * sizeof(int*));
878
if (i==0){
879
880
for (k=0;k<G->gen_no;k++){
881
GW[k] = (int *) malloc(2*sizeof(int));
882
GW[k][0] = 1;
883
GW[k][1] = k+1;
884
}
885
886
con_relations(G,GENINV,G->gen,GENINV,
887
GW,s,i,
888
&w,&l,&speicher,
889
GENU,GENUW,GENU_NO);
890
891
for (k=0;k<G->gen_no;k++)
892
free(GW[k]);
893
}
894
else{
895
896
GENUINV = (matrix_TYP **) realloc(GENUINV,
897
s[i]->gen_no*sizeof(matrix_TYP*));
898
for (k=0;k<s[i]->gen_no;k++){
899
GW[k] = (int *) get_word_to_generator(s[i],s[i]->generators[k]);
900
GENUINV[k] = search_inverse(s[i],s[i]->generators[k]);
901
}
902
903
con_relations(G,GENINV,s[i]->generators,GENUINV,
904
GW,s,i,
905
&w,&l,&speicher,
906
GENU,GENUW,GENU_NO);
907
}
908
909
free(GW);
910
911
}
912
913
914
}
915
916
/* put_presentation(w,l,G,"G4"); */
917
918
simplify_presentation(w,&l);
919
920
if (DEBUG){
921
for (i=0;i<l;i++){
922
y = mapped_word(w[0],G->gen,GENINV);
923
Check_mat(y);
924
if (!y->flags.Diagonal){
925
fprintf(stderr,"error in pres\n");
926
exit(3);
927
}
928
free_mat(y);
929
}
930
}
931
932
if (GENINV){
933
for (i=0;i<G->gen_no;i++)
934
if (GENINV[i]) free_mat(GENINV[i]);
935
free(GENINV);
936
}
937
938
939
if (OPT && OPT[0])
940
put_presentation(w,l,G,"GSV4");
941
942
j=0;
943
for (i=0;i<l;i++) if (j<w[i][0]) j = w[i][0];
944
M = init_mat(l,j,"i");
945
for (i=0;i<l;i++){
946
memcpy(M->array.SZ[i],w[i]+1,w[i][0]*sizeof(int));
947
free(w[i]);
948
}
949
free(w);
950
free(GENU);
951
free(GENUINV);
952
free(GENUW);
953
954
/* put_mat(M,0,0,0); */
955
956
return M;
957
} /* pres(....) */
958
959
960
961