/usr/share/axiom-20170501/src/algebra/PSEUDLIN.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | )abbrev package PSEUDLIN PseudoLinearNormalForm
++ Author: Bruno Zuercher
++ Date Created: November 1993
++ Date Last Updated: 12 April 1994
++ References:
++ Coxx07 Ideals, varieties and algorithms
++ Description:
++ PseudoLinearNormalForm provides a function for computing a block-companion
++ form for pseudo-linear operators.
PseudoLinearNormalForm(K) : SIG == CODE where
K : Field
ER ==> Record(C: Matrix K, g: Vector K)
REC ==> Record(R: Matrix K, A: Matrix K, Ainv: Matrix K)
SIG ==> with
normalForm : (Matrix K, Automorphism K, K -> K) -> REC
++ normalForm(M, sig, der) returns \spad{[R, A, A^{-1}]} such that
++ the pseudo-linear operator whose matrix in the basis \spad{y} is
++ \spad{M} had matrix \spad{R} in the basis \spad{z = A y}.
++ \spad{der} is a \spad{sig}-derivation.
++
++X f:HDMP([x,y],FRAC INT) := x^3 + 3*y^2
++X g:HDMP([x,y],FRAC INT) := x^2 + y
++X h:HDMP([x,y],FRAC INT) := x + 2*x*j
++X normalForm(f,[g,h])
++X Lex := DMP([x,y],FRAC INT)
++X normalForm(f::Lex,[g::Lex,h::Lex])
changeBase : (Matrix K, Matrix K, Automorphism K, K -> K) -> Matrix K
++ changeBase(M, A, sig, der): computes the new matrix of a pseudo-linear
++ transform given by the matrix M under the change of base A
companionBlocks : (Matrix K, Vector K) -> List ER
++ companionBlocks(m, v) returns \spad{[[C_1, g_1],...,[C_k, g_k]]}
++ such that each \spad{C_i} is a companion block and
++ \spad{m = diagonal(C_1,...,C_k)}.
CODE ==> add
normalForm0: (Matrix K, Automorphism K, Automorphism K, K -> K) -> REC
mulMatrix: (Integer, Integer, K) -> Matrix K
-- mulMatrix(N, i, a): under change of base with the resulting matrix of
-- size N*N the following operations are performed:
-- D1: column i will be multiplied by sig(a)
-- D2: row i will be multiplied by 1/a
-- D3: addition of der(a)/a to the element at position (i,i)
addMatrix: (Integer, Integer, Integer, K) -> Matrix K
-- addMatrix(N, i, k, a): under change of base with the resulting matrix
-- of size N*N the following operations are performed:
-- C1: addition of column i multiplied by sig(a) to column k
-- C2: addition of row k multiplied by -a to row i
-- C3: addition of -a*der(a) to the element at position (i,k)
permutationMatrix: (Integer, Integer, Integer) -> Matrix K
-- permutationMatrix(N, i, k): under a change of base with the resulting
-- permutation matrix of size N*N the following operations are performed:
-- P1: columns i and k will be exchanged
-- P2: rows i and k will be exchanged
inv: Matrix K -> Matrix K
-- inv(M): computes the inverse of a invertable matrix M.
-- avoids possible type conflicts
inv m == inverse(m) :: Matrix K
changeBase(M, A, sig, der) ==
inv(A) * (M * map((k1:K):K +-> sig k1, A) + map(der, A))
normalForm(M, sig, der) == normalForm0(M, sig, inv sig, der)
companionBlocks(R, w) ==
-- decomposes the rational matrix R into single companion blocks
-- and the inhomogenity w as well
i:Integer := 1
n := nrows R
l:List(ER) := empty()
while i <= n repeat
j := i
while j+1 <= n and R(j,j+1) = 1 repeat j := j+1
--split block now
v:Vector K := new((j-i+1)::NonNegativeInteger, 0)
for k in i..j repeat v(k-i+1) := w k
l := concat([subMatrix(R,i,j,i,j), v], l)
i := j+1
l
normalForm0(M, sig, siginv, der) ==
-- the changes of base will be incremented in B and Binv,
-- where B**(-1)=Binv; E defines an elementary matrix
B, Binv, E : Matrix K
recOfMatrices : REC
N := nrows M
B := diagonalMatrix [1 for k in 1..N]
Binv := copy B
-- avoid unnecessary recursion
if diagonal?(M) then return [M, B, Binv]
i : Integer := 1
while i < N repeat
j := i + 1
while j <= N and M(i, j) = 0 repeat j := j + 1
if j <= N then
-- expand companionblock by lemma 5
if j ^= i+1 then
-- perform first a permutation
E := permutationMatrix(N, i+1, j)
M := changeBase(M, E, sig, der)
B := B*E
Binv := E*Binv
-- now is M(i, i+1) ^= 0
E := mulMatrix(N, i+1, siginv inv M(i,i+1))
M := changeBase(M, E, sig, der)
B := B*E
Binv := inv(E)*Binv
for j in 1..N repeat
if j ^= i+1 then
E := addMatrix(N, i+1, j, siginv(-M(i,j)))
M := changeBase(M, E, sig, der)
B := B*E
Binv := inv(E)*Binv
i := i + 1
else
-- apply lemma 6
for j in i..2 by -1 repeat
for k in (i+1)..N repeat
E := addMatrix(N, k, j-1, M(k,j))
M := changeBase(M, E, sig, der)
B := B*E
Binv := inv(E)*Binv
j := i + 1
while j <= N and M(j,1) = 0 repeat j := j + 1
if j <= N then
-- expand companionblock by lemma 8
E := permutationMatrix(N, 1, j)
M := changeBase(M, E, sig, der)
B := B*E
Binv := E*Binv
-- start again to establish rational form
i := 1
else
-- split a direct factor
recOfMatrices :=
normalForm(subMatrix(M, i+1, N, i+1, N), sig, der)
setsubMatrix!(M, i+1, i+1, recOfMatrices.R)
E := diagonalMatrix [1 for k in 1..N]
setsubMatrix!(E, i+1, i+1, recOfMatrices.A)
B := B*E
setsubMatrix!(E, i+1, i+1, recOfMatrices.Ainv)
Binv := E*Binv
-- M in blockdiagonalform, stop program
i := N
[M, B, Binv]
mulMatrix(N, i, a) ==
M : Matrix K := diagonalMatrix [1 for j in 1..N]
M(i, i) := a
M
addMatrix(N, i, k, a) ==
A : Matrix K := diagonalMatrix [1 for j in 1..N]
A(i, k) := a
A
permutationMatrix(N, i, k) ==
P : Matrix K := diagonalMatrix [1 for j in 1..N]
P(i, i) := P(k, k) := 0
P(i, k) := P(k, i) := 1
P
|