none
matrix reshape

    Question

  • How do I reshape a matrix? that is, assume I have a vector of length 9 and I would like to convert it into a matrix of size 3*3, what is the appropriate way of doing that?

     

    Thanks

    Saturday, December 17, 2011 5:45 AM

Answers

  • Disclaimer: I've just started working with Sho, but...

     

    >>> v1=DoubleArray.From(range(1,10)).T
    >>> v1
    [ 1.0000
      2.0000
      3.0000
      4.0000
      5.0000
      6.0000
      7.0000
      8.0000
      9.0000]
    >>> X=reshape(v1,3,3,0)
    >>> X
    [ 1.0000  4.0000  7.0000
      2.0000  5.0000  8.0000
      3.0000  6.0000  9.0000]

     

    • Marked as answer by r-g-b Monday, January 23, 2012 6:38 PM
    Thursday, December 22, 2011 8:58 PM