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 inmatrix.
- 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 positionk,lhasnkrows andmlcolumns. Error: if number of rows of a is different thann1+ … +nior number of columns of a is different thanm1+ … +mj
- blockSplit: (%, PositiveInteger, PositiveInteger) -> List List %
blockSplit(a, n, m)splits a inton*msubarrays of equal size row and column wise, dividing a into blocks. Error: if number of rows of a is not divisible bynor number of columns of a is not divisible bym.
- coerce: % -> OutputForm if R has CoercibleTo OutputForm
from CoercibleTo OutputForm
- colSlice: % -> Segment Integer
colSlice(m)returns a segmentssuch that formthe accessm(i,s) gives thei-th row.
- column: (%, Integer) -> Col
column(m, j)returns thejth column ofmerror 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 theith row andjth column of the arraymerror check to determine if indices are in proper ranges
- elt: (%, Integer, Integer, R) -> R
elt(m, i, j, r)returns the element in theith row andjth column of the arraym, ifmhas anith row and ajth column, and returnsrotherwise
- elt: (%, Integer, List Integer) -> %
elt(x, row, colList)returns an 1-by-narray consisting of elements ofx, wheren = \# colList. IfcolList = [j<1>, j<2>, ..., j<n>], then the(k, l)th entry ofelt(x, row, colList)isx(row, j<l>).
- elt: (%, Integer, List Segment Integer) -> %
elt(x, row, ls2)is equivalent toelt(x, row, l2)wherel2is obtained appending expansions of elements ofls2, but should be more convenient and more efficient.
- elt: (%, List Integer, Integer) -> %
elt(x, rowList, col)returns anm-by-1 array consisting of elements ofx, wherem = \# rowList. IfrowList = [i<1>, i<2>, ..., i<m>], then the(k, l)th entry ofelt(x, rowList, col)isx(i<k>, col).
- elt: (%, List Integer, List Integer) -> %
elt(x, rowList, colList)returns anm-by-narray consisting of elements ofx, wherem = \# rowListandn = \# colList. IfrowList = [i<1>, i<2>, ..., i<m>]andcolList = [j<1>, j<2>, ..., j<n>], then the(k, l)th entry ofelt(x, rowList, colList)isx(i<k>, j<l>).
- elt: (%, List Integer, Segment Integer) -> %
elt(x, rowList, s)is equivalent toelt(x, rowList, expand(s))but should be more convenient and more efficient.
- elt: (%, List Segment Integer, Integer) -> %
elt(x, ls1, col)is equivalent toelt(x, l1, col)wherel1is obtained appending expansions of elements ofls1, but should be more convenient and more efficient.
- elt: (%, List Segment Integer, List Segment Integer) -> %
elt(x, ls1, ls2)is equivalent toelt(x, l1, l2)whereliis 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 toelt(x, l1, l2)whereliis 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 toelt(x, expand(s), colList)but should be more convenient and more efficient.
- elt: (%, Segment Integer, List Segment Integer) -> %
elt(x, s1, ls2)is equivalent toelt(x, l1, l2)whereliis 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 toelt(x, expand(s1), expand(s2))but should be more convenient and more efficient.
- eval: (%, Equation R) -> % if R has SetCategory and R has Evalable R
from Evalable R
- eval: (%, List Equation R) -> % if R has SetCategory and R has Evalable R
from Evalable R
- eval: (%, List R, List R) -> % if R has SetCategory and R has Evalable R
from InnerEvalable(R, R)
- eval: (%, R, R) -> % if R has SetCategory and R has Evalable R
from InnerEvalable(R, R)
- every?: (R -> Boolean, %) -> Boolean
from HomogeneousAggregate R
- fill!: (%, R) -> %
fill!(m, r)fillsmwithr'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 ofyappear to the right of the entries ofx. Error: if the arrays do not have the same number of rows.
- horizConcat: List % -> %
horizConcat(l)horizontally concatenates all members oflError: if the arrays do not have the same number of rows.
- horizSplit: (%, List NonNegativeInteger) -> List %
horizSplit(a, [n1, n2, ..., ni])splits a into arrays havingn1, …,nicolumns. Error: if number of columns of a is different thann1+ … +ni.
- horizSplit: (%, PositiveInteger) -> List %
horizSplit(a, n)splits a intonarrays of equal size column wise. Error: if number of columns of a is not divisible byn.
- latex: % -> String if R has SetCategory
from SetCategory
- less?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- map!: (R -> R, %) -> %
map!(f, a)assigna(i, j)tof(a(i, j))for alli, j
- map: ((R, R) -> R, %, %) -> %
map(f, a, b)returnsc, wherec(i, j) = f(a(i, j), b(i, j))for alli, j
- map: ((R, R) -> R, %, %, R) -> %
map(f, a, b, r)returnsc, wherec(i, j) = f(a(i, j), b(i, j))when botha(i, j)andb(i, j)exist; elsec(i, j) = f(r, b(i, j))whena(i, j)does not exist; elsec(i, j) = f(a(i, j), r)whenb(i, j)does not exist; otherwisec(i, j) = f(r, r).
- map: (R -> R, %) -> %
map(f, a)returnsb, whereb(i, j) = f(a(i, j))for alli, 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 arraym
- maxRowIndex: % -> Integer
maxRowIndex(m)returns the index of the ‘last’ row of the arraym
- 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 arraym
- minRowIndex: % -> Integer
minRowIndex(m)returns the index of the ‘first’ row of the arraym
- more?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- ncols: % -> NonNegativeInteger
ncols(m)returns the number of columns in the arraym
- new: (NonNegativeInteger, NonNegativeInteger, R) -> %
new(m, n, r)is anm-by-narray all of whose entries arer
- nrows: % -> NonNegativeInteger
nrows(m)returns the number of rows in the arraym
- parts: % -> List R
parts(m)returns a list of the elements ofmin row major order
- qelt: (%, Integer, Integer) -> R
qelt(m, i, j)returns the element in theith row andjth column of the arraymNO error check to determine if indices are in proper ranges
- qnew: (NonNegativeInteger, NonNegativeInteger) -> %
qnew(m, n)is is anm-by-nuninitilized array
- qsetelt!: (%, Integer, Integer, R) -> R
qsetelt!(m, i, j, r)sets the element in theith row andjth column ofmtorNO error check to determine if indices are in proper ranges
- row: (%, Integer) -> Row
row(m, i)returns theith row ofmerror check to determine if index is in proper ranges
- rowSlice: % -> Segment Integer
rowSlice(m)returns a segmentssuch that formthe accessm(s,j) gives thej-th column.
- setColumn!: (%, Integer, Col) -> %
setColumn!(m, j, v)sets tojth column ofmtov
- setelt!: (%, Integer, Integer, R) -> R
setelt!(m, i, j, r)sets the element in theith row andjth column ofmtorerror 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, wheren = \# colList.
- setelt!: (%, Integer, List Segment Integer, %) -> %
setelt!(x, row, ls2)is equivalent tosetelt!(x, row, l2)wherel2is obtained appending expansions of elements ofls2, but should be more convenient and more efficient.
- setelt!: (%, List Integer, Integer, %) -> %
setelt!(x, rowList, col)assigns to anm-by-1 selection of the array, wherem = \# rowList.
- setelt!: (%, List Integer, List Integer, %) -> %
setelt!(x, rowList, colList, y)destructively alters the arrayx. Ifyism-by-n,rowList = [i<1>, i<2>, ..., i<m>]andcolList = [j<1>, j<2>, ..., j<n>], thenx(i<k>, j<l>)is set toy(k, l)fork = 1, ..., mandl = 1, ..., n.
- setelt!: (%, List Integer, Segment Integer, %) -> %
setelt!(x, l1, s2)is equivalent tosetelt!(x, l1, expand(s2))but should be more convenient and more efficient.
- setelt!: (%, List Segment Integer, Integer, %) -> %
setelt!(x, ls1, col)is equivalent tosetelt!(x, l1, col)wherel1is obtained appending expansions of elements ofls1, but should be more convenient and more efficient.
- setelt!: (%, List Segment Integer, List Segment Integer, %) -> %
setelt!(x, ls1, ls1)is equivalent tosetelt!(x, l1, l2)whereliis 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 tosetelt!(x, l1, l2)whereliis 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 tosetelt!(x, expand(s1), l2)but should be more convenient and more efficient.
- setelt!: (%, Segment Integer, List Segment Integer, %) -> %
setelt!(x, s1, ls2)is equivalent tosetelt!(x, l1, l2)whereliis 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 tosetelt!(x, expand(s1), expand(s2))but should be more convenient and more efficient.
- setRow!: (%, Integer, Row) -> %
setRow!(m, i, v)sets toith row ofmtov
- setsubMatrix!: (%, Integer, Integer, %) -> %
setsubMatrix(x, i1, j1, y)destructively alters the arrayx. Herex(i, j)is set toy(i-i1+1, j-j1+1)fori = i1, ..., i1-1+nrows yandj = j1, ..., j1-1+ncols y.
- size?: (%, NonNegativeInteger) -> Boolean
from Aggregate
- smaller?: (%, %) -> Boolean if R has Comparable
from Comparable
- squareTop: % -> %
squareTop(m)returns ann-by-narray consisting of the firstnrows of them-by-narraym. Error: ifm < n.
- subMatrix: (%, Integer, Integer, Integer, Integer) -> %
subMatrix(x, i1, i2, j1, j2)extracts the submatrix[x(i, j)]where the indexiranges fromi1toi2and the indexjranges fromj1toj2.
- swapColumns!: (%, Integer, Integer) -> %
swapColumns!(m, i, j)interchanges theith andjth columns ofm. This destructively alters the array.
- swapRows!: (%, Integer, Integer) -> %
swapRows!(m, i, j)interchanges theith andjth rows ofm. This destructively alters the array.
- transpose: % -> %
transpose(m)returns the transpose of the arraym.
- vertConcat: (%, %) -> %
vertConcat(x, y)vertically concatenates two arrays with an equal number of columns. The entries ofyappear below of the entries ofx. Error: if the arrays do not have the same number of columns.
- vertConcat: List % -> %
vertConcat(l)vertically concatenates all members oflError: if the arrays do not have the same number of columns.
- vertSplit: (%, List NonNegativeInteger) -> List %
vertSplit(a, [n1, ..., ni])splits a into arrays havingn1, …,nirows. Error: if number of rows of a is different thann1+… +ni.
- vertSplit: (%, PositiveInteger) -> List %
vertSplit(a, n)splits a intonarrays of equal size row wise. Error: if number of rows of a is not divisible byn.
CoercibleTo OutputForm if R has CoercibleTo OutputForm
Comparable if R has Comparable
Evalable R if R has SetCategory and R has Evalable R
InnerEvalable(R, R) if R has SetCategory and R has Evalable R
SetCategory if R has SetCategory