/usr/share/axiom-20170501/src/algebra/IIARRAY2.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 | )abbrev domain IIARRAY2 InnerIndexedTwoDimensionalArray
++ Author: Mark Botch
++ Description:
++ There is no description for this domain
InnerIndexedTwoDimensionalArray(R,mnRow,mnCol,Row,Col) : SIG == CODE where
R : Type
mnRow : Integer
mnCol : Integer
Row : FiniteLinearAggregate R
Col : FiniteLinearAggregate R
SIG ==> TwoDimensionalArrayCategory(R,Row,Col)
CODE ==> add
Rep := PrimitiveArray PrimitiveArray R
--% Predicates
empty? m == empty?(m)$Rep
--% Primitive array creation
empty() == empty()$Rep
new(rows,cols,a) ==
rows = 0 =>
error "new: arrays with zero rows are not supported"
arr : PrimitiveArray PrimitiveArray R := new(rows,empty())
for i in minIndex(arr)..maxIndex(arr) repeat
qsetelt_!(arr,i,new(cols,a))
arr
--% Size inquiries
minRowIndex m == mnRow
minColIndex m == mnCol
maxRowIndex m == nrows m + mnRow - 1
maxColIndex m == ncols m + mnCol - 1
nrows m == (# m)$Rep
ncols m ==
empty? m => 0
# m(minIndex(m)$Rep)
--% Part selection/assignment
qelt(m,i,j) ==
qelt(qelt(m,i - minRowIndex m)$Rep,j - minColIndex m)
elt(m:%,i:Integer,j:Integer) ==
i < minRowIndex(m) or i > maxRowIndex(m) =>
error "elt: index out of range"
j < minColIndex(m) or j > maxColIndex(m) =>
error "elt: index out of range"
qelt(m,i,j)
qsetelt_!(m,i,j,r) ==
setelt(qelt(m,i - minRowIndex m)$Rep,j - minColIndex m,r)
setelt(m:%,i:Integer,j:Integer,r:R) ==
i < minRowIndex(m) or i > maxRowIndex(m) =>
error "setelt: index out of range"
j < minColIndex(m) or j > maxColIndex(m) =>
error "setelt: index out of range"
qsetelt_!(m,i,j,r)
if R has SetCategory then
latex(m : %) : String ==
s : String := "\left[ \begin{array}{"
j : Integer
for j in minColIndex(m)..maxColIndex(m) repeat
s := concat(s,"c")$String
s := concat(s,"} ")$String
i : Integer
for i in minRowIndex(m)..maxRowIndex(m) repeat
for j in minColIndex(m)..maxColIndex(m) repeat
s := concat(s, latex(qelt(m,i,j))$R)$String
if j < maxColIndex(m) then s := concat(s, " & ")$String
if i < maxRowIndex(m) then s := concat(s, " \\ ")$String
concat(s, "\end{array} \right]")$String
|