TwoDimensionalArrayCategory(R, Row, Col)¶
array2.spad line 1 [edit on github]
- R: Type 
- Row: IndexedAggregate(Integer, R) 
- Col: IndexedAggregate(Integer, R) 
TwoDimensionalArrayCategory is a general array category which allows different representations and indexing schemes. Rows and columns may be extracted with rows returned as objects of type Row and columns returned as objects of type Col. The index of the ‘first’ row may be obtained by calling the function ‘minRowIndex’. The index of the ‘first’ column may be obtained by calling the function ‘minColIndex’. The index of the first element of a ‘Row’ is the same as the index of the first column in an array and vice versa.
- #: % -> NonNegativeInteger
- from Aggregate 
- any?: (R -> Boolean, %) -> Boolean
- from HomogeneousAggregate R 
- blockConcat: List List % -> %
- blockConcat(ll)concatenates arrays row and column wise, building a array from blocks. The order is row major as in- matrix.
- blockSplit: (%, List NonNegativeInteger, List NonNegativeInteger) -> List List %
- blockSplit(a, [n1,...,ni], [m1,...,mi])splits a into multiple subarraus row and column wise, such that element at position- k,- lhas- nkrows and- mlcolumns. Error: if number of rows of a is different than- n1+ … +- nior number of columns of a is different than- m1+ … +- mj
- blockSplit: (%, PositiveInteger, PositiveInteger) -> List List %
- blockSplit(a, n, m)splits a into- n*msubarrays of equal size row and column wise, dividing a into blocks. Error: if number of rows of a is not divisible by- nor number of columns of a is not divisible by- m.
- coerce: % -> OutputForm if R has CoercibleTo OutputForm
- from CoercibleTo OutputForm 
- colSlice: % -> Segment Integer
- colSlice(m)returns a segment- ssuch that for- mthe access- m(- i,- s) gives the- i-th row.
- column: (%, Integer) -> Col
- column(m, j)returns the- jth column of- merror check to determine if index is in proper ranges
- count: (R -> Boolean, %) -> NonNegativeInteger
- from HomogeneousAggregate R 
- count: (R, %) -> NonNegativeInteger if R has BasicType
- from HomogeneousAggregate R 
- elt: (%, Integer, Integer) -> R
- elt(m, i, j)returns the element in the- ith row and- jth column of the array- merror check to determine if indices are in proper ranges
- elt: (%, Integer, Integer, R) -> R
- elt(m, i, j, r)returns the element in the- ith row and- jth column of the array- m, if- mhas an- ith row and a- jth column, and returns- rotherwise
- elt: (%, Integer, List Integer) -> %
- elt(x, row, colList)returns an 1-by-- narray consisting of elements of- x, where- n = \# colList. If- colList = [j<1>, j<2>, ..., j<n>], then the- (k, l)th entry of- elt(x, row, colList)is- x(row, j<l>).
- elt: (%, Integer, List Segment Integer) -> %
- elt(x, row, ls2)is equivalent to- elt(x, row, l2)where- l2is obtained appending expansions of elements of- ls2, but should be more convenient and more efficient.
- elt: (%, List Integer, Integer) -> %
- elt(x, rowList, col)returns an- m-by-1 array consisting of elements of- x, where- m = \# rowList. If- rowList = [i<1>, i<2>, ..., i<m>], then the- (k, l)th entry of- elt(x, rowList, col)is- x(i<k>, col).
- elt: (%, List Integer, List Integer) -> %
- elt(x, rowList, colList)returns an- m-by-- narray consisting of elements of- x, where- m = \# rowListand- n = \# colList. If- rowList = [i<1>, i<2>, ..., i<m>]and- colList = [j<1>, j<2>, ..., j<n>], then the- (k, l)th entry of- elt(x, rowList, colList)is- x(i<k>, j<l>).
- elt: (%, List Integer, Segment Integer) -> %
- elt(x, rowList, s)is equivalent to- elt(x, rowList, expand(s))but should be more convenient and more efficient.
- elt: (%, List Segment Integer, Integer) -> %
- elt(x, ls1, col)is equivalent to- elt(x, l1, col)where- l1is obtained appending expansions of elements of- ls1, but should be more convenient and more efficient.
- elt: (%, List Segment Integer, List Segment Integer) -> %
- elt(x, ls1, ls2)is equivalent to- elt(x, l1, l2)where- liis obtained appending expansions of elements of lsi, but should be more convenient and more efficient.
- elt: (%, List Segment Integer, Segment Integer) -> %
- elt(x, ls1, s2)is equivalent to- elt(x, l1, l2)where- liis obtained appending expansions of elements of lsi, but should be more convenient and more efficient.
- elt: (%, Segment Integer, List Integer) -> %
- elt(x, s, colList)is equivalent to- elt(x, expand(s), colList)but should be more convenient and more efficient.
- elt: (%, Segment Integer, List Segment Integer) -> %
- elt(x, s1, ls2)is equivalent to- elt(x, l1, l2)where- liis obtained appending expansions of elements of lsi, but should be more convenient and more efficient.
- elt: (%, Segment Integer, Segment Integer) -> %
- elt(x, s1, s2)is equivalent to- elt(x, expand(s1), expand(s2))but should be more convenient and more efficient.
- eval: (%, Equation R) -> % if R has Evalable R and R has SetCategory
- from Evalable R 
- eval: (%, List Equation R) -> % if R has Evalable R and R has SetCategory
- from Evalable R 
- eval: (%, List R, List R) -> % if R has Evalable R and R has SetCategory
- from InnerEvalable(R, R) 
- eval: (%, R, R) -> % if R has Evalable R and R has SetCategory
- from InnerEvalable(R, R) 
- every?: (R -> Boolean, %) -> Boolean
- from HomogeneousAggregate R 
- fill!: (%, R) -> %
- fill!(m, r)fills- mwith- r- 's
- hash: % -> SingleInteger if R has Hashable
- from Hashable 
- hashUpdate!: (HashState, %) -> HashState if R has Hashable
- from Hashable 
- horizConcat: (%, %) -> %
- horizConcat(x, y)horizontally concatenates two arrays with an equal number of rows. The entries of- yappear to the right of the entries of- x. Error: if the arrays do not have the same number of rows.
- horizConcat: List % -> %
- horizConcat(l)horizontally concatenates all members of- lError: if the arrays do not have the same number of rows.
- horizSplit: (%, List NonNegativeInteger) -> List %
- horizSplit(a, [n1, n2, ..., ni])splits a into arrays having- n1, …,- nicolumns. Error: if number of columns of a is different than- n1+ … +- ni.
- horizSplit: (%, PositiveInteger) -> List %
- horizSplit(a, n)splits a into- narrays of equal size column wise. Error: if number of columns of a is not divisible by- n.
- latex: % -> String if R has SetCategory
- from SetCategory 
- less?: (%, NonNegativeInteger) -> Boolean
- from Aggregate 
- map!: (R -> R, %) -> %
- map!(f, a)assign- a(i, j)to- f(a(i, j))for all- i, j
- map: ((R, R) -> R, %, %) -> %
- map(f, a, b)returns- c, where- c(i, j) = f(a(i, j), b(i, j))for all- i, j
- map: ((R, R) -> R, %, %, R) -> %
- map(f, a, b, r)returns- c, where- c(i, j) = f(a(i, j), b(i, j))when both- a(i, j)and- b(i, j)exist; else- c(i, j) = f(r, b(i, j))when- a(i, j)does not exist; else- c(i, j) = f(a(i, j), r)when- b(i, j)does not exist; otherwise- c(i, j) = f(r, r).
- map: (R -> R, %) -> %
- map(f, a)returns- b, where- b(i, j) = f(a(i, j))for all- i, j
- max: % -> R if R has OrderedSet
- from HomogeneousAggregate R 
- max: ((R, R) -> Boolean, %) -> R
- from HomogeneousAggregate R 
- maxColIndex: % -> Integer
- maxColIndex(m)returns the index of the ‘last’ column of the array- m
- maxRowIndex: % -> Integer
- maxRowIndex(m)returns the index of the ‘last’ row of the array- m
- member?: (R, %) -> Boolean if R has BasicType
- from HomogeneousAggregate R 
- members: % -> List R
- from HomogeneousAggregate R 
- min: % -> R if R has OrderedSet
- from HomogeneousAggregate R 
- minColIndex: % -> Integer
- minColIndex(m)returns the index of the ‘first’ column of the array- m
- minRowIndex: % -> Integer
- minRowIndex(m)returns the index of the ‘first’ row of the array- m
- more?: (%, NonNegativeInteger) -> Boolean
- from Aggregate 
- ncols: % -> NonNegativeInteger
- ncols(m)returns the number of columns in the array- m
- new: (NonNegativeInteger, NonNegativeInteger, R) -> %
- new(m, n, r)is an- m-by-- narray all of whose entries are- r
- nrows: % -> NonNegativeInteger
- nrows(m)returns the number of rows in the array- m
- parts: % -> List R
- parts(m)returns a list of the elements of- min row major order
- qelt: (%, Integer, Integer) -> R
- qelt(m, i, j)returns the element in the- ith row and- jth column of the array- mNO error check to determine if indices are in proper ranges
- qnew: (NonNegativeInteger, NonNegativeInteger) -> %
- qnew(m, n)is is an- m-by-- nuninitilized array
- qsetelt!: (%, Integer, Integer, R) -> R
- qsetelt!(m, i, j, r)sets the element in the- ith row and- jth column of- mto- rNO error check to determine if indices are in proper ranges
- row: (%, Integer) -> Row
- row(m, i)returns the- ith row of- merror check to determine if index is in proper ranges
- rowSlice: % -> Segment Integer
- rowSlice(m)returns a segment- ssuch that for- mthe access- m(- s,- j) gives the- j-th column.
- setColumn!: (%, Integer, Col) -> %
- setColumn!(m, j, v)sets to- jth column of- mto- v
- setelt!: (%, Integer, Integer, R) -> R
- setelt!(m, i, j, r)sets the element in the- ith row and- jth column of- mto- rerror check to determine if indices are in proper ranges
- setelt!: (%, Integer, List Integer, %) -> %
- setelt!(x, row, colList)assigns to an 1-by-- nselection of the array, where- n = \# colList.
- setelt!: (%, Integer, List Segment Integer, %) -> %
- setelt!(x, row, ls2)is equivalent to- setelt!(x, row, l2)where- l2is obtained appending expansions of elements of- ls2, but should be more convenient and more efficient.
- setelt!: (%, List Integer, Integer, %) -> %
- setelt!(x, rowList, col)assigns to an- m-by-1 selection of the array, where- m = \# rowList.
- setelt!: (%, List Integer, List Integer, %) -> %
- setelt!(x, rowList, colList, y)destructively alters the array- x. If- yis- m-by-- n,- rowList = [i<1>, i<2>, ..., i<m>]and- colList = [j<1>, j<2>, ..., j<n>], then- x(i<k>, j<l>)is set to- y(k, l)for- k = 1, ..., mand- l = 1, ..., n.
- setelt!: (%, List Integer, Segment Integer, %) -> %
- setelt!(x, l1, s2)is equivalent to- setelt!(x, l1, expand(s2))but should be more convenient and more efficient.
- setelt!: (%, List Segment Integer, Integer, %) -> %
- setelt!(x, ls1, col)is equivalent to- setelt!(x, l1, col)where- l1is obtained appending expansions of elements of- ls1, but should be more convenient and more efficient.
- setelt!: (%, List Segment Integer, List Segment Integer, %) -> %
- setelt!(x, ls1, ls1)is equivalent to- setelt!(x, l1, l2)where- liis obtained appending expansions of elements of lsi, but should be more convenient and more efficient.
- setelt!: (%, List Segment Integer, Segment Integer, %) -> %
- setelt!(x, ls1, s2)is equivalent to- setelt!(x, l1, l2)where- liis obtained appending expansions of elements of lsi, but should be more convenient and more efficient.
- setelt!: (%, Segment Integer, List Integer, %) -> %
- setelt!(x, s1, l2)is equivalent to- setelt!(x, expand(s1), l2)but should be more convenient and more efficient.
- setelt!: (%, Segment Integer, List Segment Integer, %) -> %
- setelt!(x, s1, ls2)is equivalent to- setelt!(x, l1, l2)where- liis obtained appending expansions of elements of lsi, but should be more convenient and more efficient.
- setelt!: (%, Segment Integer, Segment Integer, %) -> %
- setelt!(x, s1, s2)is equivalent to- setelt!(x, expand(s1), expand(s2))but should be more convenient and more efficient.
- setRow!: (%, Integer, Row) -> %
- setRow!(m, i, v)sets to- ith row of- mto- v
- setsubMatrix!: (%, Integer, Integer, %) -> %
- setsubMatrix(x, i1, j1, y)destructively alters the array- x. Here- x(i, j)is set to- y(i-i1+1, j-j1+1)for- i = i1, ..., i1-1+nrows yand- j = j1, ..., j1-1+ncols y.
- size?: (%, NonNegativeInteger) -> Boolean
- from Aggregate 
- smaller?: (%, %) -> Boolean if R has Comparable
- from Comparable 
- squareTop: % -> %
- squareTop(m)returns an- n-by-- narray consisting of the first- nrows of the- m-by-- narray- m. Error: if- m < n.
- subMatrix: (%, Integer, Integer, Integer, Integer) -> %
- subMatrix(x, i1, i2, j1, j2)extracts the submatrix- [x(i, j)]where the index- iranges from- i1to- i2and the index- jranges from- j1to- j2.
- swapColumns!: (%, Integer, Integer) -> %
- swapColumns!(m, i, j)interchanges the- ith and- jth columns of- m. This destructively alters the array.
- swapRows!: (%, Integer, Integer) -> %
- swapRows!(m, i, j)interchanges the- ith and- jth rows of- m. This destructively alters the array.
- transpose: % -> %
- transpose(m)returns the transpose of the array- m.
- vertConcat: (%, %) -> %
- vertConcat(x, y)vertically concatenates two arrays with an equal number of columns. The entries of- yappear below of the entries of- x. Error: if the arrays do not have the same number of columns.
- vertConcat: List % -> %
- vertConcat(l)vertically concatenates all members of- lError: if the arrays do not have the same number of columns.
- vertSplit: (%, List NonNegativeInteger) -> List %
- vertSplit(a, [n1, ..., ni])splits a into arrays having- n1, …,- nirows. Error: if number of rows of a is different than- n1+… +- ni.
- vertSplit: (%, PositiveInteger) -> List %
- vertSplit(a, n)splits a into- narrays of equal size row wise. Error: if number of rows of a is not divisible by- n.
CoercibleTo OutputForm if R has CoercibleTo OutputForm
Comparable if R has Comparable
Evalable R if R has Evalable R and R has SetCategory
InnerEvalable(R, R) if R has Evalable R and R has SetCategory
SetCategory if R has SetCategory