Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/GAP/pkg/majoranaalgebras/tst/   (GAP Algebra Version 4.15.1©)  Datei vom 7.6.2024 mit Größe 3 kB image not shown  

Quelle  LinAlg.tst   Sprache: unbekannt

 
Spracherkennung für: .tst vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]


##
## Test solve system
##
gap> system := rec();;
gap> system.mat := SparseMatrix( 56, [ [ 12 ], [ 3456 ], [ 3456 ], [ 56 ], [ 34 ] ], [ [ -11 ], 1111 ], [ -1,-111 ], [ -11 ], [ -11 ] ], Rationals );;
gap> system.vec := SparseMatrix( 513, [ [ 1213 ], [ 5 ], [ 10111213 ], [ 1213 ], [ 1011 ] ], [ [ -1/321/32 ], [ 4/9 ], [ -1/4, -1/41/41/4 ], [ -1/321/32 ], [ -1/321/32 ] ], Rationals );;
gap> system.unknowns := [ [ 112 ], [ 113 ], [ 510 ], [ 511 ], [ 512 ], [ 513 ] ];;
gap> MAJORANA_SolveSystem(system);;
gap> system.mat!.indices;
[ [ 12 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ] ]
gap> system.mat!.entries;
[ [ 1, -1 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ] ]
gap> system.vec!.indices;
[ [ 1213 ], [ 510111213 ], [ 510111213 ], 
  [ 510111213 ], [ 510111213 ] ]
gap> system.vec!.entries;
[ [ 1/32, -1/32 ], [ 1/95/643/64, -1/16, -1/16 ], 
  [ 1/93/645/64, -1/16, -1/16 ], [ 1/9, -1/16, -1/165/643/64 ], 
  [ 1/9, -1/16, -1/163/645/64 ] ]
gap> system.solutions{[1,2]};
[ fail, fail ]
gap> system.solutions[3]!.indices;
[ [ 510111213 ] ]
gap> system.solutions[3]!.entries;
[ [ 1/95/643/64, -1/16, -1/16 ] ]

##
## Test LDLT decomposition and positive definite
##
gap> mat := SparseMatrix( 66, [ [ 12345 ], [ 12345 ], [ 12345 ], [ 12345 ], [ 12345 ], [ 6 ] ], [ [ 13/1283/1283/1283/128 ], [ 3/12813/1283/1283/128 ], [ 3/1283/12813/1283/128 ], [ 3/1283/1283/12813/128 ], [ 3/1283/1283/1283/1281 ], [ 875/524288 ] ], Rationals );;
gap> mat := ConvertSparseMatrixToMatrix(mat);;
gap> MAJORANA_PositiveDefinite(mat);
1
gap> L := MAJORANA_LDLTDecomposition(mat);;
gap> L[1];
[ [ 100000 ], [ 3/12810000 ], 
  [ 3/1283/1311000 ], [ 3/1283/1313/134100 ], 
  [ 3/1283/1313/1343/13710 ], [ 000001 ] ]
gap> L[2];
[ [ 100000 ], [ 016375/163840000 ], 
  [ 008375/8384000 ], [ 00017125/1715200 ], 
  [ 00004375/43840 ], [ 00000875/524288 ] ]
gap> mat := SparseIdentityMatrix(5, Rationals);;
gap> mat := ConvertSparseMatrixToMatrix(mat);;
gap> L := MAJORANA_LDLTDecomposition(mat);;
gap> L[1];
[ [ 10000 ], [ 01000 ], [ 00100 ], [ 00010 ], 
  [ 00001 ] ]
gap> L[2];
[ [ 10000 ], [ 01000 ], [ 00100 ], [ 00010 ], 
  [ 00001 ] ]
gap> MAJORANA_PositiveDefinite( NullMat(66) );
0

##
## Test iterator for sparse matrices and _IsRowOfSparseMatrix
##
gap> mat := SparseMatrix( 66, [ [ 12345 ], [ 12345 ], [ 12345 ], [ 12345 ], [ 12345 ], [ 6 ] ], [ [ 13/1283/1283/1283/128 ], [ 3/12813/1283/1283/128 ], [ 3/1283/12813/1283/128 ], [ 3/1283/1283/12813/128 ], [ 3/1283/1283/1283/1281 ], [ 875/524288 ] ], Rationals );;
gap> for v in Iterator(mat) do if not _IsRowOfSparseMatrix(mat, v ) then Error(); fi; od;

##
## Test reversed echelon mat transformation
##
gap> mat := ReversedEchelonMatDestructive(mat);;
gap> mat.heads;
654321 ]
gap> mat.vectors!.indices;
[ [ 6 ], [ 5 ], [ 4 ], [ 3 ], [ 2 ], [ 1 ] ]
gap> mat.vectors!.entries;
[ [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ] ]

##
## Test remove mat with heads
##
gap> mat := SparseMatrix( 121, [ [ 159101516 ] ], [ [ 3/1283/128, -1/128, -1/128, -1/1281 ] ], Rationals );;
gap> null := rec( heads := [ 000000000000000000001 ], vectors := SparseMatrix( 121, [ [ 161718192021 ] ], [ [ 111111 ] ], Rationals ) );
rec( heads := [ 000000000000000000001 
     ], vectors := <a 1 x 21 sparse matrix over Rationals> )
gap> mat := RemoveMatWithHeads(mat, null);;
gap> mat!.indices;
[ [ 159101516 ] ]
gap> mat!.entries;
[ [ 3/1283/128, -1/128, -1/128, -1/1281 ] ]

[Dauer der Verarbeitung: 0.25 Sekunden, vorverarbeitet 2026-06-17]