/usr/share/axiom-20170501/src/algebra/ALGPKG.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 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 | )abbrev package ALGPKG AlgebraPackage
++ Authors: J. Grabmeier, R. Wisbauer
++ Date Created: 04 March 1991
++ Date Last Updated: 04 April 1992
++ Reference:
++ R.S. Pierce: Associative Algebras
++ Graduate Texts in Mathematics 88
++ Springer-Verlag, Heidelberg, 1982, ISBN 0-387-90693-2
++
++ R.D. Schafer: An Introduction to Nonassociative Algebras
++ Academic Press, New York, 1966
++
++ A. Woerz-Busekros: Algebra in Genetics
++ Lectures Notes in Biomathematics 36,
++ Springer-Verlag, Heidelberg, 1980
++ Description:
++ AlgebraPackage assembles a variety of useful functions for
++ general algebras.
AlgebraPackage(R, A) : SIG == CODE where
R:IntegralDomain
A: FramedNonAssociativeAlgebra(R)
V ==> Vector
M ==> Matrix
I ==> Integer
NNI ==> NonNegativeInteger
REC ==> Record(particular: Union(V R,"failed"),basis: List V R)
LSMP ==> LinearSystemMatrixPackage(R,V R,V R, M R)
SIG ==> with
leftRank : A -> NonNegativeInteger
++ leftRank(x) determines the number of linearly independent elements
++ in \spad{x*b1},...,\spad{x*bn},
++ where \spad{b=[b1,...,bn]} is a basis.
rightRank : A -> NonNegativeInteger
++ rightRank(x) determines the number of linearly independent elements
++ in \spad{b1*x},...,\spad{bn*x},
++ where \spad{b=[b1,...,bn]} is a basis.
doubleRank : A -> NonNegativeInteger
++ doubleRank(x) determines the number of linearly
++ independent elements
++ in \spad{b1*x},...,\spad{x*bn},
++ where \spad{b=[b1,...,bn]} is a basis.
weakBiRank : A -> NonNegativeInteger
++ weakBiRank(x) determines the number of
++ linearly independent elements
++ in the \spad{bi*x*bj}, \spad{i,j=1,...,n},
++ where \spad{b=[b1,...,bn]} is a basis.
biRank : A -> NonNegativeInteger
++ biRank(x) determines the number of linearly independent elements
++ in \spad{x}, \spad{x*bi}, \spad{bi*x}, \spad{bi*x*bj},
++ \spad{i,j=1,...,n},
++ where \spad{b=[b1,...,bn]} is a basis.
++ Note that if \spad{A} has a unit,
++ then doubleRank, weakBiRank, and biRank coincide.
basisOfCommutingElements : () -> List A
++ basisOfCommutingElements() returns a basis of the space of
++ all x of \spad{A} satisfying \spad{0 = commutator(x,a)} for all
++ \spad{a} in \spad{A}.
basisOfLeftAnnihilator : A -> List A
++ basisOfLeftAnnihilator(a) returns a basis of the space of
++ all x of \spad{A} satisfying \spad{0 = x*a}.
basisOfRightAnnihilator : A -> List A
++ basisOfRightAnnihilator(a) returns a basis of the space of
++ all x of \spad{A} satisfying \spad{0 = a*x}.
basisOfLeftNucleus : () -> List A
++ basisOfLeftNucleus() returns a basis of the space of
++ all x of \spad{A} satisfying \spad{0 = associator(x,a,b)}
++ for all \spad{a},b in \spad{A}.
basisOfRightNucleus : () -> List A
++ basisOfRightNucleus() returns a basis of the space of
++ all x of \spad{A} satisfying \spad{0 = associator(a,b,x)}
++ for all \spad{a},b in \spad{A}.
basisOfMiddleNucleus : () -> List A
++ basisOfMiddleNucleus() returns a basis of the space of
++ all x of \spad{A} satisfying \spad{0 = associator(a,x,b)}
++ for all \spad{a},b in \spad{A}.
basisOfNucleus : () -> List A
++ basisOfNucleus() returns a basis of the space of
++ all x of \spad{A} satisfying
++ \spad{associator(x,a,b) = associator(a,x,b) = associator(a,b,x) = 0}
++ for all \spad{a},b in \spad{A}.
basisOfCenter : () -> List A
++ basisOfCenter() returns a basis of the space of
++ all x of \spad{A} satisfying \spad{commutator(x,a) = 0} and
++ \spad{associator(x,a,b) = associator(a,x,b) = associator(a,b,x) = 0}
++ for all \spad{a},b in \spad{A}.
basisOfLeftNucloid : ()-> List Matrix R
++ basisOfLeftNucloid() returns a basis of the space of
++ endomorphisms of \spad{A} as right module.
++ Note that left nucloid coincides with left nucleus
++ if \spad{A} has a unit.
basisOfRightNucloid : ()-> List Matrix R
++ basisOfRightNucloid() returns a basis of the space of
++ endomorphisms of \spad{A} as left module.
++ Note that right nucloid coincides with right nucleus
++ if \spad{A} has a unit.
basisOfCentroid : ()-> List Matrix R
++ basisOfCentroid() returns a basis of the centroid, the
++ endomorphism ring of \spad{A} considered as \spad{(A,A)}-bimodule.
radicalOfLeftTraceForm : () -> List A
++ radicalOfLeftTraceForm() returns basis for null space of
++ \spad{leftTraceMatrix()}, if the algebra is
++ associative, alternative or a Jordan algebra, then this
++ space equals the radical (maximal nil ideal) of the algebra.
if R has EuclideanDomain then
basis : V A -> V A
++ basis(va) selects a basis from the elements of va.
CODE ==> add
-- constants
n : PositiveInteger := rank()$A
n2 : PositiveInteger := n*n
n3 : PositiveInteger := n*n2
gamma : Vector Matrix R := structuralConstants()$A
-- local functions
convVM : Vector R -> Matrix R
-- converts n2-vector to (n,n)-matrix row by row
convMV : Matrix R -> Vector R
-- converts n-square matrix to n2-vector row by row
convVM v ==
cond : Matrix(R) := new(n,n,0$R)$M(R)
z : Integer := 0
for i in 1..n repeat
for j in 1..n repeat
z := z+1
setelt(cond,i,j,v.z)
cond
radicalOfLeftTraceForm() ==
ma : M R := leftTraceMatrix()$A
map(represents, nullSpace ma)$ListFunctions2(Vector R, A)
basisOfLeftAnnihilator a ==
ca : M R := transpose (coordinates(a) :: M R)
cond : M R := reduce(vertConcat$(M R),
[ca*transpose(gamma.i) for i in 1..#gamma])
map(represents, nullSpace cond)$ListFunctions2(Vector R, A)
basisOfRightAnnihilator a ==
ca : M R := transpose (coordinates(a) :: M R)
cond : M R := reduce(vertConcat$(M R),
[ca*(gamma.i) for i in 1..#gamma])
map(represents, nullSpace cond)$ListFunctions2(Vector R, A)
basisOfLeftNucloid() ==
cond : Matrix(R) := new(n3,n2,0$R)$M(R)
condo: Matrix(R) := new(n3,n2,0$R)$M(R)
z : Integer := 0
for i in 1..n repeat
for j in 1..n repeat
r1 : Integer := 0
for k in 1..n repeat
z := z + 1
-- z equals (i-1)*n*n+(j-1)*n+k (loop-invariant)
r2 : Integer := i
for r in 1..n repeat
r1 := r1 + 1
-- here r1 equals (k-1)*n+r (loop-invariant)
setelt(cond,z,r1,elt(gamma.r,i,j))
-- here r2 equals (r-1)*n+i (loop-invariant)
setelt(condo,z,r2,-elt(gamma.k,r,j))
r2 := r2 + n
[convVM(sol) for sol in nullSpace(cond+condo)]
basisOfCommutingElements() ==
--gamma1 := first gamma
--gamma1 := gamma1 - transpose gamma1
--cond : Matrix(R) := gamma1 :: Matrix(R)
--for i in 2..n repeat
-- gammak := gamma.i
-- gammak := gammak - transpose gammak
-- cond := vertConcat(cond, gammak :: Matrix(R))$Matrix(R)
--map(represents, nullSpace cond)$ListFunctions2(Vector R, A)
cond : M R := reduce(vertConcat$(M R),
[(gam := gamma.i) - transpose gam for i in 1..#gamma])
map(represents, nullSpace cond)$ListFunctions2(Vector R, A)
basisOfLeftNucleus() ==
condi: Matrix(R) := new(n3,n,0$R)$Matrix(R)
z : Integer := 0
for k in 1..n repeat
for j in 1..n repeat
for s in 1..n repeat
z := z+1
for i in 1..n repeat
entry : R := 0
for l in 1..n repeat
entry := entry+elt(gamma.l,j,k)*elt(gamma.s,i,l)_
-elt(gamma.l,i,j)*elt(gamma.s,l,k)
setelt(condi,z,i,entry)$Matrix(R)
map(represents, nullSpace condi)$ListFunctions2(Vector R,A)
basisOfRightNucleus() ==
condo : Matrix(R) := new(n3,n,0$R)$Matrix(R)
z : Integer := 0
for k in 1..n repeat
for j in 1..n repeat
for s in 1..n repeat
z := z+1
for i in 1..n repeat
entry : R := 0
for l in 1..n repeat
entry := entry+elt(gamma.l,k,i)*elt(gamma.s,j,l) _
-elt(gamma.l,j,k)*elt(gamma.s,l,i)
setelt(condo,z,i,entry)$Matrix(R)
map(represents, nullSpace condo)$ListFunctions2(Vector R,A)
basisOfMiddleNucleus() ==
conda : Matrix(R) := new(n3,n,0$R)$Matrix(R)
z : Integer := 0
for k in 1..n repeat
for j in 1..n repeat
for s in 1..n repeat
z := z+1
for i in 1..n repeat
entry : R := 0
for l in 1..n repeat
entry := entry+elt(gamma.l,j,i)*elt(gamma.s,l,k)
-elt(gamma.l,i,k)*elt(gamma.s,j,l)
setelt(conda,z,i,entry)$Matrix(R)
map(represents, nullSpace conda)$ListFunctions2(Vector R,A)
basisOfNucleus() ==
condi: Matrix(R) := new(3*n3,n,0$R)$Matrix(R)
z : Integer := 0
u : Integer := n3
w : Integer := 2*n3
for k in 1..n repeat
for j in 1..n repeat
for s in 1..n repeat
z := z+1
u := u+1
w := w+1
for i in 1..n repeat
entry : R := 0
enter : R := 0
ent : R := 0
for l in 1..n repeat
entry := entry + elt(gamma.l,j,k)*elt(gamma.s,i,l) _
- elt(gamma.l,i,j)*elt(gamma.s,l,k)
enter := enter + elt(gamma.l,k,i)*elt(gamma.s,j,l) _
- elt(gamma.l,j,k)*elt(gamma.s,l,i)
ent := ent + elt(gamma.l,j,k)*elt(gamma.s,i,l) _
- elt(gamma.l,j,i)*elt(gamma.s,l,k)
setelt(condi,z,i,entry)$Matrix(R)
setelt(condi,u,i,enter)$Matrix(R)
setelt(condi,w,i,ent)$Matrix(R)
map(represents, nullSpace condi)$ListFunctions2(Vector R,A)
basisOfCenter() ==
gamma1 := first gamma
gamma1 := gamma1 - transpose gamma1
cond : Matrix(R) := gamma1 :: Matrix(R)
for i in 2..n repeat
gammak := gamma.i
gammak := gammak - transpose gammak
cond := vertConcat(cond, gammak :: Matrix(R))$Matrix(R)
B := cond :: Matrix(R)
condi: Matrix(R) := new(2*n3,n,0$R)$Matrix(R)
z : Integer := 0
u : Integer := n3
for k in 1..n repeat
for j in 1..n repeat
for s in 1..n repeat
z := z+1
u := u+1
for i in 1..n repeat
entry : R := 0
enter : R := 0
for l in 1..n repeat
entry := entry + elt(gamma.l,j,k)*elt(gamma.s,i,l) _
- elt(gamma.l,i,j)*elt(gamma.s,l,k)
enter := enter + elt(gamma.l,k,i)*elt(gamma.s,j,l) _
- elt(gamma.l,j,k)*elt(gamma.s,l,i)
setelt(condi,z,i,entry)$Matrix(R)
setelt(condi,u,i,enter)$Matrix(R)
D := vertConcat(condi,B)$Matrix(R)
map(represents, nullSpace D)$ListFunctions2(Vector R, A)
basisOfRightNucloid() ==
cond : Matrix(R) := new(n3,n2,0$R)$M(R)
condo: Matrix(R) := new(n3,n2,0$R)$M(R)
z : Integer := 0
for i in 1..n repeat
for j in 1..n repeat
r1 : Integer := 0
for k in 1..n repeat
z := z + 1
-- z equals (i-1)*n*n+(j-1)*n+k (loop-invariant)
r2 : Integer := i
for r in 1..n repeat
r1 := r1 + 1
-- here r1 equals (k-1)*n+r (loop-invariant)
setelt(cond,z,r1,elt(gamma.r,j,i))
-- here r2 equals (r-1)*n+i (loop-invariant)
setelt(condo,z,r2,-elt(gamma.k,j,r))
r2 := r2 + n
[convVM(sol) for sol in nullSpace(cond+condo)]
basisOfCentroid() ==
cond : Matrix(R) := new(2*n3,n2,0$R)$M(R)
condo: Matrix(R) := new(2*n3,n2,0$R)$M(R)
z : Integer := 0
u : Integer := n3
for i in 1..n repeat
for j in 1..n repeat
r1 : Integer := 0
for k in 1..n repeat
z := z + 1
u := u + 1
-- z equals (i-1)*n*n+(j-1)*n+k (loop-invariant)
-- u equals n**3 + (i-1)*n*n+(j-1)*n+k (loop-invariant)
r2 : Integer := i
for r in 1..n repeat
r1 := r1 + 1
-- here r1 equals (k-1)*n+r (loop-invariant)
setelt(cond,z,r1,elt(gamma.r,i,j))
setelt(cond,u,r1,elt(gamma.r,j,i))
-- here r2 equals (r-1)*n+i (loop-invariant)
setelt(condo,z,r2,-elt(gamma.k,r,j))
setelt(condo,u,r2,-elt(gamma.k,j,r))
r2 := r2 + n
[convVM(sol) for sol in nullSpace(cond+condo)]
doubleRank x ==
cond : Matrix(R) := new(2*n,n,0$R)
for k in 1..n repeat
z : Integer := 0
u : Integer := n
for j in 1..n repeat
z := z+1
u := u+1
entry : R := 0
enter : R := 0
for i in 1..n repeat
entry := entry + elt(x,i)*elt(gamma.k,j,i)
enter := enter + elt(x,i)*elt(gamma.k,i,j)
setelt(cond,z,k,entry)$Matrix(R)
setelt(cond,u,k,enter)$Matrix(R)
rank(cond)$(M R)
weakBiRank(x) ==
cond : Matrix(R) := new(n2,n,0$R)$Matrix(R)
z : Integer := 0
for i in 1..n repeat
for j in 1..n repeat
z := z+1
for k in 1..n repeat
entry : R := 0
for l in 1..n repeat
for s in 1..n repeat
entry:=entry+elt(x,l)*elt(gamma.s,i,l)*elt(gamma.k,s,j)
setelt(cond,z,k,entry)$Matrix(R)
rank(cond)$(M R)
biRank(x) ==
cond : Matrix(R) := new(n2+2*n+1,n,0$R)$Matrix(R)
z : Integer := 0
for j in 1..n repeat
for i in 1..n repeat
z := z+1
for k in 1..n repeat
entry : R := 0
for l in 1..n repeat
for s in 1..n repeat
entry:=entry+elt(x,l)*elt(gamma.s,i,l)*elt(gamma.k,s,j)
setelt(cond,z,k,entry)$Matrix(R)
u : Integer := n*n
w : Integer := n*(n+1)
c := n2 + 2*n + 1
for j in 1..n repeat
u := u+1
w := w+1
for k in 1..n repeat
entry : R := 0
enter : R := 0
for i in 1..n repeat
entry := entry + elt(x,i)*elt(gamma.k,j,i)
enter := enter + elt(x,i)*elt(gamma.k,i,j)
setelt(cond,u,k,entry)$Matrix(R)
setelt(cond,w,k,enter)$Matrix(R)
setelt(cond,c,j, elt(x,j))
rank(cond)$(M R)
leftRank x ==
cond : Matrix(R) := new(n,n,0$R)
for k in 1..n repeat
for j in 1..n repeat
entry : R := 0
for i in 1..n repeat
entry := entry + elt(x,i)*elt(gamma.k,i,j)
setelt(cond,j,k,entry)$Matrix(R)
rank(cond)$(M R)
rightRank x ==
cond : Matrix(R) := new(n,n,0$R)
for k in 1..n repeat
for j in 1..n repeat
entry : R := 0
for i in 1..n repeat
entry := entry + elt(x,i)*elt(gamma.k,j,i)
setelt(cond,j,k,entry)$Matrix(R)
rank(cond)$(M R)
if R has EuclideanDomain then
basis va ==
v : V A := remove(zero?, va)$(V A)
v : V A := removeDuplicates v
empty? v => [0$A]
m : Matrix R := coerce(coordinates(v.1))$(Matrix R)
for i in 2..maxIndex v repeat
m := horizConcat(m,coerce(coordinates(v.i))$(Matrix R) )
m := rowEchelon m
lj : List Integer := []
h : Integer := 1
mRI : Integer := maxRowIndex m
mCI : Integer := maxColIndex m
finished? : Boolean := false
j : Integer := 1
while not finished? repeat
not zero? m(h,j) => -- corner found
lj := cons(j,lj)
h := mRI
while zero? m(h,j) repeat h := h-1
finished? := (h = mRI)
if not finished? then h := h+1
if j < mCI then
j := j + 1
else
finished? := true
[v.j for j in reverse lj]
|