[next][previous][up][top][index]
search for:

concatenating matrices

Sections:

  • concatenate horizontally
  • concatenate vertically
  • making block matrices
  • direct sum of matrices as maps between modules
  • concatenate horizontally

    Use |to concatenate two matrices horizontally.

    i1 : R = ZZ/32003[a..f];
    i2 : M = genericMatrix(R,a,3,2)

    o2 = | a d |
         | b e |
         | c f |

                 3       2
    o2 : Matrix R  <--- R
    i3 : N = matrix{{d^2,a*d},{b*c,b*d},{a,c}}

    o3 = | d2 ad |
         | bc bd |
         | a  c  |

                 3       2
    o3 : Matrix R  <--- R
    i4 : M|N

    o4 = | a d d2 ad |
         | b e bc bd |
         | c f a  c  |

                 3       4
    o4 : Matrix R  <--- R

    concatenate vertically

    Use ||to concatenate two matrices vertically.

    i5 : P = matrix{{d^2,a*d,e*f},{b*c,b*d,b*e},{a,c,d}}

    o5 = | d2 ad ef |
         | bc bd be |
         | a  c  d  |

                 3       3
    o5 : Matrix R  <--- R
    i6 : transpose(M)||P

    o6 = {-1} | a  b  c  |
         {-1} | d  e  f  |
         {0}  | d2 ad ef |
         {0}  | bc bd be |
         {0}  | a  c  d  |

                 5       3
    o6 : Matrix R  <--- R

    making block matrices

    The matrix function can take matrices as input as long as the sizes match up.

    i7 : matrix{{id_(R^3),M,P},{random(R^1,R^3),random(R^1,R^3),random(R^1,R^2)}}

    o7 = | 1     0    0    a     d     d2    ad     ef   |
         | 0     1    0    b     e     bc    bd     be   |
         | 0     0    1    c     f     a     c      d    |
         | -2136 9349 8735 -5609 -9489 13529 -15802 -371 |

                 4       8
    o7 : Matrix R  <--- R

    Also, the number input entries in each row must be equal. It might seem like we could form the same matrix with the input matrix{{id_(R^3),M,P},{random(R^1,R^8)}} since random(R^1,R^8) will construct a 1 by 8 matrix which has the same number of columns as matrix matrix{{id_(R^3),M,P}} but as input into the matrix function that row entry must have 3 entries.

    direct sum of matrices as maps between modules

    ++
    [next][previous][up][top][index]
    search for: