diff --git a/books/bookvol10.4.pamphlet b/books/bookvol10.4.pamphlet index 81ee93e..5bcf68b 100644 --- a/books/bookvol10.4.pamphlet +++ b/books/bookvol10.4.pamphlet @@ -54300,7 +54300,6 @@ IntegerNumberTheoryFunctions(): Exports == Implementation where l := (#B) :: I n < l => B(n) concat_!(B, new((n+1-l)::NNI, 0)$IndexedFlexibleArray(RN,0)) - for i in 1 .. l by 2 repeat B(i) := 0 -- compute B(i) i = l+2,l+4,...,n given B(j) j = 0,2,...,i-2 for i in l+1 .. n by 2 repeat t:I := 1 @@ -69124,12 +69123,41 @@ zero?(blockConcat(%) - E) --S 44 of 44 )show MatrixManipulation +--R +--R MatrixManipulation(R: Field,Row: FiniteLinearAggregate(R),Col: FiniteLinearAggregate(R),M: MatrixCategory(R,Row,Col)) is a package constructor +--R Abbreviation for MatrixManipulation is MAMA +--R This constructor is exposed in this frame. +--R Issue )edit bookvol10.4.pamphlet to see algebra source code for MAMA +--R +--R------------------------------- Operations -------------------------------- +--R aColumn : (M,PositiveInteger) -> M aRow : (M,PositiveInteger) -> M +--R blockConcat : List(List(M)) -> M diagonalMatrix : (M,Integer) -> M +--R diagonalMatrix : M -> M horizConcat : List(M) -> M +--R vertConcat : List(M) -> M +--R bandMatrix : (M,List(Integer)) -> M +--R bandMatrix : (M,Segment(Integer)) -> M +--R blockSplit : (M,PositiveInteger,PositiveInteger) -> List(List(M)) +--R blockSplit : (M,List(PositiveInteger),PositiveInteger) -> List(List(M)) +--R blockSplit : (M,PositiveInteger,List(PositiveInteger)) -> List(List(M)) +--R blockSplit : (M,List(PositiveInteger),List(PositiveInteger)) -> List(List(M)) +--R columns : (M,List(PositiveInteger)) -> M +--R columns : (M,Segment(PositiveInteger)) -> M +--R element : (M,PositiveInteger,PositiveInteger) -> M +--R horizSplit : (M,PositiveInteger) -> List(M) +--R horizSplit : (M,List(PositiveInteger)) -> List(M) +--R rows : (M,List(PositiveInteger)) -> M +--R rows : (M,Segment(PositiveInteger)) -> M +--R subMatrix : (M,List(PositiveInteger),List(PositiveInteger)) -> M +--R subMatrix : (M,Segment(PositiveInteger),Segment(PositiveInteger)) -> M +--R vertSplit : (M,PositiveInteger) -> List(M) +--R vertSplit : (M,List(PositiveInteger)) -> List(M) +--R --E 44 - )spool )lisp (bye) \end{chunk} + \begin{chunk}{MatrixManipulation.help} ==================================================================== MatrixManipulation examples @@ -69424,8 +69452,1361 @@ zero?(blockConcat(%) - E) See Also: o )show MatrixManipulation +o )help element +o )d op element +o )help aRow +o )d op aRow +o )help rows +o )d op rows +o )help aColumn +o )d op aColumn +o )help columns +o )d op columns +o )help subMatrix +o )d op subMatrix +o )help diagonalMatrix +o )d op diagonalMatrix +o )help bandMatrix +o )d op bandMatrix +o )help horizConcat +o )d op horizConcat +o )help vertConcat +o )d op vertConcat +o )help blockConcat +o )d op blockConcat +o )help vertSplit +o )d op vertSplit +o )help horizSplit +o )d op horizSplit +o )help blockSplit +o )d op blockSplit + +\end{chunk} + +\begin{chunk}{element.help} +==================================================================== +element from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + element + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + element : (M, PositiveInteger, PositiveInteger) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + +DESCRIPTION +=========== + + element returns a single element out of a matrix. + The element is put into a one by one matrix. + +ARGUMENTS +========= + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a member of PositiveInteger + + The third element is a member of PositiveInteger + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + element(M,2,2) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show PositiveInteger +o )d op element + +\end{chunk} + +\begin{chunk}{aRow.help} +==================================================================== +aRow from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + aRow + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + aRow : (M, PositiveInteger) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + aRow returns a single row out of a matrix. + The row is put into a one by N matrix. + +ARGUMENTS +========= + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a member of PositiveInteger + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + aRow(M, 1) + + aRow(M, 2) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show PositiveInteger +o )d op aRow + +\end{chunk} + +\begin{chunk}{rows.help} +==================================================================== +rows from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + rows + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + rows : (M, List PositiveInteger) -> M + rows : (M, Segment PositiveInteger) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + rows returns several rows out of a matrix. + The rows are stacked into a matrix. + +ARGUMENTS +========= + + rows : (M, List PositiveInteger) -> M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a List of PositiveInteger + + rows : (M, Segment PositiveInteger) -> M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a Segment of PositiveInteger + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + rows(M, [1,2]) + + rows(M, [3,2]) + + rows(M, 2..3) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show PositiveInteger +o )show List +o )show Segment +o )d op rows + +\end{chunk} + +\begin{chunk}{aColumn.help} +==================================================================== +aColumn from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + aColumn + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + aColumn : (M, PositiveInteger) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + +DESCRIPTION +=========== + + aColumn returns a single column out of a matrix. + The column is put into a one by N matrix. + +ARGUMENTS +========= + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a member of PositiveInteger + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + aColumn(M, 2) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show PositiveInteger +o )d op aColumn + +\end{chunk} + +\begin{chunk}{columns.help} +==================================================================== +columns from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + columns + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + columns : (M, List PositiveInteger) -> M + columns : (M, Segment PositiveInteger) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + +DESCRIPTION +=========== + + columns returns several columns out of a matrix. + The columns are stacked into a matrix. + +ARGUMENTS +========= + + columns : (M, List PositiveInteger) -> M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a List of PositiveInteger + + columns : (M, Segment PositiveInteger) -> M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a Segment of PositiveInteger + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + columns(M, [1,2]) + + columns(M, [3,2]) + + columns(M, 2..3) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show PositiveInteger +o )show List +o )show Segment +o )d op columns + +\end{chunk} + +\begin{chunk}{subMatrix.help} +==================================================================== +subMatrix from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + subMatrix + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + subMatrix : (M, List PositiveInteger, List PositiveInteger) -> M + subMatrix : (M, Segment PositiveInteger, Segment PositiveInteger) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + subMatrix returns several elements out of a matrix. + The elements are stacked into a submatrix. + +ARGUMENTS +========= + + subMatrix : (M, List PositiveInteger, List PositiveInteger) -> M + + The first argument is an element of M + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a List of PositiveInteger + + The third element is a List of PositiveInteger + + subMatrix : (M, Segment PositiveInteger, Segment PositiveInteger) -> M + + The first argument is an element of M + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a Segment of PositiveInteger + + The third element is a Segment of PositiveInteger + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + subMatrix(M, [1,2],[1,2]) + subMatrix(M, [1,3],[1,3]) + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + subMatrix(M, 1..2,2..3) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show PositiveInteger +o )show List +o )show Segment +o )d op subMatrix + +\end{chunk} + +\begin{chunk}{diagonalMatrix.help} +==================================================================== +diagonalMatrix from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + diagonalMatrix + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + diagonalMatrix : (M, Integer) -> M + diagonalMatrix : M -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + diagonalMatrix : (M, Integer) -> M + + diagonalMatrix returns a diagonal out of a matrix. + The diagonal is put into a matrix of same shape as the + original one. Positive integer arguments select upper + off-diagonals, negative ones lower off-diagonals. + + diagonalMatrix : M -> M + + diagonalMatrix returns the main diagonal out of + a matrix. The diagonal is put into a matrix of same shape + as the original one. + +ARGUMENTS +========= + + diagonalMatrix : (M, Integer) -> M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is an Integer + + diagonalMatrix : M -> M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + diagonalMatrix(M, 1) + + diagonalMatrix(M, 2) + + diagonalMatrix(M, -1) + + diagonalMatrix(M) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show Integer +o )d op diagonalMatrix + +\end{chunk} + +\begin{chunk}{bandMatrix.help} +==================================================================== +bandMatrix from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + bandMatrix + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + bandMatrix : (M, List Integer) -> M + bandMatrix : (M, Segment Integer) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + bandMatrix : (M, List Integer) -> M + + bandMatrix returns multiple diagonals out of a matrix. + The diagonals are put into a matrix of same shape as the + original one. Positive integer arguments select upper + off-diagonals, negative ones lower off-diagonals. + + bandMatrix : (M, Segment Integer) -> M + + bandMatrix returns multiple diagonals out of a matrix. + The diagonals are put into a matrix of same shape as the + original one. Positive integer arguments select upper + off-diagonals, negative ones lower off-diagonals. + + +ARGUMENTS +========= + + bandMatrix : (M, List Integer) -> M + + The first argument is an element of M + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is an List of Integer + + bandMatrix : (M, Segment Integer) -> M + + The first argument is an element of M + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second element is a Segment of Integer + +RETURN VALUE +============ + + The result is an element of M + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + bandMatrix(M, [-1,1]) + + bandMatrix(M, [-1,0,1]) + + bandMatrix(M, -1..1) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show Integer +o )show List +o )show Segment +o )d op bandMatrix \end{chunk} + +\begin{chunk}{horizConcat.help} +==================================================================== +horizConcat from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + horizConcat + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + horizConcat : (List M) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + horizConcat concatenates matrices column wise. + +ARGUMENTS +========= + + The first argument is a List of elements of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + A := matrix([[a]]) + B := matrix([[b]]) + C := matrix([[c]]) + A12 := horizConcat([A,B,C]) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show List +o )d op horizConcat + +\end{chunk} + +\begin{chunk}{vertConcat.help} +==================================================================== +vertConcat from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + vertConcat + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + vertConcat : (List M) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + vertConcat concatenates matrices row wise. + +ARGUMENTS +========= + + The first argument is a list of elements of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + A := matrix([[a]]) + B := matrix([[b]]) + C := matrix([[c]]) + A21 := vertConcat([A,B,C]) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show List +o )d op vertConcat + +\end{chunk} + +\begin{chunk}{blockConcat.help} +==================================================================== +blockConcat from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + blockConcat + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + blockConcat : (List List M) -> M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + blockConcat concatenates matrices row and + column wise, building a block matrix. The order + is row major as in matrix. + +ARGUMENTS +========= + + The first argument is a list of lists of elements of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +RETURN VALUE +============ + + The result is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + A := matrix([[a]]) + B := matrix([[b]]) + C := matrix([[c]]) + A11 := element(M, 3,3) + A12 := horizConcat([A,B,C]) + A21 := vertConcat([A,B,C]) + M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + E := blockConcat([[A11,A12],[A21,M]]) + + t1 := blockSplit(E, 4, [2,2]) + t2 := blockConcat t1 + zero?(E-t2) + + t3 := blockSplit(E, [1,2,1], [2,2]) + t4 := blockConcat t3 + zero?(E-t4) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show List +o )d op blockConcat + +\end{chunk} + +\begin{chunk}{vertSplit.help} +==================================================================== +vertSplit from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + vertSplit + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + vertSplit : (M, PositiveInteger) -> List M + vertSplit : (M, List PositiveInteger) -> List M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + vertSplit splits a matrix into multiple submatrices row wise. + +ARGUMENTS +========= + + vertSplit : (M, PositiveInteger) -> List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a PositiveInteger + + vertSplit : (M, List PositiveInteger) -> List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a List of PositiveInteger + +RETURN VALUE +============ + + The result is an List of elements of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + + t1:= vertSplit(E, 2) + + t2:= vertSplit(E, [1,2,1]) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show List +o )show PositiveInteger +o )d op vertSplit + +\end{chunk} + +\begin{chunk}{horizSplit.help} +==================================================================== +horizSplit from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + horizSplit + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + horizSplit : (M, PositiveInteger) -> List M + horizSplit : (M, List PositiveInteger) -> List M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + horizSplit splits a matrix into multiple submatrices column wise. + +ARGUMENTS +========= + + horizSplit : (M, PositiveInteger) -> List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a PositiveInteger + + horizSplit : (M, List PositiveInteger) -> List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a List of PositiveInteger + +RETURN VALUE +============ + + The result is an List of elements of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + + t1:= horizSplit(E, 2) + + t2:= horizSplit(E, [2,2]) + + t3:= horizSplit(E, [1,2,1]) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show List +o )show PositiveInteger +o )d op horizSplit + +\end{chunk} + +\begin{chunk}{blockSplit.help} +==================================================================== +blockSplit from MatrixManipulation (MAMA) +==================================================================== + +NAME +==== + + blockSplit + +DOMAIN +====== + + MatrixManipulation (MAMA) + +SYNOPSYS +======== + + blockSplit : (M, PositiveInteger, PositiveInteger) -> List List M + blockSplit : (M, List PositiveInteger, PositiveInteger) -> List List M + blockSplit : (M, PositiveInteger, List PositiveInteger) -> List List M + blockSplit : (M, List PositiveInteger, List PositiveInteger) -> List List M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +DESCRIPTION +=========== + + blockSplit splits a matrix into multiple submatrices row and column + wise, dividing a matrix into blocks. + +ARGUMENTS +========= + + blockSplit : (M, PositiveInteger, PositiveInteger) -> List List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a PositiveInteger + + The third argument is a PositiveInteger + + blockSplit : (M, List PositiveInteger, PositiveInteger) -> List List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a List of PositiveInteger + + The third argument is a PositiveInteger + + blockSplit : (M, PositiveInteger, List PositiveInteger) -> List List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a PositiveInteger + + The third argument is a List of PositiveInteger + + blockSplit : (M, List PositiveInteger, List PositiveInteger) -> List List M + + The first argument is an element of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + The second argument is a List of PositiveInteger + + The third argument is a List of PositiveInteger + + +RETURN VALUE +============ + + The result is an List of Lists of elements of M + + where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + +EXAMPLES +======== + + E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + + t1:= blockSplit(E,2,2) + + t2:= blockSplit(E, [2,1,1], 2) + + t3:= blockSplit(E, 4, [2,2]) + + t4:= blockSplit(E, [1,2,1], [2,2]) + +NOTES +===== + +REFERENCES +========== + +SEE ALSO +======== + +o )show MatrixManipulation +o )show List +o )show PositiveInteger +o )d op blockSplit + +\end{chunk} + \pagehead{MatrixManipulation}{MAMA} \pagepic{ps/v104matrixmanipulation.eps}{MAMA}{1.00} @@ -69480,112 +70861,208 @@ MatrixManipulation(R, Row, Col, M) : Exports == Implementation where element : (M, PI, PI) -> M ++ \spad{element} returns a single element out of a matrix. ++ The element is put into a one by one matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X element(M,2,2) aRow : (M, PI) -> M ++ \spad{aRow} returns a single row out of a matrix. ++ The row is put into a one by N matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X aRow(M, 1) + ++X aRow(M, 2) rows : (M, LPI) -> M ++ \spad{rows} returns several rows out of a matrix. ++ The rows are stacked into a matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X rows(M, [1,2]) + ++X rows(M, [3,2]) rows : (M, SPI) -> M ++ \spad{rows} returns several rows out of a matrix. ++ The rows are stacked into a matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X rows(M, 2..3) aColumn : (M, PI) -> M ++ \spad{aColumn} returns a single column out of a matrix. ++ The column is put into a one by N matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X aColumn(M, 2) columns : (M, LPI) -> M ++ \spad{columns} returns several columns out of a matrix. ++ The columns are stacked into a matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X columns(M, [1,2]) + ++X columns(M, [3,2]) columns : (M, SPI) -> M ++ \spad{columns} returns several columns out of a matrix. ++ The columns are stacked into a matrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X columns(M, 1..2) subMatrix : (M, LPI, LPI) -> M ++ \spad{subMatrix} returns several elements out of a matrix. ++ The elements are stacked into a submatrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X subMatrix(M, [1,2],[1,2]) + ++X subMatrix(M, [1,3],[1,3]) subMatrix : (M, SPI, SPI) -> M ++ \spad{subMatrix} returns several elements out of a matrix. ++ The elements are stacked into a submatrix. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X subMatrix(M, 1..2,2..3) diagonalMatrix : (M, I) -> M ++ \spad{diagonalMatrix} returns a diagonal out of a matrix. ++ The diagonal is put into a matrix of same shape as the ++ original one. Positive integer arguments select upper ++ off-diagonals, negative ones lower off-diagonals. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X diagonalMatrix(M, 1) + ++X diagonalMatrix(M, 2) + ++X diagonalMatrix(M, -1) diagonalMatrix : M -> M ++ \spad{diagonalMatrix} returns the main diagonal out of ++ a matrix. The diagonal is put into a matrix of same shape ++ as the original one. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X diagonalMatrix(M) bandMatrix : (M, LI) -> M ++ \spad{bandMatrix} returns multiple diagonals out of a matrix. ++ The diagonals are put into a matrix of same shape as the ++ original one. Positive integer arguments select upper ++ off-diagonals, negative ones lower off-diagonals. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X bandMatrix(M, [-1,1]) + ++X bandMatrix(M, [-1,0,1]) bandMatrix : (M, SI) -> M ++ \spad{bandMatrix} returns multiple diagonals out of a matrix. ++ The diagonals are put into a matrix of same shape as the ++ original one. Positive integer arguments select upper ++ off-diagonals, negative ones lower off-diagonals. + ++ + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X bandMatrix(M, -1..1) -- Stacking matrices horizConcat : (List M) -> M ++ \spad{horizConcat} concatenates matrices column wise. + ++ + ++X A := matrix([[a]]) + ++X B := matrix([[b]]) + ++X C := matrix([[c]]) + ++X A12 := horizConcat([A,B,C]) vertConcat : (List M) -> M ++ \spad{vertConcat} concatenates matrices row wise. + ++ + ++X A := matrix([[a]]) + ++X B := matrix([[b]]) + ++X C := matrix([[c]]) + ++X A21 := vertConcat([A,B,C]) blockConcat : (List List M) -> M ++ \spad{blockConcat} concatenates matrices row and ++ column wise, building a block matrix. The order ++ is row major as in \spad{matrix}. + ++ + ++X A := matrix([[a]]) + ++X B := matrix([[b]]) + ++X C := matrix([[c]]) + ++X A11 := element(M, 3,3) + ++X A12 := horizConcat([A,B,C]) + ++X A21 := vertConcat([A,B,C]) + ++X M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + ++X E := blockConcat([[A11,A12],[A21,M]]) + ++X t1 := blockSplit(E, 4, [2,2]) + ++X t2 := blockConcat t1 + ++X zero?(E-t2) + ++X t3 := blockSplit(E, [1,2,1], [2,2]) + ++X t4 := blockConcat t3 + ++X zero?(E-t4) -- Splitting matrices vertSplit : (M, PI) -> List M ++ \spad{vertSplit} splits a matrix into multiple ++ submatrices row wise. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= vertSplit(E, 2) vertSplit : (M, LPI) -> List M ++ \spad{vertSplit} splits a matrix into multiple ++ submatrices row wise. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= vertSplit(E, [1,2,1]) horizSplit : (M, PI) -> List M ++ \spad{horizSplit} splits a matrix into multiple ++ submatrices column wise. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= horizSplit(E, 2) horizSplit : (M, LPI) -> List M ++ \spad{horizSplit} splits a matrix into multiple ++ submatrices column wise. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= horizSplit(E, [2,2]) + ++X t2:= horizSplit(E, [1,2,1]) blockSplit : (M, PI, PI) -> List List M ++ \spad{blockSplit} splits a matrix into multiple ++ submatrices row and column wise, dividing ++ a matrix into blocks. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= blockSplit(E,2,2) blockSplit : (M, LPI, PI) -> List List M ++ \spad{blockSplit} splits a matrix into multiple ++ submatrices row and column wise, dividing ++ a matrix into blocks. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= blockSplit(E, [2,1,1], 2) blockSplit : (M, PI, LPI) -> List List M ++ \spad{blockSplit} splits a matrix into multiple ++ submatrices row and column wise, dividing ++ a matrix into blocks. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= blockSplit(E, 4, [2,2]) blockSplit : (M, LPI, LPI) -> List List M ++ \spad{blockSplit} splits a matrix into multiple ++ submatrices row and column wise, dividing ++ a matrix into blocks. + ++ + ++X E := matrix([[i,a,b,c],[a,a,b,c],[b,d,e,f],[c,g,h,i]]) + ++X t1:= blockSplit(E, [1,2,1], [2,2]) Implementation ==> add @@ -168137,7 +169614,8 @@ UnivariatePolynomialCommonDenominator(R, Q, UP): Exports == Impl where ++ clearDenominator(q) returns p such that \spad{q = p/d} where d is ++ a common denominator for the coefficients of q. splitDenominator : UP -> Record(num: UP, den: R) - ++ splitDenominator(q) returns \spad{[p, d]} such that \spad{q = p/d} and d + ++ splitDenominator(q) returns \spad{[p, d]} such that + ++ \spad{q = p/d} and d ++ is a common denominator for the coefficients of q. Impl ==> add diff --git a/changelog b/changelog index 7f6f18b..0f3d9c2 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ -20141123 rhx src/axiom-website/patches.html 20141124.01.rhx.patch +20141124 tpd src/axiom-website/patches.html 20141124.02.rhx.patch +20141124 tpd books/bookvol10.4 help docs for MatrixManipulation +20141124 rhx src/axiom-website/patches.html 20141124.01.rhx.patch 20141124 rhx buglist bug 7265: interpreter does early retract to Taylor series 20141123 tpd src/axiom-website/patches.html 20141123.04.tpd.patch 20141123 tpd buglist bug 7264: 2.7@DoubleFloat failed to DoubleFloat diff --git a/patch b/patch index 5db73bd..c4f8880 100644 --- a/patch +++ b/patch @@ -1,15 +1,7 @@ -buglist bug 7265: interpreter does early retract to Taylor series +books/bookvol10.4 help docs for MatrixManipulation -Z ==> Integer -Q ==> Fraction Z -z:Symbol := 'z -L ==> UnivariateLaurentSeries(Q,z,0) -q:L := z::Variable(z)::L -t1:L := (1/((1-q)*(1-q^2))) -t2 := t1-1 -recip t2 -t3 := recip t2 -t4:Union(L,"failed") := recip t2 -- bug in interpreter -t5:Union(L,"failed") := (recip t2)$L -t6:Union(L,"failed") := t3 +add )help and )d op documentation for +MatrixManipulation, element, aRow, rows, aColumn, columns, subMatrix, +diagonalMatrix, bandMatrix, horizConcat, vertConcat, blockConcat, +vertSplit, horizSplit, blockSplit diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 880a1cb..f637d7d 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -4728,6 +4728,8 @@ books/bookvol10.3 fix iOrder in ISUPS for finite args
buglist bug 7264: 2.7@DoubleFloat failed to coerce to DoubleFloat
20141124.01.rhx.patch buglist bug 7265: interpreter does early retract to Taylor series +20141124.02.tpd.patch +books/bookvol10.4 help docs for MatrixManipulation