[Numpy-discussion] avoiding the matrix copy performance hit

Tim Hochberg tim.hochberg at cox.net
Wed Feb 15 09:15:02 CST 2006

Ed Schofield wrote:

>Travis Oliphant wrote:
>>I think I originally tried to make mat *not* return a copy, but this
>>actually broke code in SciPy.  So, I left the default as it was as a
>>copy on input.  There is an *asmatrix* command that does not return a
>All SciPy's unit tests actually pass with a default of copy=False in the
>matrix constructor.  So SciPy needn't be the blocker here.  I'd like to
>cast a vote for not copying by default, in the interests of efficiency
>and, as Bill Baxter argued, usefulness.
I would like to cast a vote for keeping the behaviour the same. Note that:

mat([[1,2,3], [3,4,5]])

will always create a copy of its data by necesesity. Which means that 
changing the default copy=False means that some data will be copied, 
while others will not be, potentially leading to subtle bugs. I strongly 
disaprove of this sort of inconstent behaviour (don't get me started on 

In this situation, people should just use asmatrix.


>-- Ed
>This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
>for problems?  Stop!  Download the new AJAX search engine that makes
>searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
>Numpy-discussion mailing list
>Numpy-discussion at lists.sourceforge.net

More information about the Numpy-discussion mailing list