[yt-svn] commit/yt: ngoldbaum: Avoiding two unnecessary copies in YTArray.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Tue Jun 10 10:37:31 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/968ecd473b98/
Changeset:   968ecd473b98
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-06-10 06:25:28
Summary:     Avoiding two unnecessary copies in YTArray.
Affected #:  1 file

diff -r 4d2aec2f513d3146eb2675f6f0b7a1e396f55096 -r 968ecd473b98ac9e38514f844d013ffb46881f92 yt/units/yt_array.py
--- a/yt/units/yt_array.py
+++ b/yt/units/yt_array.py
@@ -955,7 +955,7 @@
         else:
             raise RuntimeError("Operation is not defined.")
         if unit is None:
-            out_arr = np.array(out_arr)
+            out_arr = np.array(out_arr, copy=False)
             return out_arr
         out_arr.units = unit
         if out_arr.size == 1:
@@ -965,7 +965,7 @@
                 # This happens if you do ndarray * YTQuantity. Explicitly
                 # casting to YTArray avoids creating a YTQuantity with size > 1
                 return YTArray(np.array(out_arr, unit))
-            return ret_class(np.array(out_arr), unit)
+            return ret_class(np.array(out_arr, copy=False), unit)
 
 
     def __reduce__(self):

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list