-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfdalg.spad
2525 lines (2305 loc) · 93.3 KB
/
fdalg.spad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- Free Fields in FriCAS
-- Created: Mon 2016-03-21 13:07
-- Changed: Mon 2017-06-12 13:07
-- Changed: Die 2018-07-03 19:25
-- Changed: Don 2018-08-30 09:09
-- Changed: Fre 2018-09-07 14:24
)abbreviation domain FDALG FreeDivisionAlgebra
++ Author: Konrad Schrempf <[email protected]>
++ Date Created: Mit 2016-08-17 09:27
++ Date Changed: Fre 2018-09-07 14:24
++ Basic Functions:
++ Related Constructors: LinearMultivariateMatrixPencil, XDistributedPolynomial, FreeAssociative Algebra
++ Also See: XDistributedPolynomialFunctions
++ AMS Classifications:
++ Keywords: admissible linear system, minimal linear representation, noncommutative rational function, linearization, realization
++ References: Cohn and Reutenauer 1999, Schrempf 2017/2018
++ Description:
++ The elements of the Free Field are represented by Admissible
++ Linear Systems (ALS) in standard form ...
FreeDivisionAlgebra(VAR, F) : Exports == Implementation where
F : Field
VAR : OrderedSet
FLGDBG ==> true
ALTOUT ==> true
PI ==> PositiveInteger
NNI ==> NonNegativeInteger
OF ==> OutputForm
LMMP ==> LinearMultivariateMatrixPencil(F)
G ==> Polynomial(F)
EQG ==> Equation(G)
FG ==> Fraction(G)
EQFG ==> Equation(FG)
M1 ==> FreeMonoid(VAR)
XDP ==> XDistributedPolynomial(VAR, F)
TERM ==> Record(k:M1, c:F)
IDXMIN ==> 1$NNI
IDXMAX ==> 2::NNI
IDXSZE ==> 3::NNI
IDXREF ==> 4::NNI
Exports == Join(DivisionRing(), Algebra(F)) with
-- Declaration (internal)
-- Changed: Fre 2018-09-07 14:27
interval : (NNI, NNI) -> List(NNI)
++ \spad{interval(i, j)} creates list [i, i+1, ..., j]
-- Declaration (basics)
-- Changed: Mit 2018-08-15 20:23
-- Changed: Sam 2018-09-01 23:07
qnew : (NNI) -> %
++ \spad{qnew(n)} creates an empty ALS of dimension n.
qnew : (NNI, List(M1)) -> %
++ \spad{qnew(n, lst)} creates an empty ALS of dimension n.
new : (LMMP, List(M1)) -> %
++ \spad{new(lp, lst)} creates an element by the linear
++ multivariate matrix pencil lp and the list of monomials lst.
new : (c:F) -> %
++ \spad{new(c)} creates a constant element.
new : (m:M1, c:F) -> %
++ \spad{new(m,c)} creates a monomial element with coefficient c.
copy : (%) -> %
++ \spad{copy(f)} gives a copy of the element f.
copy : (%, F) -> %
++ \spad{copy(f, alpha)} gives a copy of element f
++ multiplied by alpha.
coerce : (m:M1) -> %
++ \spad{coerce(m)} converts the monoid m into an element of
++ the free field represented by an ALS in minimal refined form.
coerce : (c:F) -> %
++ \spad{coerce(c)} converts the constant c into an element of
++ the free field represented by an ALS in minimal refined form.
enableDebugOutput : (f:%) -> %
++ \spad{enableDebugOutput(f)} enable displaying the ALS.
disableDebugOutput : (f:%) -> %
++ \spad{disableDebugOutput(f)} disable displaying the ALS.
toggleDebugOutput : (f:%) -> %
++ \spad{toggleDebugOutput(f)} enable/disable ALS.
enableAlternativeOutput : (f:%) -> %
++ \spad{enableAlternativeOutput(f)} enable output as
++ rational expression.
disableAlternativeOutput : (f:%) -> %
++ \spad{disableAlternativeOutput(f)} disable output as
++ rational expression.
toggleAlternativeOutput : (f:%) -> %
++ \spad{toggleAlternativeOutput(f)} enable/disable output
++ as rational expression.
minimal? : (%) -> Boolean
++ \spad{minimal?(f)} is f represented by a minimal ALS?
mutable? : (%) -> Boolean
++ \spad{mutable?(f)} is the underlying ALS of f mutable?
qregular? : (%, NNI, NNI) -> Boolean
++ \spad{qregular?(f, i_min, i_max)} does the specified
++ diagonal block define a regular element?
scalar? : (%, NNI, NNI) -> Boolean
++ \spad{scalar?(f, i, j)} is A(i,j) scalar?
zero? : (%, NNI, NNI) -> Boolean
++ \spad{zero?(f, i, j)} is A(i,j) zero?
scalar? : (%) -> Boolean
++ \spad{scalar?(f)} is f scalar?
regular? : (%) -> Boolean
++ \spad{regular?(f)} is f a regular element?
polynomial? : (%) -> Boolean
++ \spad{polynomial?(f)} is the ALS in polynomial form?
dimension : (%) -> NNI
++ \spad{dimension(f)} returns the dimension of the ALS.
variables : (%) -> List(M1)
++ \spad{variables(f)} returns a list of the variables.
elt : (%, NNI) -> F
++ \spad{elt(f, i)} returns v(i) from the ALS of f.
qelt : (%, NNI, NNI) -> XDP
++ \spad{qelt(f, i, j)} returns A(i,j) from the ALS of f.
elt : (%, NNI, NNI) -> XDP
++ \spad{elt(f, i, j)} returns A(i,j) from the ALS of f.
setelt! : (%, NNI, F) -> F
++ \spad{setelt!(f, i, alpha)} sets v(i) = alpha in the ALS of f.
setelt! : (%, NNI, NNI, XDP) -> XDP
++ \spad{setelt!(f, i, j, p)} sets A(i,j) = p in the ALS of f
++ (where p has degree less equal one) if the system is in
++ polynomial form and j>i.
vector : (%) -> Matrix(F)
++ \spad{vector(f)} returns v from the ALS of f.
vector : (%) -> Matrix(XDP)
++ \spad{vector(f)} returns v from the ALS of f.
matrix : (%, M1) -> Matrix(F)
++ \spad{matrix(f,m)} returns the coefficient matrix for
++ the monomial m of the ALS of f.
matrix : (%) -> Matrix(XDP)
++ \spad{matrix(f)} returns the matrix of the ALS of f.
appendSupport! : (%, List(M1)) -> %
++ \spad{appendSupport! (f, lst)} appends variables not in the support.
-- FIXME: For testing and debugging only (should return a copy).
pencil : (%) -> LMMP
++ \spad{pencil(f)} returns a pointer to the underlying pencil.
swapRowsColumns! : (%, NNI, NNI) -> %
++ \spad{swapRowsColumns!(f, i, j)} exchanges rows i and j and
++ columns j and i in the ALS of f.
swapRows! : (%, NNI, NNI) -> %
++ \spad{swapRows!(f, i, j)} exchanges rows i and j in the ALS of f.
qswapRows! : (%, NNI, NNI) -> %
++ \spad{swapRows!(f, i, j)} exchanges rows i and j in the ALS of f.
addRowsColumns! : (%, NNI, NNI, F) -> %
++ \spad{addRowsColumns!(f, i, j, alpha)} adds alpha*row(i) to
++ row(j) and subtracts alpha*column(j) from column(i) in the ALS of f.
addColumnsRows! : (%, NNI, NNI, F) -> %
++ \spad{addColumnsRows!(f, i, j, alpha)} adds alpha*column(i) to
++ column(j) and subtracts alpha*row(j) from row(i) in the ALS of f.
addRows! : (%, NNI, NNI, F) -> %
++ \spad{addRows!(f, i, j, alpha)} adds alpha*row(i) to row(j) in
++ the ALS of f.
qaddRows! : (%, NNI, NNI, F) -> %
++ \spad{addRows!(f, i, j, alpha)} adds alpha*row(i) to row(j) in
++ the ALS of f.
multiplyRow! : (%, NNI, F) -> %
++ \spad{multiplyRow!(f, i, alpha)} multiplies row(i) by alpha
++ in the ALS of f.
multiplyColumn! : (%, NNI, F) -> %
++ \spad{multiplyColumn!(f, i, alpha)} multiplies column(i) by alpha
++ in the ALS of f.
qswapColumns! : (%, NNI, NNI) -> %
++ \spad{swapColumns!(f, i, j)} exchanges columns i and j in
++ the ALS of f.
swapColumns! : (%, NNI, NNI) -> %
++ \spad{swapColumns!(f, i, j)} exchanges columns i and j in
++ the ALS of f.
qaddColumns! : (%, NNI, NNI, F) -> %
++ \spad{addColumns!(f, i, j, alpha)} adds alpha*column(i) to
++ column(j) in A and subtracts row(j) from row(i) in s (in the
++ ALS of f), i.e. (A*U)(U^-1*s) = v.
addColumns! : (%, NNI, NNI, F) -> %
++ \spad{addColumns!(f, i, j, alpha)} adds alpha*column(i) to
++ column(j) in A and subtracts row(j) from row(i) in s (in the
++ ALS of f), i.e. (A*U)(U^-1*s) = v.
removeRowsColumns : (%, List(NNI), List(NNI)) -> %
++ \spad{removeRowsColumns(f, lst_row, lst_col)} returns
++ a new system with the specified rows and columns removed.
++ The number of rows and columns have to be the same!
insertRowsColumns : (%, List(NNI), List(NNI)) -> %
++ \spad{insertRowsColumns(f, lst_row, lst_col)} returns
++ a new system with rows and columns inserted. An index
++ k means a new row/column between k and k+1. The number
++ of rows and columns have to be the same!
qzero? : (%, NNI, NNI, NNI, NNI) -> Boolean
++ \spad{qzero?(f, i_min, i_max, j_min, j_max)} is the
++ spezified block zero (in the system matrix)?
qzero? : (%, NNI, NNI, NNI, NNI, NNI) -> Boolean
++ \spad{qzero?(f, i_min, i_max, j_min, j_max, l)} is the
++ spezified block zero in matrix l?
qzero? : (%, NNI, NNI, NNI, NNI, M1) -> Boolean
++ \spad{qzero?(f, i_min, i_max, j_min, j_max, m)} is the
++ spezified block zero in the (system) matrix corresponding
++ to the monomial m?
blockStructure : (%) -> Matrix(NNI)
++ \spad{blockStructure(f)} analyzes the structure of the ALS
++ of f and detects blocks with respect to an upper triangular
++ structure. Entry (i,1) contains the first row, (i,2) the
++ last row, (i,3) the size and (i,4) if block i is refined.
refined? : (%) -> Boolean
++ \spad{refined?(f)} is f represented by a refined ALS?
blockElimination : (%, List(NNI), List(NNI), Boolean, _
List(NNI), List(NNI), Boolean) -> List(Matrix(F))
++ \spad{blockElimination(f, rsrc, rdst, flg_u, csrc, cdst, flg_v)}
++ returns transformation matrices if it is possible to eliminate
++ all entries in rdst x cdst (including columns in u if flg_u = true,
++ including rows in v if flg_v = true) by using rows in rsrc and
++ columns in csrc. Otherwise an empty list.
blockElimination : (%, List(NNI), List(NNI), List(NNI), List(NNI)) -> List(Matrix(F))
++ \spad{blockElimination(f, rsrc, rdst, csrc, cdst)}
++ flg_u = true, flg_v = true
display : (%, OutputForm) -> OutputForm
++ \spad{display(f,sol)} prints the element f as A*sol = v.
display : (%, List(Symbol)) -> OutputForm
++ \spad{display(f,[s])} prints the element f as A*(s_1,s_2,...,s_n)' = v.
admissibleLinearSystem : (%) -> OutputForm
++ \spad{admissibleLinearSystem(f)} output as ALS.
linearization : (%) -> Matrix(XDP)
++ \spad{linearization(f)} returns the element f as linearization.
linearization : (%) -> Matrix(%)
++ \spad{linearization(f)} returns the element f as linearization
++ with entries represented by admissible linear systems in minimal
++ refined form.
representation : (%) -> List(Matrix(XDP))
++ \spad{representation(f)} returns the element f as linear
++ representation (u,A,v).
_* : (f:%, U:Matrix(F)) -> %
++ \spad{f * U} column transformation
_* : (T:Matrix(F), f:%) -> %
++ \spad{T * f} row transformation
transformationMatrix : (%) -> Matrix(F)
++ \spad{transformationMatrix(f)} returns the identity matrix
++ to be modified and used within transformRows! or transformColumns!
transformRows! : (%, Matrix(F)) -> %
++ \spad{transformRows!(f, T)} transforms the ALS of f from the left.
transformColumns! : (%, Matrix(F)) -> %
++ \spad{transformColumns!(f, U)} transforms the ALS of f from the right.
-- Declaration (calculation)
-- Changed: Son 2018-08-12 11:09
-- Changed: Sam 2018-09-01 23:31
normalizeRHS! : (%) -> %
++ \spad{normalizeRHS!(f)} eliminates non-zero entries in the
++ right hand side of ALS with respect of the non-zero entry
++ with the highest index.
normalizePLS! : (%) -> %
++ \spad{normalizePLS!(f)} scales and rearranges rows and
++ columns of the system matrix such that the constant part
++ of the system matrix is the identity matrix (possibly of
++ smaller size).
normalizeDIAG! : (%) -> %
++ \spad{normalizeDIAG!(f)} rescales the rows such that the
++ first nonzero entry of the coefficient matrix in the diagonal
++ is one.
normalize! : (%) -> %
++ \spad{normalize!(f)} rescales the rows such that the first
++ nonzero entry of the coefficient matrix in the diagonal is
++ one. The right hand side is normalized by normalizeRHS!
++ and the non-zero entry is in the last row of the corresponding
++ block.
polynomial : (%) -> XDP
++ \spad{polynomial(f)} returns f as XDPOLY (if possible)
solutionVector : (%) -> Matrix(XDP)
++ \spad{solutionVector(f)} computes the solution vector s
++ of As=v if f is polynomial.
solutionVector : (%, NNI) -> Matrix(XDP)
++ \spad{solutionVector(f, k)} computes the approximated
++ solution vector up to powers M^k v' where PAs=Pv=v' with
++ PA = I-M.
columnSpan : (%) -> Stream(Matrix(XDP))
++ \spad{columnSpan(f)} computes the column span for a regular
++ element, that is (v', Mv', M^2v', ...) where PAs=Pv=v' with
++ PA = I-M.
rowSpan : (%) -> Stream(Matrix(XDP))
++ \spad{rowSpan(f)} computes the row span for a regular element,
++ that is (u; uM; uM^2; ...) where PAs=Pv with PA = I-M.
scaleALS : (%, F) -> %
++ \spad{scaleALS(f, alpha)} computes alpha*f by scaling
++ the right hand side of the ALS for f.
addALS : (%, %) -> %
++ \spad{addALS(f,g)} computes f+g in terms of the admissible
++ linear systems for f and g (without minimization).
multiplyALS : (%, %) -> %
++ \spad{multiplyALS(f,g)} computes f*g in terms of the admissible
++ linear systems for f and g (without minimization).
invertALS : (%) -> %
++ \spad{invertALS(f)} computes f^-1 in terms of the ALS for f.
++ There is no check if f is invertible!
invertSTD : (%) -> %
++ \spad{invertSTD(f)} computes the standard inverse of f in
++ terems of the admissible linear system There is no check if
++ f is invertible!
-- Declaration (factorization)
-- Changed: Sam 2018-09-01 23:45
factors : (%) -> List(%)
++ \spad{factors(f)} analysis the block structure of the
++ system matrix of the ALS of f to split f into factors.
summands : (%) -> List(%)
++ \spad{summands(f)} analysis the block structure of the
++ system matrix of the ALS of f to split f into summands.
leftFamily : (%) -> List(OutputForm)
++ \spad{leftFamily(f)} prints the left family s=A^-1*v.
rightFamily : (%) -> List(OutputForm)
++ \spad{rightFamily(f)} prints the right family t=u*A^-1.
ratexprInverse : (%, Boolean) -> OutputForm
++ \spad{ratexprInverse(f, flg)} returns f in output form if
++ it is a polynomial, (f)^-1 if f^-1 is a polynomial, "r<rank>"
++ if the system is minimal and "d<dim>" in general.
ratexpr : (%) -> OutputForm
++ \spad{ratexpr(f)} analysis the block structure of the
++ admissible linear system to write f as rational expression.
coerce : (%) -> OutputForm
++ \spad{coerce(f)} prints the ALS of f if the debug flag is
++ set and a rational expression if the alternative output
++ flag is set.
leftFactor : (%, NNI) -> %
++ \spad{leftFactor(f,k)} returns the left factor of rank k
++ of a polynomial f or 1 if it's not possible by linear
++ techniques.
rightFactor : (%, NNI) -> %
++ \spad{rightFactor(f,k)} returns the right factor of rank k
++ of a polynomial f or 1 if it's not possible by linear
++ techniques.
factorize : (%, NNI) -> List(%)
++ \spad{factorize(f,k)} factorizes f in f=g*h with rank(g)=k
++ if possible (if necessary by using non-linear techniques).
factor : (%) -> List(%)
++ \spad{factor(f)} factorizes f in f=f_1*f_2*...*f_k with
++ atoms (irreducible elements) f_i. Notice that this factorization
++ is unique only with respect to similiarity.
factorizationTransformations : (%, NNI, NNI, List(EQG)) -> List(Matrix(F))
++ \spad{factorizationTransformations(f,k_rows,k_cols,sol)}
++ for debugging purposes (interface LINPEN)
factorizationEquations : (%, NNI, NNI) -> List(G)
++ \spad{factorizationEquations(f,k_rows,k_cols)}
++ for debugging purposes (interface LINPEN)
factorizationGroebner : (%, NNI, NNI) -> List(G)
++ \spad{factorizationGroebner(f,k_rows,k_cols)}
++ for debugging purposes (interface LINPEN)
factorizationSolve : (%, NNI, NNI) -> List(List(EQG))
++ \spad{factorizationSolve(f,k_rows,k_cols)} returns a
++ (possible empty) list of solutions for an admissible
++ transformation to create an upper right block of zeros
++ of size k_rows times k_cols.
refineUR! : (%, NNI) -> %
++ \spad{refineUR!(f,k)} uses linear techniques to create an
++ upper right block of zeros with k rows (if possible).
refineUR! : (%) -> %
++ \spad{refineUR!(f)} uses linear techniques to create upper
++ right blocks of zeros in staircase form (as far as possible).
-- Declaration (minimization)
-- Changed: Fre 2018-09-07 15:55
extendedALS : (%) -> %
++ \spad{extendedALS(f)} returns an extended ALS for f, that is,
++ 1*f (with a scalar first row).
normalALS : (%) -> %
++ \spad{normalALS(f)} removes a scalar first row of an (extended) ALS.
leftMinimization : (%, NNI, NNI) -> %
++ \spad{leftMinimization(f, i_min, i_max)} tries to apply a
++ left minimization step with respect to the pivot block with
++ the rows/columns (i_min, ..., i_max).
rightMinimization : (%, NNI, NNI) -> %
++ \spad{rightMinimization(f, i_min, i_max)} tries to apply a
++ right minimization step with respect to the pivot block with
++ the rows/columns (i_min, ..., i_max).
minimize : (%) -> %
++ \spad{minimize(f)} minimizes the unterlying ALS by applying
++ left and right block minimization steps. Minimality is only
++ guaranteed if the remaining blocks are refined.
addMIN : (%, %) -> %
++ \spad{addMIN(f,g)} uses addALS(f,g) with minimization.
multiplyMIN : (%, %) -> %
++ \spad{multiplyMIN(f,g)} uses multiplyALS(f,g) with minimization.
invertMIN : (%) -> %
++ \spad{invertMIN(f)} uses invertSTD(f) and minimization to
++ construct a minimal system for f^-1. Linear techniques are
++ used to get a fine pivot block structure.
inverse : (%) -> %
++ \spad{inverse(f)} f^-1 using invertMIN.
_+ : (%, F) -> %
++ \spad{f + alpha} adds the scalar alpha to f.
_- : (%, F) -> %
++ \spad{f - alpha} subtracts the scalar alpha from f.
_+ : (F, %) -> %
++ \spad{alpha + f} adds the scalar alpha to f.
_- : (F, %) -> %
++ \spad{alpha - f} adds the scalar alpha to -f.
_/ : (%, F) -> %
++ \spad{f / alpha} computes f / alpha for nonzero alpha.
_/ : (F, %) -> %
++ \spad{alpha / f} computes alpha / f for nonzero f.
_/ : (%, %) -> %
++ \spad{f / g} computes f * g^-1 for nonzero element g.
_^ : (%, PositiveInteger) -> %
++ \spad{f^n} returns f^n.
_^ : (%, Integer) -> %
++ \spad{f^n} returns f^n.
setRefined! : (%, NNI) -> %
++ \spad{setRefined!(f,max_sze)} sets the internal flag if the
++ system is refined (over the ground field) up to the specified
++ block size.
refine! : (%, Boolean) -> %
++ \spad{refine!(f, flg)} refines the underlying admissible
++ admissible linear system using simple and linear techniques
++ and if flg=true also non-linear techniques (Gröbner basis).
refine! : (%) -> %
++ \spad{refine!(f)} refines f using non-linear techniques.
refinementTransformations : (%, NNI, NNI, List(EQG)) -> List(Matrix(F))
++ \spad{refinementTransformations(f,i_min,i_max,sol)}
++ for debugging purposes (interface LINPEN)
refinementEquations : (%, NNI, NNI, NNI, Boolean, Boolean) -> List(G)
++ \spad{refinementEquations(f,i_min,i_max,k_rows,flg_u,flg_r)}
++ for debugging purposes (interface LINPEN)
refinementGroebner : (%, NNI, NNI, NNI, Boolean, Boolean) -> List(G)
++ \spad{refinementGroebner(f,i_min,i_max,k_rows,flg_u,flg_r)}
++ computes a Groebner basis for the ideal generated by the
++ equations for creating a zero block with k rows within the
++ pivot block i_min..i_max and conditions to guarantee invertible
++ transformations.
refinementSolve : (%, NNI, NNI, NNI, Boolean, Boolean) -> List(List(EQG))
++ \spad{refinementSolve(f,i_min,i_max,k_rows,flg_u,flg_r)}
++ Computes a list of solutions (for the entries in transformation
++ matrices) to create a lower left block of zeros with k rows in
++ the pivot block i_min..i_max.
rank : (%) -> NNI
++ \spad{rank(f)} returns the rank of the element f, that is,
++ the dimension of a minimal admissible linear system (for f).
coerce : (%) -> XDP
++ \spad{coerce(f)} converts the element to XDPOLY (if possible).
coerce : (XDP) -> %
++ \spad{coerce(p)} converts the polynomial p to an element in the
++ free field represented by an minimal admissible linear system.
--<-<SPAD:fdalg dcl05>>
Implementation == add
-- f = u * A^-1 * v, A full, u = [1,0,...,0]
Rep := Record(size:NNI, _
supp:List(M1), _
lmmp:LMMP, _
flg_minimal:Boolean, _
flg_refined:Boolean, _
flg_mutable:Boolean, _
flg_debug:Boolean, _
flg_output:Boolean)
-- Implementation (internal)
-- Changed: Fre 2018-09-07 14:28
-- The admissible linear system \pi = (u,A,v) of dimension n
-- for an element f=u*A^-1*v in the free field is represented
-- by a matrix pencil of size n+1: [0, u; v, A]. To simplify
-- the access to the system matrix A and the (scalar) vectors
-- u and v we use the following functions ...
POS_1 ==> 1$NNI -- The position of the coefficient matrix w.r.t. the empty word
NUM_R ==> 1$NNI -- Number of rows of the matrix u in u*A^-1*v
NUM_C ==> 1$NNI -- Number of columns of the matrix v in u*A^-1*v
-- Warning: Notice that NUM_R = NUM_C > 1 is a matrix algebra
-- (with zero devisors) over the free field and NOT a field
-- anymore. Everything except NUM_R = NUM_C = 1 has not been
-- tested. The notion of minimality is not clear for NUM_R > 1
-- or NUM_C > 1.
qeltA (p:LMMP, i:NNI, j:NNI, l:NNI) : F ==
qelt(p, NUM_R+i, NUM_C+j, l)
qeltv (p:LMMP, i:NNI, l:NNI) : F ==
qelt(p, NUM_R+i, 1, l)
qeltu (p:LMMP, j:NNI, l:NNI) : F ==
qelt(p, 1, NUM_C+j, l)
qlstA (p:LMMP, i:NNI, j:NNI) : List(F) ==
qelt(p, NUM_R+i, NUM_C+j)
qsetu! (p:LMMP, i:NNI, l:NNI, alpha:F) : F ==
qsetelt!(p, 1, NUM_C+i, l, alpha)
qsetA! (p:LMMP, i:NNI, j:NNI, l:NNI, alpha:F) : F ==
qsetelt!(p, NUM_R+i, NUM_C+j, l, alpha)
qsetv! (p:LMMP, i:NNI, l:NNI, alpha:F) : F ==
qsetelt!(p, NUM_R+i, 1, l, alpha)
qmtxu (p:LMMP, j1:NNI, j2:NNI, l:NNI) : Matrix(F) ==
subMatrix(p, 1, NUM_R, NUM_C+j1, NUM_C+j2, l)
qmtxA (p:LMMP, i1:NNI, i2:NNI, j1:NNI, j2:NNI, l:NNI) : Matrix(F) ==
subMatrix(p, NUM_R+i1, NUM_R+i2, NUM_C+j1, NUM_C+j2, l)
qmtxv (p:LMMP, i1:NNI, i2:NNI, l:NNI) : Matrix(F) ==
subMatrix(p, NUM_R+i1, NUM_R+i2, 1, NUM_C, l)
qscalev!(p:LMMP, i1:NNI, i2:NNI, l:NNI, alpha:F) : LMMP ==
qscaleBlock!(p, NUM_R+i1, NUM_R+i2, 1, NUM_C, l, alpha)
qscale!(f:%, alpha:F) : % ==
qscaleBlock!(f.lmmp, NUM_R+1, NUM_R+f.size, 1, NUM_C, POS_1, alpha)
f
qsetmtxu! (p:LMMP, j:NNI, l:NNI, a:Matrix(F)) : Matrix(F) ==
setsubMatrix!(p, 1, NUM_C+j, l, a)
qsetmtxA! (p:LMMP, i:NNI, j:NNI, l:NNI, a:Matrix(F)) : Matrix(F) ==
setsubMatrix!(p, NUM_R+i, NUM_C+j, l, a)
qsetmtxv! (p:LMMP, i:NNI, l:NNI, a:Matrix(F)) : Matrix(F) ==
setsubMatrix!(p, NUM_R+i, 1, l, a)
qzeroA? (p:LMMP, i:NNI, j:NNI) : Boolean ==
qzero?(p, NUM_R+i, NUM_C+j)
qzeromtxA? (p:LMMP, i1:NNI, i2:NNI, j1:NNI, j2:NNI) : Boolean ==
qzero?(p, NUM_R+i1, NUM_R+i2, NUM_C+j1, NUM_C+j2)
qsemizeroA? (p:LMMP, i1:NNI, i2:NNI, j1:NNI, j2:NNI, l:NNI) : Boolean ==
qsemizero?(p, NUM_R+i1, NUM_R+i2, NUM_C+j1, NUM_C+j2, l)
qzerov? (p:LMMP, i1:NNI, i2:NNI) : Boolean ==
qzero?(p, NUM_R+i1, NUM_R+i2, 1, NUM_C)
interval (i_min:NNI, i_max:NNI) : List(NNI) ==
lst_wrk : List(NNI) := []
for k in i_max .. i_min by -1 repeat
lst_wrk := cons(k, lst_wrk)
lst_wrk
-- Implementation (basics)
-- Changed: Mit 2018-08-22 08:52
-- Changed: Sam 2018-09-01 23:27
qnew (n:NNI) : % ==
lst_new := [1$M1]$List(M1)
lp := qnew(n+1, n+1, #lst_new)$LMMP
qsetelt!(lp, 1, 2, POS_1, 1$F)
flg_min := false
flg_ref := false
[n, lst_new, lp, flg_min, flg_ref, true, FLGDBG, ALTOUT]
qnew (n:NNI, lst:List(M1)) : % ==
lst_new := cons(1$M1, remove(1$M1, lst))
lp := qnew(n+1, n+1, #lst_new)$LMMP
qsetelt!(lp, 1, 2, POS_1, 1$F)
flg_min := false
flg_ref := false
[n, lst_new, lp, flg_min, flg_ref, true, FLGDBG, ALTOUT]
-- FIXME: Check entries in pencil (fullness of system matrix, etc.)
new (lp:LMMP, lst:List(M1)) : % ==
for mon in lst repeat
length(mon) > 1 =>
error "FDALG: new(lp, lst) - monomials not linear."
nrows(lp) ~= ncols(lp) =>
error "FDALG: new(lp,lst) - Linear Pencil is not square."
#lst ~= nelem(lp) =>
error "FDALG: new(lp,lst) - lengths do not agree."
n := (nrows(lp) - 1)::NNI
flg_min := false
flg_ref := false
[n, lst, lp, flg_min, flg_ref, true, FLGDBG, ALTOUT]
getSupport (var:List(VAR)) : List(M1) ==
lst_mon := new(1+#var, 1$M1)$List(M1)
for k in 1 .. #var repeat
lst_mon(k+1) := var(k)::M1
lst_mon
new (c:F) : % ==
if zero?(c) then
return(copy(0))
als := qnew(1)
qsetA!(als.lmmp, 1, 1, POS_1, 1$F)
qsetv!(als.lmmp, 1, POS_1, c)
als.flg_minimal := true
als.flg_refined := true
als
new (m:M1, c:F) : % ==
if zero? c then
als := qnew(1)
qsetA!(als.lmmp, 1, 1, POS_1, 1$F)
else
n := length(m) + 1
als := qnew(n, getSupport(varList(m)))
l := 0$NNI
-- e.g. for m = xyyx
-- factors(m) = [[gen=x,exp=1], [gen=y,exp=2], [gen=x,exp=1]]
for fct in factors(m) repeat
pos := position((fct.gen)::M1, als.supp)::NNI
for i in 1 .. fct.exp repeat
qsetA!(als.lmmp, 1+l, 1+l+1, pos, -1$F)
l := l + 1
for k in 1 .. n repeat
qsetA!(als.lmmp, k, k, POS_1, 1$F)
qsetv!(als.lmmp, n, POS_1, c)
als.flg_minimal := true
als.flg_refined := true
als
-- Info: Matrix size 0 causes problems, therefore a matrix of dimension 1 is used.
0 : % ==
als := qnew(1)
qsetA!(als.lmmp, 1, 1, POS_1, 1$F)
als.flg_minimal := true
als.flg_refined := true
als.flg_mutable := false
als.flg_debug := false
als.flg_output := false
als
1 : % ==
als := qnew(1)
qsetA!(als.lmmp, 1, 1, POS_1, 1$F)
qsetv!(als.lmmp, 1, POS_1, 1$F)
als.flg_minimal := true
als.flg_refined := true
als.flg_mutable := false
als.flg_debug := false
als.flg_output := false
als
copy (f:%) : % ==
lmmp_new := copy(f.lmmp)
supp_new := copy(f.supp)
[f.size, supp_new, lmmp_new, f.flg_minimal, f.flg_refined, _
true, f.flg_debug, f.flg_output]
copy (f:%, alpha:F) : % ==
if zero?(alpha) then
return(copy(0))
lmmp_new := copy(f.lmmp)
supp_new := copy(f.supp)
qscalev!(lmmp_new, 1, f.size, POS_1, alpha)
[f.size, supp_new, lmmp_new, f.flg_minimal, f.flg_refined, _
true, f.flg_debug, f.flg_output]
coerce (m:M1) : % ==
new(m, 1$F)
coerce (c:F) : % ==
copy(1, c)
enableDebugOutput (f:%) : % ==
f.flg_debug := true
f
disableDebugOutput (f:%) : % ==
f.flg_debug := false
f
toggleDebugOutput (f:%) : % ==
f.flg_debug := not(f.flg_debug)
f
enableAlternativeOutput (f:%) : % ==
f.flg_output := true
f
disableAlternativeOutput (f:%) : % ==
f.flg_output := false
f
toggleAlternativeOutput (f:%) : % ==
f.flg_output := not(f.flg_output)
f
minimal? (f:%) : Boolean ==
f.flg_minimal
mutable? (f:%) : Boolean ==
f.flg_mutable
qregular? (f:%, i_min:NNI, i_max:NNI) : Boolean ==
if not(qdiagonal?(f.lmmp, NUM_R+i_min, NUM_R+i_max, POS_1)) then
return(false)
lst_ele := qdiagonal(f.lmmp, NUM_R+i_min, NUM_R+i_max, POS_1)
for i in 1 .. #lst_ele repeat
if not(lst_ele(i) = 1$F) then
return(false)
true
-- FIXME: Index check?
scalar? (f:%, i:NNI, j:NNI) : Boolean ==
a_lst := qlstA(f.lmmp, i, j)
flg_wrk := true
for k in 2 .. #(f.supp) repeat
if not(zero?(a_lst(k))) then
flg_wrk := false
break
flg_wrk
zero? (f:%, i:NNI, j:NNI) : Boolean ==
flg_wrk := scalar?(f, i, j) and zero?(qeltA(f.lmmp, i, j, POS_1))
flg_wrk
scalar? (f:%) : Boolean ==
if f.size > 1 then
return(false)
if not(qregular?(f, 1, f.size)) then
return(false)
for k in 2 .. #(f.supp) repeat
if not(qnilpotent?(f.lmmp, NUM_R+1, NUM_R+f.size, k)) then
return(false)
true
regular? (f:%) : Boolean ==
n := f.size
flg_wrk := false
if rank(qmtxA(f.lmmp, 1, n, 1, n, POS_1)) = n then
flg_wrk := true
flg_wrk
polynomialForm? (f:%) : Boolean ==
if not(quppertriangular?(f.lmmp, NUM_R+1, NUM_R+f.size, POS_1)) then
return(false)
for k in 2 .. #(f.supp) repeat
if not(qnilpotent?(f.lmmp, NUM_R+1, NUM_R+f.size, k)) then
return(false)
lst_ele := qdiagonal(f.lmmp, NUM_R+1, NUM_R+f.size, POS_1)
for i in 1 .. #lst_ele repeat
if not(lst_ele(i) = 1$F) then
return(false)
true
polynomial? (f:%) : Boolean ==
polynomialForm?(f)
dimension (f:%) : NNI ==
f.size
variables (f:%) : List(M1) ==
copy(f.supp)
elt (f:%, i:NNI) : F ==
(i < 1) or (i > f.size) =>
error "FDALG: elt(%,i) - index out of range."
qeltv(f.lmmp, i, POS_1)
qelt (f:%, i:NNI, j:NNI) : XDP ==
a_tmp := 0$XDP
for k in 1 .. #(f.supp) repeat
a_tmp := a_tmp + qeltA(f.lmmp, i, j, k)*elt(f.supp, k)::XDP
a_tmp
elt (f:%, i:NNI, j:NNI) : XDP ==
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: elt(%,i,j) - index out of range."
qelt(f, i, j)
setelt! (f:%, i:NNI, alpha:F) : F ==
not(f.flg_mutable) =>
error "FDALG: setelt!(%,i,alpha) - element is not mutable."
(i < 1) or (i > f.size) =>
error "FDALG: setelt!(%,i,alpha) - index out of range."
v_old := qeltv(f.lmmp, i, POS_1)
if not(v_old = alpha) then
qsetv!(f.lmmp, i, POS_1, alpha)
f.flg_minimal := false
f.flg_refined := false
alpha
setelt! (f:%, i:NNI, j:NNI, p:XDP) : XDP ==
not(f.flg_mutable) =>
error "FDALG: setelt!(%,i,j,p) - element is not mutable."
not(polynomialForm?(f)) =>
error "FDALG: setelt!(%,i,j,p) - system not in polynomial form."
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: setelt!(%,i,j,p) - index out of range."
i > j =>
error "FDALG: setelt!(%,i,j,p) - entry not above diagonal."
if not(zero?(p)) then
degree(p) > 1 =>
error "FDALG: setelt!(%,i,j,p) - degree higher than one."
p_old := qlstA(f.lmmp, i, j)
for k in 1 .. #(f.supp) repeat
qsetA!(f.lmmp, i, j, k, 0$F)
for mon in getSupport(varList(p)) repeat
pos := position(mon, f.supp)::NNI
pos = 0 =>
error "FDALG: setelt!(%,i,j,p) - monomial not available."
qsetA!(f.lmmp, i, j, pos, coefficient(p, mon))
p_new := qlstA(f.lmmp, i, j)
if not(p_old = p_new) then
f.flg_minimal := false
p
vector (f:%) : Matrix(F) ==
qmtxv(f.lmmp, 1, f.size, POS_1)
vector (f:%) : Matrix(XDP) ==
v_tmp := qmtxv(f.lmmp, 1, f.size, POS_1)
v_wrk := new(nrows(v_tmp), 1, 0$XDP)$Matrix(XDP)
for i in 1 .. nrows(v_tmp) repeat
qsetelt!(v_wrk, i, 1, qelt(v_tmp, i, 1)::XDP)
v_wrk
matrix (f:%, m:M1) : Matrix(F) ==
pos := position(m, f.supp)::NNI
pos = 0 =>
error "FDALG: matrix(%,m) - monoid not available."
qmtxA(f.lmmp, 1, f.size, 1, f.size, pos)
matrix (f:%) : Matrix(XDP) ==
n := f.size
A_wrk := new(n,n,0$XDP)$Matrix(XDP)
for k in 1 .. #(f.supp) repeat
A_tmp := qmtxA(f.lmmp, 1, f.size, 1, f.size, k)
for i in 1 .. n repeat
for j in 1 .. n repeat
qsetelt!(A_wrk, i, j, qelt(A_wrk, i, j) _
+ qelt(A_tmp, i, j)*elt(f.supp, k)::XDP)
A_wrk
appendSupport! (f:%, lst:List(M1)) : % ==
lst_new : List(M1) := []
for mon in lst repeat
pos := position(mon, f.supp)::NNI
if zero?(pos) then
lst_new := cons(mon, lst_new)
if #lst_new > 0 then
append!(f.lmmp, #lst_new)
f.supp := append(f.supp, lst_new)
f
pencil (f:%) : LMMP ==
f.lmmp
qswapRows! (f:%, i:NNI, j:NNI) : % ==
if not(i = j) then
qswapRows!(f.lmmp, NUM_R+i, NUM_R+j)
f
-- FIXME: Swapping rows within a block should not change refinement flag.
swapRows! (f:%, i:NNI, j:NNI) : % ==
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: swapRows!(%,i,j) - index/indices out of range."
if not(i = j) then
qswapRows!(f.lmmp, NUM_R+i, NUM_R+j)
f.flg_refined := false
f
qaddRows! (f:%, i:NNI, j:NNI, alpha:F) : % ==
if not(i=j) then
qaddRows!(f.lmmp, NUM_R+i, NUM_R+j, alpha)
f
addRowsColumns! (f:%, i:NNI, j:NNI, alpha:F) : % ==
i = j =>
error "FDALG: addRowsColumns!(%,i,j,alpha) - indices must be different."
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: addRowsColumns!(%,i,j,alpha) - index/indices out of range."
j = 1 =>
error "FDALG: addRowsColumns!(%,i,j,alpha) - first column must not be used."
qaddRows!(f.lmmp, NUM_R+i, NUM_R+j, alpha)
qaddColumns!(f.lmmp, NUM_C+j, NUM_C+i, -alpha)
if i < j then
f.flg_refined := false
f
addColumnsRows! (f:%, i:NNI, j:NNI, alpha:F) : % ==
i = j =>
error "FDALG: addColumnsRows!(%,i,j,alpha) - indices must be different."
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: addColumnsRows!(%,i,j,alpha) - index/indices out of range."
i = 1 =>
error "FDALG: addColumnsRows!(%,i,j,alpha) - first column must not be used."
qaddColumns!(f.lmmp, NUM_C+i, NUM_C+j, alpha)
qaddRows!(f.lmmp, NUM_R+j, NUM_R+i, -alpha)
f
addRows! (f:%, i:NNI, j:NNI, alpha:F) : % ==
i = j =>
error "FDALG: addRows!(%,i,j,alpha) - indices must be different."
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: addRows!(%,i,j,alpha) - index/indices out of range."
addRows!(f.lmmp, NUM_R+i, NUM_R+j, alpha)
if i < j then
f.flg_refined := false
f
qmultiplyRow! (f:%, i:NNI, alpha:F) : % ==
qmultiplyRow!(f.lmmp, NUM_R+i, alpha)
f
multiplyRow! (f:%, i:NNI, alpha:F) : % ==
if alpha = 1$F then
return(f)
(i < 1) or (i > f.size) =>
error "FDALG: multiplyRow!(%,i,alpha) - index out of range."
zero?(alpha) =>
error "FDALG: multiplyRow!(%,i,alpha) - zero factor."
qmultiplyRow!(f.lmmp, NUM_R+i, alpha)
f
qmultiplyColumn! (f:%, i:NNI, alpha:F) : % ==
qmultiplyColumn!(f.lmmp, NUM_C+i, alpha)
f
multiplyColumn! (f:%, i:NNI, alpha:F) : % ==
if alpha = 1$F then
return(f)
(i < 1) or (i > f.size) =>
error "FDALG: multiplyColumn!(%,i,alpha) - index out of range."
zero?(alpha) =>
error "FDALG: multiplyColumn!(%,i,alpha) - zero factor."
qmultiplyColumn!(f.lmmp, NUM_C+i, alpha)
f
qswapColumns! (f:%, i:NNI, j:NNI) : % ==
if not(i = j) then
qswapColumns!(f.lmmp, NUM_C+i, NUM_C+j)
f
-- FIXME: Swapping columns within a block should not change refinement flag.
swapColumns! (f:%, i:NNI, j:NNI) : % ==
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: swapColumns!(%,i,j) - index/indices out of range."
i = 1 or j = 1 =>
error "FDALG: swapColumns!(%,i,j) - first column must not be changed."
if not(i = j) then
qswapColumns!(f.lmmp, NUM_C+i, NUM_C+j)
f.flg_refined := false
f
swapRowsColumns! (f:%, i:NNI, j:NNI) : % ==
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: swapRowsColumns!(%,i,j) - index/indices out of range."
i = 1 or j = 1 =>
error "FDALG: swapRowsColumns!(%,i,j) - first column must not be changed."
if not(i = j) then
qswapRows!(f.lmmp, NUM_R+i, NUM_R+j)
qswapColumns!(f.lmmp, NUM_C+i, NUM_C+j)
f.flg_refined := false
f
addColumns! (f:%, i:NNI, j:NNI, alpha:F) : % ==
i = j =>
error "FDALG: addColumns!(%,i,j,alpha) - indices must be different."
(i < 1) or (i > f.size) or (j < 1) or (j > f.size) =>
error "FDALG: addColumns!(%,i,j,alpha) - index/indices out of range."
i = 1 =>
error "FDALG: addColumns!(%,i,j,alpha) - first column must not be used."
addColumns!(f.lmmp, NUM_C+i, NUM_C+j, alpha)
if i > j then
f.flg_refined := false
f
qaddColumns! (f:%, i:NNI, j:NNI, alpha:F) : % ==
if not(i=j) then
addColumns!(f.lmmp, NUM_C+i, NUM_C+j, alpha)
f
-- FIXME: Check row and column indices?
removeRowsColumns (f:%, lst_row:List(NNI), lst_col:List(NNI)) : % ==
lst_r := map(a +-> a+1, removeDuplicates(lst_row))$List(NNI)
lst_c := map(a +-> a+1, removeDuplicates(lst_col))$List(NNI)
#lst_r ~= #lst_c =>
error "FDALG: removeRowsColumns(%,rows,cols) - number of rows and columns differ."
f_new := new(removeRowsColumns(f.lmmp, lst_r, lst_c), f.supp)
f_new
insertRowsColumns (f:%, lst_row:List(NNI), lst_col:List(NNI)) : % ==
lst_r := map(a +-> a+1, lst_row)$List(NNI)
lst_c := map(a +-> a+1, lst_col)$List(NNI)
#lst_r ~= #lst_c =>
error "FDALG: insertRowsColumns(%,rows,cols) - number of rows and columns differ."
f_new := new(insertRowsColumns(f.lmmp, lst_r, lst_c), f.supp)
for k in 1 .. #lst_r repeat
qsetA!(f_new.lmmp, k+lst_row(k), k+lst_col(k), POS_1, 1$F)
f_new
qzero? (f:%, i_min:NNI, i_max:NNI, j_min:NNI, j_max:NNI) : Boolean ==
qzero?(f.lmmp, NUM_R+i_min, NUM_R+i_max, NUM_C+j_min, NUM_C+j_max)