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

    samedi 17 décembre 2011 05:45

Réponses

  • 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]

     

    • Marqué comme réponse r-g-b lundi 23 janvier 2012 18:38
    jeudi 22 décembre 2011 20:58