/usr/share/axiom-20170501/src/algebra/RMATRIX.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 | )abbrev domain RMATRIX RectangularMatrix
++ Author: Grabmeier, Gschnitzer, Williamson
++ Date Created: 1987
++ Date Last Updated: July 1990
++ Description:
++ \spadtype{RectangularMatrix} is a matrix domain where the number of rows
++ and the number of columns are parameters of the domain.
RectangularMatrix(m,n,R) : SIG == CODE where
m : NonNegativeInteger
n : NonNegativeInteger
R : Ring
Row ==> DirectProduct(n,R)
Col ==> DirectProduct(m,R)
SIG ==> Join(RectangularMatrixCategory(m,n,R,Row,Col),_
CoercibleTo Matrix R) with
if R has Field then VectorSpace R
if R has ConvertibleTo InputForm then ConvertibleTo InputForm
rectangularMatrix : Matrix R -> $
++ \spad{rectangularMatrix(m)} converts a matrix of type
++ \spadtype{Matrix} to a matrix of type \spad{RectangularMatrix}.
coerce : $ -> Matrix R
++ \spad{coerce(m)} converts a matrix of type
++ \spadtype{RectangularMatrix} to a matrix of type \spad{Matrix}.
CODE ==> Matrix R add
minr ==> minRowIndex
maxr ==> maxRowIndex
minc ==> minColIndex
maxc ==> maxColIndex
mini ==> minIndex
maxi ==> maxIndex
ZERO := new(m,n,0)$Matrix(R) pretend $
0 == ZERO
coerce(x:$):OutputForm == coerce(x pretend Matrix R)$Matrix(R)
matrix(l: List List R) ==
-- error check: this is a top level function
#l ^= m => error "matrix: wrong number of rows"
for ll in l repeat
#ll ^= n => error "matrix: wrong number of columns"
ans : Matrix R := new(m,n,0)
for i in minr(ans)..maxr(ans) for ll in l repeat
for j in minc(ans)..maxc(ans) for r in ll repeat
qsetelt_!(ans,i,j,r)
ans pretend $
row(x,i) == directProduct row(x pretend Matrix(R),i)
column(x,j) == directProduct column(x pretend Matrix(R),j)
coerce(x:$):Matrix(R) == copy(x pretend Matrix(R))
rectangularMatrix x ==
(nrows(x) ^= m) or (ncols(x) ^= n) =>
error "rectangularMatrix: matrix of bad dimensions"
copy(x) pretend $
if R has EuclideanDomain then
rowEchelon x == rowEchelon(x pretend Matrix(R)) pretend $
if R has IntegralDomain then
rank x == rank(x pretend Matrix(R))
nullity x == nullity(x pretend Matrix(R))
nullSpace x ==
[directProduct c for c in nullSpace(x pretend Matrix(R))]
if R has Field then
dimension() == (m * n) :: CardinalNumber
if R has ConvertibleTo InputForm then
convert(x:$):InputForm ==
convert [convert("rectangularMatrix"::Symbol)@InputForm,
convert(x::Matrix(R))]$List(InputForm)
|