diff --git a/books/bookvol10.4.pamphlet b/books/bookvol10.4.pamphlet index c974de0..ac95d36 100644 --- a/books/bookvol10.4.pamphlet +++ b/books/bookvol10.4.pamphlet @@ -4425,22 +4425,23 @@ credits() --RAn alphabetical listing of contributors to AXIOM: --RMichael Albaugh Cyril Alberga Roy Adler --RChristian Aistleitner Richard Anderson George Andrews ---RS.J. Atkins +--RS.J. Atkins --RHenry Baker Martin Baker Stephen Balzac --RYurij Baransky David R. Barton Gerald Baumgartner --RGilbert Baumslag Michael Becker Nelson H. F. Beebe --RJay Belanger David Bindel Fred Blair ---RVladimir Bondarenko Mark Botch Alexandre Bouyer ---RKaren Braman Peter A. Broadbery Martin Brock ---RManuel Bronstein Stephen Buchwald Florian Bundschuh ---RLuanne Burns William Burge Ralph Byers +--RVladimir Bondarenko Mark Botch Raoul Bourquin +--RAlexandre Bouyer Karen Braman Peter A. Broadbery +--RMartin Brock Manuel Bronstein Stephen Buchwald +--RFlorian Bundschuh Luanne Burns William Burge +--RRalph Byers --RQuentin Carpent Robert Caviness Bruce Char --ROndrej Certik Tzu-Yi Chen Cheekai Chin --RDavid V. Chudnovsky Gregory V. Chudnovsky Mark Clements ---RJames Cloos Josh Cohen Christophe Conil ---RDon Coppersmith George Corliss Robert Corless ---RGary Cornell Meino Cramer Claire Di Crescenzo ---RJeremy Du Croz David Cyganski +--RJames Cloos Jia Zhao Cong Josh Cohen +--RChristophe Conil Don Coppersmith George Corliss +--RRobert Corless Gary Cornell Meino Cramer +--RClaire Di Crescenzo Jeremy Du Croz David Cyganski --RNathaniel Daly Timothy Daly Sr. Timothy Daly Jr. --RJames H. Davenport David Day James Demmel --RDidier Deshommes Michael Dewar Jack Dongarra @@ -4455,7 +4456,7 @@ credits() --RKorrinn Fu --RMarc Gaetano Rudiger Gebauer Van de Geijn --RKathy Gerber Patricia Gianni Samantha Goldrich ---RHolger Gollan Teresa Gomez-Diaz Laureano Gonzalez-Vega +--RHolger Gollan Teresa Gomez-Diaz Laureano Gonzalez-Vega --RStephen Gortler Johannes Grabmeier Matt Grayson --RKlaus Ebbe Grue James Griesmer Vladimir Grinberg --ROswald Gschnitzer Ming Gu Jocelyn Guidry @@ -68709,6 +68710,1086 @@ MatrixLinearAlgebraFunctions(R,Row,Col,M):Exports == Implementation where \end{chunk} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{package MAMA MatrixManipulation} +\begin{chunk}{MatrixManipulation.input} +)set break resume +)sys rm -f MatrixManipulation.output +)spool MatrixManipulation.output +)set message test on +)set message auto off +)clear all + +--S 1 of 44 +M := matrix([[a,b,c],[d,e,f],[g,h,i]]) +--R +--R +--R +a b c+ +--R | | +--R (1) |d e f| +--R | | +--R +g h i+ +--R Type: Matrix(Polynomial(Integer)) +--E 1 + +--S 2 of 44 +element(M, 2,2) +--R +--R +--R (2) [e] +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 2 + +--S 3 of 44 +aRow(M, 1) +--R +--R +--R (3) [a b c] +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 3 + +--S 4 of 44 +aRow(M, 2) +--R +--R +--R (4) [d e f] +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 4 + +--S 5 of 44 +aColumn(M, 2) +--R +--R +--R +b+ +--R | | +--R (5) |e| +--R | | +--R +h+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 5 + +--S 6 of 44 +aColumn(M, 3) +--R +--R +--R +c+ +--R | | +--R (6) |f| +--R | | +--R +i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 6 + +--S 7 of 44 +rows(M, [1,2]) +--R +--R +--R +a b c+ +--R (7) | | +--R +d e f+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 7 + +--S 8 of 44 +rows(M, [1,3]) +--R +--R +--R +a b c+ +--R (8) | | +--R +g h i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 8 + +--S 9 of 44 +rows(M, [3,2]) +--R +--R +--R +g h i+ +--R (9) | | +--R +d e f+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 9 + +--S 10 of 44 +rows(M, 2..3) +--R +--R +--R +d e f+ +--R (10) | | +--R +g h i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 10 + +--S 11 of 44 +columns(M, [1,2]) +--R +--R +--R +a b+ +--R | | +--R (11) |d e| +--R | | +--R +g h+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 11 + +--S 12 of 44 +columns(M, [1,3]) +--R +--R +--R +a c+ +--R | | +--R (12) |d f| +--R | | +--R +g i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 12 + +--S 13 of 44 +columns(M, [3,2]) +--R +--R +--R +c b+ +--R | | +--R (13) |f e| +--R | | +--R +i h+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 13 + +--S 14 of 44 +columns(M, 1..2) +--R +--R +--R +a b+ +--R | | +--R (14) |d e| +--R | | +--R +g h+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 14 + +--S 15 of 44 +subMatrix(M, [1,2],[1,2]) +--R +--R +--R +a b+ +--R (15) | | +--R +d e+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 15 + +--S 16 of 44 +subMatrix(M, [1,3],[1,3]) +--R +--R +--R +a c+ +--R (16) | | +--R +g i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 16 + +--S 17 of 44 +diagonalMatrix(M) +--R +--R +--R +a 0 0+ +--R | | +--R (17) |0 e 0| +--R | | +--R +0 0 i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 17 + +--S 18 of 44 +diagonalMatrix(M, 1) +--R +--R +--R +0 b 0+ +--R | | +--R (18) |0 0 f| +--R | | +--R +0 0 0+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 18 + +--S 19 of 44 +diagonalMatrix(M, 2) +--R +--R +--R +0 0 c+ +--R | | +--R (19) |0 0 0| +--R | | +--R +0 0 0+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 19 + +--S 20 of 44 +diagonalMatrix(M, -1) +--R +--R +--R +0 0 0+ +--R | | +--R (20) |d 0 0| +--R | | +--R +0 h 0+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 20 + +--S 21 of 44 +diagonalMatrix(M, -2) +--R +--R +--R +0 0 0+ +--R | | +--R (21) |0 0 0| +--R | | +--R +g 0 0+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 21 + +--S 22 of 44 +bandMatrix(M, [-1,1]) +--R +--R +--R +0 b 0+ +--R | | +--R (22) |d 0 f| +--R | | +--R +0 h 0+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 22 + +--S 23 of 44 +bandMatrix(M, [-1,0,1]) +--R +--R +--R +a b 0+ +--R | | +--R (23) |d e f| +--R | | +--R +0 h i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 23 + +--S 24 of 44 +bandMatrix(M, -1..1) +--R +--R +--R +a b 0+ +--R | | +--R (24) |d e f| +--R | | +--R +0 h i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 24 + +-- Build a larger matrix + +--S 25 of 44 +A := matrix([[a]]) +--R +--R +--R (25) [a] +--R Type: Matrix(Polynomial(Integer)) +--E 25 + +--S 26 of 44 +B := matrix([[b]]) +--R +--R +--R (26) [b] +--R Type: Matrix(Polynomial(Integer)) +--E 26 + +--S 27 of 44 +C := matrix([[c]]) +--R +--R +--R (27) [c] +--R Type: Matrix(Polynomial(Integer)) +--E 27 + +--S 28 of 44 +A11 := element(M, 3,3) +--R +--R +--R (28) [i] +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 28 + +--S 29 of 44 +A12 := horizConcat([A,B,C]) +--R +--R +--R (29) [a b c] +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 29 + +--S 30 of 44 +A21 := vertConcat([A,B,C]) +--R +--R +--R +a+ +--R | | +--R (30) |b| +--R | | +--R +c+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 30 + +--S 31 of 44 +E := blockConcat([[A11,A12],[A21,M]]) +--R +--R +--R +i a b c+ +--R | | +--R |a a b c| +--R (31) | | +--R |b d e f| +--R | | +--R +c g h i+ +--R Type: Matrix(Fraction(Polynomial(Integer))) +--E 31 + +-- Split again + +--S 32 of 44 +vertSplit(E, 2) +--R +--R +--R +i a b c+ +b d e f+ +--R (32) [| |,| |] +--R +a a b c+ +c g h i+ +--R Type: List(Matrix(Fraction(Polynomial(Integer)))) +--E 32 + +--S 33 of 44 +horizSplit(E, 2) +--R +--R +--R +i a+ +b c+ +--R | | | | +--R |a a| |b c| +--R (33) [| |,| |] +--R |b d| |e f| +--R | | | | +--R +c g+ +h i+ +--R Type: List(Matrix(Fraction(Polynomial(Integer)))) +--E 33 + +--S 34 of 44 +vertSplit(E, [1,2,1]) +--R +--R +--R +a a b c+ +--R (34) [[i a b c],| |,[c g h i]] +--R +b d e f+ +--R Type: List(Matrix(Fraction(Polynomial(Integer)))) +--E 34 + +--S 35 of 44 +horizSplit(E, [2,2]) +--R +--R +--R +i a+ +b c+ +--R | | | | +--R |a a| |b c| +--R (35) [| |,| |] +--R |b d| |e f| +--R | | | | +--R +c g+ +h i+ +--R Type: List(Matrix(Fraction(Polynomial(Integer)))) +--E 35 + +--S 36 of 44 +blockSplit(E, 2,2) +--R +--R +--R +i a+ +b c+ +b d+ +e f+ +--R (36) [[| |,| |],[| |,| |]] +--R +a a+ +b c+ +c g+ +h i+ +--R Type: List(List(Matrix(Fraction(Polynomial(Integer))))) +--E 36 + +--S 37 of 44 +zero?(blockConcat(%) - E) +--R +--R +--R (37) true +--R Type: Boolean +--E 37 + +--S 38 of 44 +blockSplit(E, [1,2,1], [2,2]) +--R +--R +--R +a a+ +b c+ +--R (38) [[[i a],[b c]],[| |,| |],[[c g],[h i]]] +--R +b d+ +e f+ +--R Type: List(List(Matrix(Fraction(Polynomial(Integer))))) +--E 38 + +--S 39 of 44 +zero?(blockConcat(%) - E) +--R +--R +--R (39) true +--R Type: Boolean +--E 39 + +--S 40 of 44 +blockSplit(E, [2,1,1], 2) +--R +--R +--R +i a+ +b c+ +--R (40) [[| |,| |],[[b d],[e f]],[[c g],[h i]]] +--R +a a+ +b c+ +--R Type: List(List(Matrix(Fraction(Polynomial(Integer))))) +--E 40 + +--S 41 of 44 +zero?(blockConcat(%) - E) +--R +--R +--R (41) true +--R Type: Boolean +--E 41 + +--S 42 of 44 +blockSplit(E, 4, [2,2]) +--R +--R +--R (42) [[[i a],[b c]],[[a a],[b c]],[[b d],[e f]],[[c g],[h i]]] +--R Type: List(List(Matrix(Fraction(Polynomial(Integer))))) +--E 42 + +--S 43 of 44 +zero?(blockConcat(%) - E) +--R +--R +--R (43) true +--R Type: Boolean +--E 43 + +--S 44 of 44 +)show MatrixManipulation +--E 44 + + +)spool +)lisp (bye) +\end{chunk} +\begin{chunk}{MatrixManipulation.help} +==================================================================== +MatrixManipulation examples +==================================================================== + +Some functions for manipulating (dense) matrices. + +Supported are various kinds of slicing, splitting +and stacking of matrices. The functions resemble +operations often used in numerical linear algebra +algorithms. + +M := matrix([[a,b,c],[d,e,f],[g,h,i]]) + + +a b c+ + | | + |d e f| + | | + +g h i+ + +element(M, 2,2) + + [e] + +aRow(M, 1) + + [a b c] + +aRow(M, 2) + + [d e f] + +aColumn(M, 2) + + +b+ + | | + |e| + | | + +h+ + +aColumn(M, 3) + + +c+ + | | + |f| + | | + +i+ + +rows(M, [1,2]) + + +a b c+ + | | + +d e f+ + +rows(M, [1,3]) + + +a b c+ + | | + +g h i+ + +rows(M, [3,2]) + + +g h i+ + | | + +d e f+ + +rows(M, 2..3) + + +d e f+ + | | + +g h i+ + +columns(M, [1,2]) + + +a b+ + | | + |d e| + | | + +g h+ + +columns(M, [1,3]) + + +a c+ + | | + |d f| + | | + +g i+ + +columns(M, [3,2]) + + +c b+ + | | + |f e| + | | + +i h+ + +columns(M, 1..2) + + +a b+ + | | + |d e| + | | + +g h+ + +subMatrix(M, [1,2],[1,2]) + + +a b+ + | | + +d e+ + +subMatrix(M, [1,3],[1,3]) + + +a c+ + | | + +g i+ + +diagonalMatrix(M) + + +a 0 0+ + | | + |0 e 0| + | | + +0 0 i+ + +diagonalMatrix(M, 1) + + +0 b 0+ + | | + |0 0 f| + | | + +0 0 0+ + +diagonalMatrix(M, 2) + + +0 0 c+ + | | + |0 0 0| + | | + +0 0 0+ + +diagonalMatrix(M, -1) + + +0 0 0+ + | | + |d 0 0| + | | + +0 h 0+ + +diagonalMatrix(M, -2) + + +0 0 0+ + | | + |0 0 0| + | | + +g 0 0+ + +bandMatrix(M, [-1,1]) + + +0 b 0+ + | | + |d 0 f| + | | + +0 h 0+ + +bandMatrix(M, [-1,0,1]) + + +a b 0+ + | | + |d e f| + | | + +0 h i+ + +bandMatrix(M, -1..1) + + +a b 0+ + | | + |d e f| + | | + +0 h i+ + +Build a larger matrix + +A := matrix([[a]]) + + [a] + +B := matrix([[b]]) + + [b] + +C := matrix([[c]]) + + [c] + +A11 := element(M, 3,3) + + [i] + +A12 := horizConcat([A,B,C]) + + [a b c] + +A21 := vertConcat([A,B,C]) + + +a+ + | | + |b| + | | + +c+ + +E := blockConcat([[A11,A12],[A21,M]]) + + +i a b c+ + | | + |a a b c| + | | + |b d e f| + | | + +c g h i+ + +Split again + +vertSplit(E, 2) + + +i a b c+ +b d e f+ + [| |,| |] + +a a b c+ +c g h i+ + +horizSplit(E, 2) + + +i a+ +b c+ + | | | | + |a a| |b c| + [| |,| |] + |b d| |e f| + | | | | + +c g+ +h i+ + +vertSplit(E, [1,2,1]) + + +a a b c+ + [[i a b c],| |,[c g h i]] + +b d e f+ + +horizSplit(E, [2,2]) + + +i a+ +b c+ + | | | | + |a a| |b c| + [| |,| |] + |b d| |e f| + | | | | + +c g+ +h i+ + +blockSplit(E, 2,2) + + +i a+ +b c+ +b d+ +e f+ + [[| |,| |],[| |,| |]] + +a a+ +b c+ +c g+ +h i+ + +zero?(blockConcat(%) - E) + + true + +blockSplit(E, [1,2,1], [2,2]) + + +a a+ +b c+ + [[[i a],[b c]],[| |,| |],[[c g],[h i]]] + +b d+ +e f+ + +zero?(blockConcat(%) - E) + + true + +blockSplit(E, [2,1,1], 2) + + +i a+ +b c+ + [[| |,| |],[[b d],[e f]],[[c g],[h i]]] + +a a+ +b c+ + +zero?(blockConcat(%) - E) + + true + +blockSplit(E, 4, [2,2]) + + [[[i a],[b c]],[[a a],[b c]],[[b d],[e f]],[[c g],[h i]]] + +zero?(blockConcat(%) - E) + + true + +See Also: +o )show MatrixManipulation + +\end{chunk} +\pagehead{MatrixManipulation}{MAMA} +\pagepic{ps/v104matrixmanipulation.eps}{MAMA}{1.00} + +{\bf Exports:}\\ +\begin{tabular}{lllll} +\cross{MAMA}{aColumn} & +\cross{MAMA}{aRow} & +\cross{MAMA}{bandMatrix} & +\cross{MAMA}{blockConcat} & +\cross{MAMA}{blockSplit} \\ +\cross{MAMA}{columns} & +\cross{MAMA}{diagonalMatrix} & +\cross{MAMA}{element} & +\cross{MAMA}{horizConcat} & +\cross{MAMA}{horizSplit} \\ +\cross{MAMA}{rows} & +\cross{MAMA}{subMatrix} & +\cross{MAMA}{vertConcat} & +\cross{MAMA}{vertSplit} & +\end{tabular} + +\begin{chunk}{package MAMA MatrixManipulation} +)abbrev package MAMA MatrixManipulation +++ Author: Raoul Bourquin +++ Date Created: 17 November 2012 +++ Date Last Updated: 1 December 2012 +++ Description: +++ Some functions for manipulating (dense) matrices. +++ Supported are various kinds of slicing, splitting and stacking of +++ matrices. The functions resemble operations often used in numerical +++ linear algebra algorithms. +MatrixManipulation(R, Row, Col, M) : Exports == Implementation where + R : Field + Row : FiniteLinearAggregate R + Col : FiniteLinearAggregate R + M : MatrixCategory(R, Row, Col) + + I ==> Integer + PI ==> PositiveInteger + LI ==> List I + SI ==> Segment I + LPI ==> List PI + SPI ==> Segment PI + + Exports ==> with + + -- Slicing matrices + + -- How to call aRow, aColumn? Name clashed with usual row, column + -- Package call is ugly because of many parameters of MAMA + + 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. + + aRow : (M, PI) -> M + ++ \spad{aRow} returns a single row out of a matrix. + ++ The row is put into a one by N matrix. + + rows : (M, LPI) -> M + ++ \spad{rows} returns several rows out of a matrix. + ++ The rows are stacked into a matrix. + + rows : (M, SPI) -> M + ++ \spad{rows} returns several rows out of a matrix. + ++ The rows are stacked into a matrix. + + aColumn : (M, PI) -> M + ++ \spad{aColumn} returns a single column out of a matrix. + ++ The column is put into a one by N matrix. + + columns : (M, LPI) -> M + ++ \spad{columns} returns several columns out of a matrix. + ++ The columns are stacked into a matrix. + + columns : (M, SPI) -> M + ++ \spad{columns} returns several columns out of a matrix. + ++ The columns are stacked into a matrix. + + subMatrix : (M, LPI, LPI) -> M + ++ \spad{subMatrix} returns several elements out of a matrix. + ++ The elements are stacked into a submatrix. + + subMatrix : (M, SPI, SPI) -> M + ++ \spad{subMatrix} returns several elements out of a matrix. + ++ The elements are stacked into a submatrix. + + 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. + + 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. + + 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. + + 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. + + -- Stacking matrices + + horizConcat : (List M) -> M + ++ \spad{horizConcat} concatenates matrices column wise. + + vertConcat : (List M) -> M + ++ \spad{vertConcat} concatenates matrices row wise. + + 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}. + + -- Splitting matrices + + vertSplit : (M, PI) -> List M + ++ \spad{vertSplit} splits a matrix into multiple + ++ submatrices row wise. + + vertSplit : (M, LPI) -> List M + ++ \spad{vertSplit} splits a matrix into multiple + ++ submatrices row wise. + + horizSplit : (M, PI) -> List M + ++ \spad{horizSplit} splits a matrix into multiple + ++ submatrices column wise. + + horizSplit : (M, LPI) -> List M + ++ \spad{horizSplit} splits a matrix into multiple + ++ submatrices column wise. + + blockSplit : (M, PI, PI) -> List List M + ++ \spad{blockSplit} splits a matrix into multiple + ++ submatrices row and column wise, dividing + ++ a matrix into blocks. + + blockSplit : (M, LPI, PI) -> List List M + ++ \spad{blockSplit} splits a matrix into multiple + ++ submatrices row and column wise, dividing + ++ a matrix into blocks. + + blockSplit : (M, PI, LPI) -> List List M + ++ \spad{blockSplit} splits a matrix into multiple + ++ submatrices row and column wise, dividing + ++ a matrix into blocks. + + blockSplit : (M, LPI, LPI) -> List List M + ++ \spad{blockSplit} splits a matrix into multiple + ++ submatrices row and column wise, dividing + ++ a matrix into blocks. + + Implementation ==> add + + minr ==> minRowIndex + maxr ==> maxRowIndex + minc ==> minColIndex + maxc ==> maxColIndex + + -- Custom function to expand Segment(PositiveInteger) into + -- List(PositiveInteger). This operation is not supported by the + -- overly restrictive library implementation. + expand(spi : SPI) : LPI == + lr := empty()$LPI + l : PI := lo spi + h : PI := hi spi + inc : I := incr spi + zero? inc => error "Cannot expand a segment with an increment of zero" + if inc > 0 then + while l <= h repeat + lr := concat(l, lr) + l := (l + inc) pretend PI + else + while l >= h repeat + lr := concat(l, lr) + l := (l + inc) pretend PI + reverse! lr + + element(A, r, c) == + matrix([[A(r,c)]]) + + aRow(A:M, r:PI) : M == + subMatrix(A, r, r, minc A, maxc A) + + rows(A:M, lst:LPI) : M == + ls := [aRow(A, r) for r in lst] + reduce(vertConcat, ls) + + rows(A:M, si:SPI) : M == + rows(A, expand(si)) + + aColumn(A:M, c:PI) : M == + subMatrix(A, minr A, maxr A, c, c) + + columns(A:M, lst:LPI) : M == + ls := [aColumn(A,c) for c in lst] + reduce(horizConcat, ls) + + columns(A:M, si:SPI) : M == + columns(A, expand(si)) + + diagonalMatrix(A, n) == + nr := nrows(A) + nc := ncols(A) + n > (nc-1) => error "requested diagonal out of range" + n < 0 and abs(n) > (nr-1) => error "requested diagonal out of range" + B := zero(nr,nc) + if n >= 0 then + dl := min(nc-n, nr) + sr := minr(A) + sc := minc(A) + n + else + dl := min(nc, nr-abs(n)) + sr := minr(A) + abs(n) + sc := minc(A) + for i in 0..(dl-1) repeat + qsetelt!(B, sr+i, sc+i, A(sr+i, sc+i)) + B + + diagonalMatrix(A) == + diagonalMatrix(A, 0) + + bandMatrix(A:M, ln:LI) : M == + -- Really inefficient + reduce("+", [diagonalMatrix(A,d) for d in ln]) + + bandMatrix(A:M, si:SI) : M == + bandMatrix(A, expand(si)) + + subMatrix(A:M, lr:LPI, lc:LPI) : M == + -- Really inefficient + lle := [[ element(A,r,c) for c in lc] for r in lr] + blockConcat(lle) + + subMatrix(A:M, sr:SPI, sc:SPI) : M == + subMatrix(A, low sr, high sr, low sc, high sc) + + -- Stack matrices + + horizConcat(LA) == + reduce(horizConcat, LA) + + vertConcat(LA) == + reduce(vertConcat, LA) + + blockConcat(LLA: List List M) : M == + reduce(vertConcat, [reduce(horizConcat, LA) for LA in LLA]) + + -- Split matrices + + vertSplit(A:M, r:PI) : List M == + dr := nrows(A) exquo r + dr case "failed" => error "split does not result in an equal division" + mir := minr A + mic := minc A + mac := maxc A + [ subMatrix(A, mir+i*dr, mir+(i+1)*dr-1, mic, mac) for i in 0..(r-1) ] + + vertSplit(A:M, lr:LPI) : List M == + reduce("+", lr) ~= nrows(A) => _ + error "split does not result in proper partition" + l : List PI := cons(1, scan(_+, lr, 1$PI)$ListFunctions2(PI,PI)) + mir := minr(A) -1 -- additional shift because l starts at 1 + mic := minc A + mac := maxc A + result := _ + [ subMatrix(A, mir+l(i-1), mir+l(i)-1, mic, mac) for i in 2..#l ] + + horizSplit(A:M, c:PI) : List M == + dc := ncols(A) exquo c + dc case "failed" => error "split does not result in an equal division" + mir := minr A + mar := maxr A + mic := minc A + [ subMatrix(A, mir, mar, mic+i*dc, mic+(i+1)*dc-1) for i in 0..(c-1) ] + + horizSplit(A:M, lc:LPI) : List M == + reduce("+", lc) ~= ncols(A) => _ + error "split does not result in proper partition" + l : List PI := cons(1, scan(_+, lc, 1$PI)$ListFunctions2(PI,PI)) + mir := minr A + mar := maxr A + mic := minc(A) -1 -- additional shift because l starts at 1 + result := _ + [ subMatrix(A, mir, mar, mic+l(i-1), mic+l(i)-1) for i in 2..#l ] + + blockSplit(A:M, nr:PI, nc:PI) : List List M == + [ horizSplit(X, nc) for X in vertSplit(A, nr) ] + + blockSplit(A:M, lr:LPI, nc:PI) : List List M == + [ horizSplit(X, nc) for X in vertSplit(A, lr) ] + + blockSplit(A:M, nr:PI, lc:LPI) : List List M == + [ horizSplit(X, lc) for X in vertSplit(A, nr) ] + + blockSplit(A:M, lr:LPI, lc:LPI) : List List M == + [ horizSplit(X, lc) for X in vertSplit(A, lr) ] + +\end{chunk} +\begin{chunk}{MAMA.dotabb} +"MAMA" [color="#FF4488",href="bookvol10.4.pdf#nameddest=MAMA"] +"MATCAT" [color="#4488FF",href="bookvol10.2.pdf#nameddest=MATCAT"] +"MAMA" -> "MATCAT" + +\end{chunk} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{package MTHING MergeThing} \begin{chunk}{MergeThing.input} )set break resume @@ -173909,6 +174990,7 @@ ZeroDimensionalSolvePackage(R,ls,ls2): Exports == Implementation where \getchunk{package MATCAT2 MatrixCategoryFunctions2} \getchunk{package MCDEN MatrixCommonDenominator} \getchunk{package MATLIN MatrixLinearAlgebraFunctions} +\getchunk{package MAMA MatrixManipulation} \getchunk{package MTHING MergeThing} \getchunk{package MESH MeshCreationRoutinesForThreeDimensions} \getchunk{package MDDFACT ModularDistinctDegreeFactorizer} diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index a9e9008..187deb4 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -97,15 +97,16 @@ of effort. We would like to acknowledge and thank the following people: "An alphabetical listing of contributors to AXIOM:" "Michael Albaugh Cyril Alberga Roy Adler" "Christian Aistleitner Richard Anderson George Andrews" -"S.J. Atkins" +"S.J. Atkins" "Henry Baker Martin Baker Stephen Balzac" "Yurij Baransky David R. Barton Gerald Baumgartner" "Gilbert Baumslag Michael Becker Nelson H. F. Beebe" "Jay Belanger David Bindel Fred Blair" -"Vladimir Bondarenko Mark Botch Alexandre Bouyer" -"Karen Braman Peter A. Broadbery Martin Brock" -"Manuel Bronstein Stephen Buchwald Florian Bundschuh" -"Luanne Burns William Burge Ralph Byers" +"Vladimir Bondarenko Mark Botch Raoul Bourquin" +"Alexandre Bouyer Karen Braman Peter A. Broadbery" +"Martin Brock Manuel Bronstein Stephen Buchwald" +"Florian Bundschuh Luanne Burns William Burge" +"Ralph Byers" "Quentin Carpent Robert Caviness Bruce Char" "Ondrej Certik Tzu-Yi Chen Cheekai Chin" "David V. Chudnovsky Gregory V. Chudnovsky Mark Clements" @@ -127,7 +128,7 @@ of effort. We would like to acknowledge and thank the following people: "Korrinn Fu" "Marc Gaetano Rudiger Gebauer Van de Geijn" "Kathy Gerber Patricia Gianni Samantha Goldrich" -"Holger Gollan Teresa Gomez-Diaz Laureano Gonzalez-Vega" +"Holger Gollan Teresa Gomez-Diaz Laureano Gonzalez-Vega" "Stephen Gortler Johannes Grabmeier Matt Grayson" "Klaus Ebbe Grue James Griesmer Vladimir Grinberg" "Oswald Gschnitzer Ming Gu Jocelyn Guidry" @@ -24439,6 +24440,7 @@ otherwise the new algebra won't be loaded by the interpreter when needed. (|MatrixCategoryFunctions2| . MATCAT2) (|MatrixCommonDenominator| . MCDEN) (|MatrixLinearAlgebraFunctions| . MATLIN) + (|MatrixManipulation| . MAMA) (|MergeThing| . MTHING) (|ModularDistinctDegreeFactorizer| . MDDFACT) (|ModuleOperator| . MODOP) diff --git a/changelog b/changelog index e4171b0..646158d 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,9 @@ +20130318 rxb src/axiom-website/patches.html 20130318.01.rxb.patch +20130318 rxb src/algebra/Makefile add MatrixManipulation +20130318 rxb books/bookvol5 expose MatrixManipulation, add Raoul Bourquin +20130318 rxb books/bookvol10.4 add MatrixManipulation, add Raoul Bourquin +20130318 rxb readme add Raoul Bourquin +20130318 rxb Raoul Bourquin 20130317 tpd src/axiom-website/patches.html 20130317.07.tpd.patch 20130317 tpd buglist fix multiple typos 20130317 tpd books/bookvol10.2 fix multiple typos diff --git a/readme b/readme index 9baeb5f..0b14d3a 100644 --- a/readme +++ b/readme @@ -190,15 +190,16 @@ at the axiom command prompt will prettyprint the list. "An alphabetical listing of contributors to AXIOM:" "Michael Albaugh Cyril Alberga Roy Adler" "Christian Aistleitner Richard Anderson George Andrews" -"S.J. Atkins" +"S.J. Atkins" "Henry Baker Martin Baker Stephen Balzac" "Yurij Baransky David R. Barton Gerald Baumgartner" "Gilbert Baumslag Michael Becker Nelson H. F. Beebe" "Jay Belanger David Bindel Fred Blair" -"Vladimir Bondarenko Mark Botch Alexandre Bouyer" -"Karen Braman Peter A. Broadbery Martin Brock" -"Manuel Bronstein Stephen Buchwald Florian Bundschuh" -"Luanne Burns William Burge Ralph Byers" +"Vladimir Bondarenko Mark Botch Raoul Bourquin" +"Alexandre Bouyer Karen Braman Peter A. Broadbery" +"Martin Brock Manuel Bronstein Stephen Buchwald" +"Florian Bundschuh Luanne Burns William Burge" +"Ralph Byers" "Quentin Carpent Robert Caviness Bruce Char" "Ondrej Certik Tzu-Yi Chen Cheekai Chin" "David V. Chudnovsky Gregory V. Chudnovsky Mark Clements" @@ -220,7 +221,7 @@ at the axiom command prompt will prettyprint the list. "Korrinn Fu" "Marc Gaetano Rudiger Gebauer Van de Geijn" "Kathy Gerber Patricia Gianni Samantha Goldrich" -"Holger Gollan Teresa Gomez-Diaz Laureano Gonzalez-Vega" +"Holger Gollan Teresa Gomez-Diaz Laureano Gonzalez-Vega" "Stephen Gortler Johannes Grabmeier Matt Grayson" "Klaus Ebbe Grue James Griesmer Vladimir Grinberg" "Oswald Gschnitzer Ming Gu Jocelyn Guidry" diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index 31d3b40..6811bd9 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -1222,7 +1222,7 @@ LAYER2=\ "ABELGRP" -> "LMODULE/SGROUP" /*"ABELGRP" -> "INT"*/ -"ABELGRP-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=ABELGRP-", +"ABELGRP-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=ABELGRP", shape=ellipse] /*"ABELGRP-" -> {"CABMON"; "ABELMON"; "ABELSG"; "SETCAT"; "BASTYPE"}*/ /*"ABELGRP-" -> {"KOERCE"; "RING"; "RNG"; "SGROUP"; "MONOID"}*/ @@ -1236,7 +1236,7 @@ LAYER2=\ "ABELMON" -> "LMODULE/SGROUP" /*"ABELMON" -> {"NNI"; "INT"}*/ -"ABELMON-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=ABELMON-", +"ABELMON-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=ABELMON", shape=ellipse] /*"ABELMON-" -> {"ABELSG"; "SETCAT"; "BASTYPE"; "KOERCE"; "RING"; "RNG"}*/ /*"ABELMON-" -> {"ABELGRP"; "CABMON"; "SGROUP"; "MONOID"}*/ @@ -1311,7 +1311,7 @@ LAYER2=\ "DIFRING" -> "LMODULE/SGROUP" /*"DIFRING" -> {"SINT"; "NNI"; "INT"}*/ -"DIFRING-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=DIFRING-", +"DIFRING-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=DIFRING", shape=ellipse] /*"DIFRING-" -> {"RING"; "RNG"; "ABELGRP"; "CABMON"; "ABELMON"; "ABELSG"}*/ /*"DIFRING-" -> {"SETCAT"; "BASTYPE"; "KOERCE"; "SGROUP"; "MONOID"}*/ @@ -2825,7 +2825,7 @@ LAYER7=\ /*"CLAGG" -> {"ORDSET"; "ELAGG"; "OM"; "INT"; "LIST"; "ILIST"; "NNI"}*/ /*"CLAGG" -> {"BOOLEAN"; "LSAGG-"; "STAGG-"; "ELAGG-"}*/ -"CLAGG-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=CLAGG-", +"CLAGG-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=CLAGG", shape=ellipse] /*"CLAGG-" -> {"HOAGG"; "AGG"; "TYPE"; "SETCAT"; "BASTYPE"; "KOERCE"}*/ /*"CLAGG-" -> {"EVALAB"; "IEVALAB"; "KONVERT"; "LSAGG"; "STAGG"; "URAGG"}*/ @@ -4896,7 +4896,7 @@ LAYER9=\ ${OUT}/DIRPROD2.o ${OUT}/IMATRIX.o ${OUT}/INTRVL.o \ ${OUT}/IVECTOR.o ${OUT}/LOCPOWC.o \ ${OUT}/LODO1.o ${OUT}/LODO2.o ${OUT}/LPOLY.o \ - ${OUT}/LSMP.o ${OUT}/LSMP1.o ${OUT}/MATCAT2.o \ + ${OUT}/LSMP.o ${OUT}/LSMP1.o ${OUT}/MAMA.o ${OUT}/MATCAT2.o \ ${OUT}/PROJPL.o ${OUT}/PTCAT.o ${OUT}/STRICAT.o ${OUT}/TRIMAT.o \ ${OUT}/U8MAT.o ${OUT}/U16MAT.o ${OUT}/U32MAT.o \ layer9done @@ -5080,6 +5080,23 @@ LAYER9=\ /*"LSMP1" -> {"TYPE"; "EVALAB"; "IEVALAB"; "ELTAGG"; "ELTAB"; "CLAGG"}*/ /*"LSMP1" -> {"KONVERT"; "ORDSET"}*/ +"MAMA" [color="#FF4488",href="bookvol10.4.pdf#nameddest=MAMA"] +/*"MAMA" -> {"FIELD", "EUCDOM", "PID", "GCDDOM", "INTDOM", "COMRING"}*/ +/*"MAMA" -> {"RING", "RNG", "ABELGRP", "CABMON", "ABELMON", "ABELSG"}*/ +/*"MAMA" -> {"SETCAT", "BASTYPE", "KOERCE", "SGROUP", "MONOID"}*/ +/*"MAMA" -> {"LMODULE", "BMODULE", "RMODULE", "ALGEBRA", "MODULE"}*/ +/*"MAMA" -> {"ENTIRER", "UFD", "DIVRING", "FLAGG", "LNAGG", "IXAGG"}*/ +/*"MAMA" -> {"HOAGG", "AGG", "TYPE", "EVALAB", "IEVALAB", "ELTAGG"}*/ +/*"MAMA" -> {"ELTAB", "CLAGG", "KONVERT", "ORDSET"}*/ +"MAMA" -> "MATCAT" +/*"MAMA" -> {"ARR2CAT", "INT", "LIST", "ILIST", "NNI", "PI", "BOOLEAN"}*/ +/*"MAMA" -> {"LSAGG", "STAGG", "URAGG", "RCAGG", "ELAGG", "OM", "LSAGG-"}*/ +/*"MAMA" -> {"SINT", "INS", "OINTDOM", "ORDRING", "OAGROUP", "OCAMON"}*/ +/*"MAMA" -> {"OAMON", "OASGP", "DIFRING", "RETRACT", "LINEXP", "PATMAB"}*/ +/*"MAMA" -> {"CFCAT", "REAL", "CHARZ", "STEP", "MONOID-", "ABELMON-"}*/ +/*"MAMA" -> {"ORDSET-", "SGROUP-", "ABELSG-", "SETCAT-", "BASTYPE-"}*/ +/*"MAMA" -> {"STAGG-"}*/ + "MATCAT2" [color="#FF4488",href="bookvol10.4.pdf#nameddest=MATCAT2"] /*"MATCAT2" -> {"RING"; "RING"; "RNG"; "ABELGRP"; "CABMON"; "ABELMON"}*/ /*"MATCAT2" -> {"ABELSG"; "SETCAT"; "BASTYPE"; "KOERCE"; "SGROUP"; "MONOID"}*/ @@ -6312,7 +6329,7 @@ LAYER11=\ "DIVRING" -> "PFECAT" /*"DIVRING" -> "INT"*/ -"DIVRING-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=DIVRING-", +"DIVRING-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=DIVRING", shape=ellipse] /*"DIVRING-" -> {"INS"; "UFD"; "GCDDOM"; "INTDOM"; "COMRING"}*/ /*"DIVRING-" -> {"RING"; "RNG"; "ABELGRP"; "CABMON"; "ABELMON"}*/ @@ -11413,7 +11430,7 @@ LAYER16=\ /*"ES" -> {"OM"; "PATAB"; "ILIST"; "LSAGG-"; "STAGG-"; "ELAGG-"; "NNI"}*/ /*"ES" -> {"PATMAB"; "URAGG-"}*/ -"ES-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=ES-", +"ES-" [color="#88FF44",href="bookvol10.3.pdf#nameddest=ES", shape=ellipse] /*"ES-" -> {"ES"; "ORDSET"; "SETCAT"; "BASTYPE"; "KOERCE"; "RETRACT"}*/ /*"ES-" -> {"IEVALAB"; "EVALAB"; "CACHSET"; "SYMBOL"; "INT"; "REF"}*/ @@ -18358,6 +18375,7 @@ REGRESS= \ MatrixCategoryFunctions2.regress \ MatrixCommonDenominator.regress \ MatrixLinearAlgebraFunctions.regress \ + MatrixManipulation.regress \ MergeThing.regress \ MeshCreationRoutinesForThreeDimensions.regress \ ModMonic.regress \ diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 4c4d83c..f2149be 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -4099,5 +4099,7 @@ books/bookvol10.2 ORDSET fix 40346 books/bookvol10.2 REAL fix 40345 20130317.07.tpd.patch books/bookvol10.2 fix multiple typos +20130318.01.rxb.patch +books/bookvol10.4 add MatrixManipulation