aboutsummaryrefslogtreecommitdiff
path: root/src/algebra/matfuns.spad.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2009-06-11 23:00:40 +0000
committerdos-reis <gdr@axiomatics.org>2009-06-11 23:00:40 +0000
commit9e07dcd91c45bf8b22d932321f5c97e931ffe8ac (patch)
tree6d2174e90e5779b1b3ab4ae7df3ae6603b66c6c2 /src/algebra/matfuns.spad.pamphlet
parent7bd82b57975bbc1ff5b87fed0739815c620ecdcc (diff)
downloadopen-axiom-9e07dcd91c45bf8b22d932321f5c97e931ffe8ac.tar.gz
* algebra/: Don't quote '!' at end of names.
Diffstat (limited to 'src/algebra/matfuns.spad.pamphlet')
-rw-r--r--src/algebra/matfuns.spad.pamphlet62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/algebra/matfuns.spad.pamphlet b/src/algebra/matfuns.spad.pamphlet
index d36e02e7..b191d8ff 100644
--- a/src/algebra/matfuns.spad.pamphlet
+++ b/src/algebra/matfuns.spad.pamphlet
@@ -92,17 +92,17 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
if qelt(x,k,j) ~= 0 then leave (n := k)
n = minR - 1 => "no non-zeroes"
-- put nth row in ith position
- if i ~= n then swapRows_!(x,i,n)
+ if i ~= n then swapRows!(x,i,n)
-- divide ith row by its first non-zero entry
b := inv qelt(x,i,j)
- qsetelt_!(x,i,j,1)
- for k in (j+1)..maxC repeat qsetelt_!(x,i,k,b * qelt(x,i,k))
+ qsetelt!(x,i,j,1)
+ for k in (j+1)..maxC repeat qsetelt!(x,i,k,b * qelt(x,i,k))
-- perform row operations so that jth column has only one 1
for k in minR..maxR repeat
if k ~= i and qelt(x,k,j) ~= 0 then
for k1 in (j+1)..maxC repeat
- qsetelt_!(x,k,k1,qelt(x,k,k1) - qelt(x,k,j) * qelt(x,i,k1))
- qsetelt_!(x,k,j,0)
+ qsetelt!(x,k,k1,qelt(x,k,k1) - qelt(x,k,j) * qelt(x,i,k1))
+ qsetelt!(x,k,j,0)
-- increment i
i := i + 1
x
@@ -140,7 +140,7 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
rk = 0 =>
for j in minC..maxC repeat
w : Col := new(ncol,0)
- qsetelt_!(w,j,1)
+ qsetelt!(w,j,1)
basis := cons(w,basis)
basis
-- v contains information about initial 1's in the rows of x
@@ -150,7 +150,7 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
j : Integer
for i in minR..(minR + rk - 1) repeat
for j in minC.. while qelt(x,i,j) = 0 repeat j
- qsetelt_!(v,j,i)
+ qsetelt!(v,j,i)
j := maxC; l := minR + ncol - 1
while j >= minC repeat
w : Col := new(ncol,0)
@@ -158,12 +158,12 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
-- create a basis vector with a 1 in the jth row
if qelt(v,j) = minR - 1 then
colAllZeroes?(x,j) =>
- qsetelt_!(w,l,1)
+ qsetelt!(w,l,1)
basis := cons(w,basis)
for k in minC..(j-1) for ll in minR..(l-1) repeat
if qelt(v,k) ~= minR - 1 then
- qsetelt_!(w,ll,-qelt(x,qelt(v,k),j))
- qsetelt_!(w,l,1)
+ qsetelt!(w,ll,-qelt(x,qelt(v,k),j))
+ qsetelt!(w,l,1)
basis := cons(w,basis)
j := j - 1; l := l - 1
basis
@@ -183,13 +183,13 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
for k in (i+1)..maxR repeat
qelt(x,k,j) ~= 0 => leave (rown := k)
if rown = minR - 1 then return 0
- swapRows_!(x,i,rown); ans := -ans
+ swapRows!(x,i,rown); ans := -ans
ans := qelt(x,i,j) * ans; b := -inv qelt(x,i,j)
- for l in (j+1)..maxC repeat qsetelt_!(x,i,l,b * qelt(x,i,l))
+ for l in (j+1)..maxC repeat qsetelt!(x,i,l,b * qelt(x,i,l))
for k in (i+1)..maxR repeat
if (b := qelt(x,k,j)) ~= 0 then
for l in (j+1)..maxC repeat
- qsetelt_!(x,k,l,qelt(x,k,l) + b * qelt(x,i,l))
+ qsetelt!(x,k,l,qelt(x,k,l) + b * qelt(x,i,l))
qelt(x,maxR,maxC) * ans
generalizedInverse(x) ==
@@ -227,8 +227,8 @@ InnerMatrixLinearAlgebraFunctions(R,Row,Col,M):_
lmin := minColIndex AB; lmax := lmin + ndim - 1
for i in minR..maxR for k in kmin..kmax repeat
for j in minC..maxC for l in lmin..lmax repeat
- qsetelt_!(AB,k,l,qelt(x,i,j))
- qsetelt_!(AB,k,lmin + ndim + k - kmin,1)
+ qsetelt!(AB,k,l,qelt(x,i,j))
+ qsetelt!(AB,k,lmin + ndim + k - kmin,1)
AB := rowEchelon AB
elt(AB,kmax,lmax) = 0 => "failed"
subMatrix(AB,kmin,kmax,lmin + ndim,lmax + ndim)
@@ -282,7 +282,7 @@ MatrixCategoryFunctions2(R1,Row1,Col1,M1,R2,Row2,Col2,M2):_
ans : M2 := new(nrows m,ncols m,0)
for i in minr(m)..maxr(m) for k in minr(ans)..maxr(ans) repeat
for j in minc(m)..maxc(m) for l in minc(ans)..maxc(ans) repeat
- qsetelt_!(ans,k,l,f qelt(m,i,j))
+ qsetelt!(ans,k,l,f qelt(m,i,j))
ans
map(f:(R1 -> (Union(R2,"failed"))),m:M1):Union(M2,"failed") ==
@@ -290,7 +290,7 @@ MatrixCategoryFunctions2(R1,Row1,Col1,M1,R2,Row2,Col2,M2):_
for i in minr(m)..maxr(m) for k in minr(ans)..maxr(ans) repeat
for j in minc(m)..maxc(m) for l in minc(ans)..maxc(ans) repeat
(r := f qelt(m,i,j)) = "failed" => return "failed"
- qsetelt_!(ans,k,l,r::R2)
+ qsetelt!(ans,k,l,r::R2)
ans
reduce(f,m,ident) ==
@@ -350,7 +350,7 @@ RectangularMatrixCategoryFunctions2(m,n,R1,Row1,Col1,M1,R2,Row2,Col2,M2):_
ans : M2 := new(m,n,0)$Matrix(R2) pretend M2
for i in minr(mat)..maxr(mat) for k in minr(ans)..maxr(ans) repeat
for j in minc(mat)..maxc(mat) for l in minc(ans)..maxc(ans) repeat
- qsetelt_!(ans pretend Matrix R2,k,l,f qelt(mat,i,j))
+ qsetelt!(ans pretend Matrix R2,k,l,f qelt(mat,i,j))
ans
reduce(f,mat,ident) ==
@@ -525,7 +525,7 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
if qelt(x,j + minR,i + minC) ~= 0 then
ans :=
md := minorDet(x,m - 2**(j :: NonNegativeInteger),_
- concat_!(reverse rl,l),i + 1,v) *_
+ concat!(reverse rl,l),i + 1,v) *_
qelt(x,j + minR,i + minC)
pos => ans + md
ans - md
@@ -543,7 +543,7 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
new((2**ndim - 1) :: NonNegativeInteger,"uncomputed")
minR := minRowIndex x; maxC := maxColIndex x
for i in 0..n1 repeat
- qsetelt_!(v,(2**i - 1),qelt(x,i + minR,maxC))
+ qsetelt!(v,(2**i - 1),qelt(x,i + minR,maxC))
minorDet(x, 2**ndim - 2, [i for i in 0..n1], 0, v)
-- elementary operation of first kind: exchange two rows --
@@ -584,19 +584,19 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
rown := k -- found a pivot
leave
if rown > minR - 1 then
- swapRows_!(x,i,rown)
+ swapRows!(x,i,rown)
ans := -ans
(c := qelt(x,i,j)) = 0 => "next j" -- try next column
for k in (i+1)..maxR repeat
if qelt(x,k,j) = 0 then
for l in (j+1)..maxC repeat
- qsetelt_!(x,k,l,(c * qelt(x,k,l) exquo b) :: R)
+ qsetelt!(x,k,l,(c * qelt(x,k,l) exquo b) :: R)
else
pv := qelt(x,k,j)
- qsetelt_!(x,k,j,0)
+ qsetelt!(x,k,j,0)
for l in (j+1)..maxC repeat
val := c * qelt(x,k,l) - pv * qelt(x,i,l)
- qsetelt_!(x,k,l,(val exquo b) :: R)
+ qsetelt!(x,k,l,(val exquo b) :: R)
b := c
(i := i+1)>maxR => leave
if ans=-1 then
@@ -721,7 +721,7 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
n := k
xnj := xkj
n = minR - 1 => "next j"
- swapRows_!(x,i,n)
+ swapRows!(x,i,n)
for k in (i+1)..maxR repeat
qelt(x,k,j) = 0 => "next k"
aa := extendedEuclidean(qelt(x,i,j),qelt(x,k,j))
@@ -732,21 +732,21 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where
for k1 in (j+1)..maxC repeat
val1 := a * qelt(x,i,k1) + b * qelt(x,k,k1)
val2 := -a1 * qelt(x,i,k1) + b1 * qelt(x,k,k1)
- qsetelt_!(x,i,k1,val1); qsetelt_!(x,k,k1,val2)
- qsetelt_!(x,i,j,d); qsetelt_!(x,k,j,0)
+ qsetelt!(x,i,k1,val1); qsetelt!(x,k,k1,val2)
+ qsetelt!(x,i,j,d); qsetelt!(x,k,j,0)
un := unitNormal qelt(x,i,j)
- qsetelt_!(x,i,j,un.canonical)
+ qsetelt!(x,i,j,un.canonical)
if un.associate ~= 1 then for jj in (j+1)..maxC repeat
- qsetelt_!(x,i,jj,un.associate * qelt(x,i,jj))
+ qsetelt!(x,i,jj,un.associate * qelt(x,i,jj))
xij := qelt(x,i,j)
for k in minR..(i-1) repeat
qelt(x,k,j) = 0 => "next k"
qr := normalizedDivide(qelt(x,k,j), xij)
- qsetelt_!(x,k,j,qr.remainder)
+ qsetelt!(x,k,j,qr.remainder)
for k1 in (j+1)..maxC repeat
- qsetelt_!(x,k,k1,qelt(x,k,k1) - qr.quotient * qelt(x,i,k1))
+ qsetelt!(x,k,k1,qelt(x,k,k1) - qr.quotient * qelt(x,i,k1))
i := i + 1
x