Matrix Multiplication

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amitsoni.1984@gmail.com

    #1

    Matrix Multiplication

    Hi,

    Is there any direct function for matrix multiplication in Python or
    any of its packages? or do we have to multiply element by element?

    Thank you,
    Amit

  • Thomas Wittek

    #2
    Re: Matrix Multiplication

    amitsoni.1984@g mail.com:
    Is there any direct function for matrix multiplication in Python or
    any of its packages? or do we have to multiply element by element?
    First hit on google for "python matrix":


    --
    Thomas Wittek

    Jabber: streawkceur@jab ber.i-pobox.net

    Comment

    • sturlamolden

      #3
      Re: Matrix Multiplication

      On Jun 17, 10:52 pm, "amitsoni.1...@ gmail.com" <amitsoni.
      1...@gmail.comw rote:
      Hi,
      >
      Is there any direct function for matrix multiplication in Python or
      any of its packages? or do we have to multiply element by element?
      Use numpy: www.scipy.org

      NumPy has a matrix type that overloads the * operator.



      Comment

      • Jeremy Sanders

        #4
        Re: Matrix Multiplication

        sturlamolden wrote:
        Use numpy: www.scipy.org
        >
        NumPy has a matrix type that overloads the * operator.
        Just a tiny followup, which may be important unless you carefully read the
        documentation. The "*" operator doesn't do matrix multiplication for normal
        numpy arrays - you do need to use its special matrix type to get this. You
        can use the dot function to get matrix multiplication with its normal
        arrays.

        Jeremy

        --
        Jeremy Sanders

        Comment

        • Will McGugan

          #5
          Re: Matrix Multiplication

          amitsoni.1984@g mail.com wrote:
          Hi,
          >
          Is there any direct function for matrix multiplication in Python or
          any of its packages? or do we have to multiply element by element?
          If you want a pure Python module for 4x4 matrices, then you may want to
          look at Game Objects



          Will McGugan
          --

          Comment

          • sturlamolden

            #6
            Re: Matrix Multiplication

            On Jun 18, 11:20 am, Jeremy Sanders <jeremy
            +complangpyt... @jeremysanders. netwrote:
            NumPy has a matrix type that overloads the * operator.
            Just a tiny followup, which may be important unless you carefully read the
            documentation. The "*" operator doesn't do matrix multiplication for normal
            numpy arrays

            That's what I wrote: "NumPy has a matrix type." It is called called
            numpy.matrix.

            I did not suggest using the array type numpy.array.

            Reading carefully is indeed important...







            Comment

            • Jeremy Sanders

              #7
              Re: Matrix Multiplication

              sturlamolden wrote:
              That's what I wrote: "NumPy has a matrix type." It is called called
              numpy.matrix.
              >
              I did not suggest using the array type numpy.array.
              >
              Reading carefully is indeed important...
              I know what you wrote and you are strictly correct. I was just clarifying it
              for a reader who may not have instantly realised that there were multiple
              array types in numpy (I didn't for a while), and could have wasted many
              hours and been discouraged.

              Explaining clearly is indeed important.

              --
              Jeremy Sanders

              Comment

              Working...