It was my impression that he didn't want a matrix with matrix entries, but instead wanted the matrix whose entries were given by the entries of the submatrices.
--Mike On Jan 8, 2008 11:12 PM, William Stein <[EMAIL PROTECTED]> wrote: > > On Jan 8, 2008 11:05 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > > > > On Jan 9, 7:43 am, "William Stein" <[EMAIL PROTECTED]> wrote: > > > > > On Jan 8, 2008 4:27 AM, vgermrk <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > Is there a way to construct block matrices in SAGE? > > > > Not just the "block_sum", "augment" and "stack" functions. > > > > > > > As an example, let A, B, C, D be matrices and i want to construct a > > > > matrix like E=[[A,B],[C,D]] > > > > > > > Such a feature would be very nice. > > > > > > Sage's MatrixSpace and matrix don't have support for this. > > > numpy (which you get via "import numpy") might have support > > > for numerical matrices like this. > > > > CVXOPT also has support for this: > > http://abel.ee.ucla.edu/cvxopt/examples/short-examples/creating-matrices/ > > And, just to be clear, CVXOPT is standard in Sage. > > There are a number of caveats though. Currently you really have to switch > to python mode to create a cvxopt matrix in Sage, probably because of > preparser issues (see below). Also, more importantly, it looks to me > like making a matrix from matrices in CVXOPT does *not* make a matrix > with matrix entries, but instead makes a single matrix -- see below. > > > {{{id=0| > %python > > from cvxopt.base import matrix > A = matrix([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], (2,3)) > print A > /// > 1.0000e+00 3.0000e+00 5.0000e+00 > 2.0000e+00 4.0000e+00 6.0000e+00 > }}} > > {{{id=1| > %python > > B = matrix([ [1.0, 2.0], [3.0, 4.0] ]) > print B > /// > 1.0000e+00 3.0000e+00 > 2.0000e+00 4.0000e+00 > }}} > > {{{id=2| > %python > > a = matrix([ [A] ,[B] ]) > }}} > > {{{id=4| > print a > /// > 1.0000e+00 3.0000e+00 5.0000e+00 1.0000e+00 3.0000e+00 > 2.0000e+00 4.0000e+00 6.0000e+00 2.0000e+00 4.0000e+00 > > }}} > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---