Hello, There is also the block_matrix command which may also be of interest:
sage: m = matrix(ZZ, 2, 2, 1); m [1 0] [0 1] sage: block_matrix([0,m,m,0]) [0 0|1 0] [0 0|0 1] [---+---] [1 0|0 0] [0 1|0 0] sage: block_matrix([m,m], nrows=1) [1 0|1 0] [0 1|0 1] sage: block_matrix([m,m], ncols=1) [1 0] [0 1] [---] [1 0] [0 1] --Mike On Feb 1, 2008 2:38 PM, William Stein <[EMAIL PROTECTED]> wrote: > > On Feb 1, 2008 5:33 PM, VictorMiller <[EMAIL PROTECTED]> wrote: > > > > Magma has the useful functions VerticalJoin and HorizontalJoin to > > build matrices out of other matrices (numpy has similar functionality > > with concatenate). Is there something similar for a Sage Matrix? > > > > Yes. They are called "stack" and "augment" in Sage, and they > should work with any Sage matrix types. > > sage: a = random_matrix(ZZ, 2,3); b = random_matrix(ZZ, 2, 3) > sage: a.stack(b) > [-4 20 -4] > [-4 -4 3] > [-1 25 -8] > [ 1 -2 1] > sage: a.augment(b) > [-4 20 -4 -1 25 -8] > [-4 -4 3 1 -2 1] > > -- William > > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-forum URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
