473,240 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

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

Jun 17 '07 #1
6 16399
am***********@gmail.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":
http://matpy.sourceforge.net/

--
Thomas Wittek
http://gedankenkonstrukt.de/
Jabber: st*********@jabber.i-pobox.net
Jun 17 '07 #2
On Jun 17, 10:52 pm, "amitsoni.1...@gmail.com" <amitsoni.
1...@gmail.comwrote:
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.

Jun 17 '07 #3
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
http://www.jeremysanders.net/
Jun 18 '07 #4
am***********@gmail.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

http://code.google.com/p/gameobjects/

Will McGugan
--
http://www.willmcgugan.com
Jun 18 '07 #5
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...



Jun 18 '07 #6
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
http://www.jeremysanders.net/
Jun 19 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
15
by: christopher diggins | last post by:
Here is some code I wrote for Matrix multiplication for arbitrary dimensionality known at compile-time. I am curious how practical it is. For instance, is it common to know the dimensionality of...
3
by: robix | last post by:
Hi again. I'm now asking your help because of a smal problem i'm getting with my multiplication matrix code. I'll try to give you as many details as possible. My matrix structure: typedef...
14
by: amitnanda | last post by:
Hi Guys, I have a matrix multiplication program in C that multiplies two matrices. When their size is 3*3 or 800*800, the program runs fine. But above that size, I get a "segmentation fault"....
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
0
by: lituncse | last post by:
dear friends, i have come across a problem which is difficult to solve for me.it's about starssen's matrix multiplication.in general matrix multiplication we need 8 multiplications and 4 additions...
3
by: crazygrey | last post by:
Hello, I'm a newbie to C++ so excuse me if my question was trivial but it is important to me. I'm implementing a simple code to find the forward kinematics of a robot: #include "stdafx.h"...
1
by: Sozos | last post by:
Hi guys. I have a problem with writing the base case for the following matrix multiplication function I have implemented. Please help. #define index(i,j,power) (((i)<<(power))+(j)) void...
8
by: joegao1 | last post by:
can some one give me a hint? I want to program the code for matrix multiplication with as less arithmetical / multiplication operations as possible. my task is to calculate the matrix...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.