From bbaaa1fdccbb37ef8881b51edb6588060f30601a Mon Sep 17 00:00:00 2001
From: dos-reis <gdr@axiomatics.org>
Date: Mon, 13 May 2013 16:49:03 +0000
Subject: 	* algebra/array2.spad.pamphlet (TwoDimensionalArrayCategory):
 Move 	row column implementation to InnerTwoDimensionalArray. 
 (InnerTwoDimensionalArray): Simplify row and column implementation.

---
 src/ChangeLog                    |  8 +++++++-
 src/algebra/array2.spad.pamphlet | 32 ++++++++++----------------------
 2 files changed, 17 insertions(+), 23 deletions(-)

(limited to 'src')

diff --git a/src/ChangeLog b/src/ChangeLog
index 8cf54e0f..44369bc8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+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
@@ -6,7 +12,7 @@
 	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}
-- 
cgit v1.2.3