473,327 Members | 2,118 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,327 software developers and data experts.

Best form when using matrices and arrays in scipy...


Using large arrays of data I found it is MUCH faster to cast arrays to
matricies and then multiply the two matricies togther
(scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix
multipy of two arrays vs. scipy.matrixmultipy(ARRAY1, ARRAY2).

Are there any logical/efficiency errors with this train of thought and
is there a valid reason for the speed increase?

Thanks,
Conor

May 10 '06 #1
1 2678
co************@gmail.com wrote:
Using large arrays of data I found it is MUCH faster to cast arrays to
matricies and then multiply the two matricies togther
(scipy.matrix(ARRAY1)*scipy.matrix(ARRAY2)) in order to do a matrix
multipy of two arrays vs. scipy.matrixmultipy(ARRAY1, ARRAY2).

Are there any logical/efficiency errors with this train of thought and
is there a valid reason for the speed increase?


matrixmultiply is a backwards-compatibility alias. You should be using dot()
instead. When an optimized BLAS is available dot() is replaced with an optimized
version. numpy.matrix uses dot() to implement its multiplication operation.
Unfortunately, the code that does the replacement does not seem to handle
matrixmultiply correctly.

Also, there are better fora for asking questions about numpy and scipy:

http://www.scipy.org/Mailing_Lists

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

May 11 '06 #2

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

Similar topics

4
by: Kyler Laird | last post by:
I'm trying to do some georeferencing - using points of known location (ground control points, GCPs) on an image to develop a polynomial that can be used to approximate the locations of other...
1
by: Nils Wagner | last post by:
Hi all, Has someone written a C binding to transfer matrices from C to Python and vice versa ? Any pointer would be appreciated. Nils
4
by: David | last post by:
Hello. I am looking for advice on what is "best practice" regarding looping through a form to check its checkboxes and associated data fields. Here is what I am trying to do (Here is the page...
0
by: George Sakkis | last post by:
Is there any sparse matrix package compatible with Numeric/Numarray ? Ideally, the implementation of a matrix (dense/sparse) should be transparent to the application. However the APIs of the only...
5
by: Krish | last post by:
Hello People I hope I am On Topic. Anyways, here is my problem. Any insights would be really appreciated. I have wrapped a C IO module using SWIG -> Python Module. Suppose the name of the...
11
by: efrat | last post by:
Hello, I'm planning to use Python in order to teach a DSA (data structures and algorithms) course in an academic institute. If you could help out with the following questions, I'd sure...
3
by: mosi | last post by:
Python matrices are usually defined with numpy scipy array or similar. e.g. I would like to have easier way of defining matrices, for example: Any ideas how could this be done? The ";" sign...
5
by: adinda | last post by:
So what i need is this; (I'm very new at this,, programming in C I mean...) In matlab I had a while loop, and after each loop was done I added my resulting matrix to an object. Seeing the loop...
1
by: csgirlie | last post by:
I'm trying to store or arrange three sets of two-dimensional data into three 2xN matrices that are stored as NumPy arrays. import os # for file handling functions import numpy as...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.