diff options
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/algebra/array2.spad.pamphlet | 32 |
2 files changed, 17 insertions, 23 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8cf54e0f..44369bc8 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,12 +1,18 @@ 2013-05-13 Gabriel Dos Reis <gdr@integrable-solutions.net> + * algebra/array2.spad.pamphlet (TwoDimensionalArrayCategory): Move + row column implementation to InnerTwoDimensionalArray. + (InnerTwoDimensionalArray): Simplify row and column implementation. + +2013-05-13 Gabriel Dos Reis <gdr@integrable-solutions.net> + * algebra/array2.spad.pamphlet (InnerTwoDimensionalArray): Inherit empty? and empty from base domain. (TwoDimensionalArray): Attribute shallowlyMutable is already specified by TwoDimensionalArrayCategory. * algebra/matcat.spad.pamphlet (MatricCategory): Attributes shallowlyMutable and finiteAggregate are already specified by - TwoDimensionalArrayCategory. + TwoDimensionalArrayCategory. 2013-05-13 Gabriel Dos Reis <gdr@integrable-solutions.net> 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} |