diff options
author | dos-reis <gdr@axiomatics.org> | 2013-05-13 16:49:03 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-05-13 16:49:03 +0000 |
commit | bbaaa1fdccbb37ef8881b51edb6588060f30601a (patch) | |
tree | 5c66655da3cde03e1a1da7f7dd22af6bf0840b10 /src/algebra/array2.spad.pamphlet | |
parent | 7bfa7b198f373dfafd78c4eb4bd4dac7b4533ffe (diff) | |
download | open-axiom-bbaaa1fdccbb37ef8881b51edb6588060f30601a.tar.gz |
* algebra/array2.spad.pamphlet (TwoDimensionalArrayCategory): Move
row column implementation to InnerTwoDimensionalArray.
(InnerTwoDimensionalArray): Simplify row and column implementation.
Diffstat (limited to 'src/algebra/array2.spad.pamphlet')
-rw-r--r-- | src/algebra/array2.spad.pamphlet | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/src/algebra/array2.spad.pamphlet b/src/algebra/array2.spad.pamphlet index 7b3aaf9d..1f3aa9fe 100644 --- a/src/algebra/array2.spad.pamphlet +++ b/src/algebra/array2.spad.pamphlet @@ -227,28 +227,6 @@ TwoDimensionalArrayCategory(R,Row,Col): Category == Definition where count(r:R,m:%) == count(#1 = r,m) - if Row has shallowlyMutable then - - row(m,i) == - i < minRowIndex(m) or i > maxRowIndex(m) => - error "row: index out of range" - v : Row := new(ncols m,sampleElement()) - for j in minColIndex(m)..maxColIndex(m) _ - for k in minIndex(v)..maxIndex(v) repeat - qsetelt!(v,k,qelt(m,i,j)) - v - - if Col has shallowlyMutable then - - column(m,j) == - j < minColIndex(m) or j > maxColIndex(m) => - error "column: index out of range" - v : Col := new(nrows m,sampleElement()) - for i in minRowIndex(m)..maxRowIndex(m) _ - for k in minIndex(v)..maxIndex(v) repeat - qsetelt!(v,k,qelt(m,i,j)) - v - if R has CoercibleTo(OutputForm) then coerce(m:%) == @@ -327,6 +305,16 @@ InnerTwoDimensionalArray(R,Row,Col):_ if i < maxRowIndex(m) then s := concat(s, " \\ ")$String concat(s, "\end{array} \right]")$String + row(m,i) == + i < 1 or i >= nrows m => error "row: index out of range" + [[rep(m).i.j for j in 0..ncols m - 1]]$Row + + column(m,j) == + j < 1 or j >= ncols m => error "column: index out of range" + [[rep(m).i.j for i in 0..nrows m - 1]]$Col + + + @ \section{domain ARRAY2 TwoDimensionalArray} |