From f13c7c6ff91ff3256bb4b24fb64beabfef2ccd2a Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 13 May 2013 13:36:34 +0000 Subject: * 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. --- src/ChangeLog | 10 ++++++++++ src/algebra/array2.spad.pamphlet | 23 ++++++----------------- src/algebra/matcat.spad.pamphlet | 9 +-------- 3 files changed, 17 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 9e2f0283..8cf54e0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-05-13 Gabriel Dos Reis + + * 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. + 2013-05-13 Gabriel Dos Reis * algebra/array1.spad.pamphlet (IndexedOneDimensionalArray): Tidy. diff --git a/src/algebra/array2.spad.pamphlet b/src/algebra/array2.spad.pamphlet index 0c9ff532..7b3aaf9d 100644 --- a/src/algebra/array2.spad.pamphlet +++ b/src/algebra/array2.spad.pamphlet @@ -272,20 +272,10 @@ InnerTwoDimensionalArray(R,Row,Col):_ Exports == TwoDimensionalArrayCategory(R,Row,Col) Implementation == PrimitiveArray PrimitiveArray R add - ---% Predicates - - empty? m == empty? rep m - --% Primitive array creation - - empty() == per empty()$Rep - new(rows,cols,a) == rows = 0 => error "new: arrays with zero rows are not supported" --- cols = 0 => --- error "new: arrays with zero columns are not supported" arr : Rep := new(rows,empty()) for i in 0..rows-1 repeat arr.i := new(cols,a) @@ -300,7 +290,7 @@ InnerTwoDimensionalArray(R,Row,Col):_ nrows m == # rep m ncols m == empty? m => 0 - # rep(m)(minIndex rep m) + # rep(m).0 --% Part selection/assignment @@ -346,18 +336,17 @@ TwoDimensionalArray(R):Exports == Implementation where ++ A TwoDimensionalArray is a two dimensional array with ++ 1-based indexing for both rows and columns. R : Type - macro Row == OneDimensionalArray R - macro Col == OneDimensionalArray R - Exports == TwoDimensionalArrayCategory(R,Row,Col) with - shallowlyMutable - ++ One may destructively alter TwoDimensionalArray's. - Implementation == InnerTwoDimensionalArray(R,Row,Col) + macro V == OneDimensionalArray R + Exports == TwoDimensionalArrayCategory(R,V,V) + Implementation == InnerTwoDimensionalArray(R,V,V) @ \section{License} <>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --All rights reserved. +--Copyright (C) 2007-2013, Gabriel Dos Reis. +--All rights reversed. -- --Redistribution and use in source and binary forms, with or without --modification, are permitted provided that the following conditions are diff --git a/src/algebra/matcat.spad.pamphlet b/src/algebra/matcat.spad.pamphlet index d0bcd007..c895e038 100644 --- a/src/algebra/matcat.spad.pamphlet +++ b/src/algebra/matcat.spad.pamphlet @@ -41,14 +41,7 @@ MatrixCategory(R,Row,Col): Category == Definition where macro I == Integer Definition ==> TwoDimensionalArrayCategory(R,Row,Col) with - shallowlyMutable - ++ One may destructively alter matrices - - finiteAggregate - ++ matrices are finite - --% Predicates - square? : % -> Boolean ++ \spad{square?(m)} returns true if m is a square matrix ++ (i.e. if m has the same number of rows as columns) and false otherwise. @@ -871,7 +864,7 @@ SquareMatrixCategory(ndim,R,Row,Col): Category == Definition where <>= --Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd. --All rights reserved. ---Copyright (C) 2007-2009, Gabriel Dos Reis. +--Copyright (C) 2007-2013, Gabriel Dos Reis. --All rights reserved. -- --Redistribution and use in source and binary forms, with or without -- cgit v1.2.3