[cig-commits] [commit] master: py: Change dtype of ibool to integer. (428a0e5)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Wed Jan 14 09:29:25 PST 2015
Repository : https://github.com/geodynamics/specfem1d
On branch : master
Link : https://github.com/geodynamics/specfem1d/compare/2ccfba13481e26296eebf034518cd31d2c727906...33b512de01491f2c70de206939855d95b22febf4
>---------------------------------------------------------------
commit 428a0e50478ac4f5049384aa61753d0eda7b5119
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date: Thu Jan 8 20:25:32 2015 -0500
py: Change dtype of ibool to integer.
It doesn't need to be floating point, and making it integral means ibool
can be used directly for indexing. Not having to convert the NumPy array
into a Python list creates a 1.86x speedup.
>---------------------------------------------------------------
428a0e50478ac4f5049384aa61753d0eda7b5119
Python_version/config.py | 2 +-
Python_version/specfem1d.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Python_version/config.py b/Python_version/config.py
index 35f2da8..e40ad52 100644
--- a/Python_version/config.py
+++ b/Python_version/config.py
@@ -147,7 +147,7 @@ class Parameter(object):
"""Returns a matrix A. A[element_number,GLL_considered] -> index in the
global array, if we work in axisym and that the element number is 0 the points
are GLJ points"""
- ibool = np.zeros((self.nSpec, self.nGLL), dtype='d')
+ ibool = np.zeros((self.nSpec, self.nGLL), dtype=np.intp)
for e in np.arange(self.nSpec):
for i in np.arange(self.nGLL):
ibool[e,i] = (self.nGLL - 1) * e + i
diff --git a/Python_version/specfem1d.py b/Python_version/specfem1d.py
index 76b5d0d..ae46b08 100755
--- a/Python_version/specfem1d.py
+++ b/Python_version/specfem1d.py
@@ -62,7 +62,7 @@ for it in np.arange(param.nts):
acc[:] = 0.
for e in np.arange(param.nSpec):
- acc[list(param.ibool[e,:])] -= np.dot(Ke[e,:,:],u[list(param.ibool[e,:])])
+ acc[param.ibool[e,:]] -= np.dot(Ke[e,:,:], u[param.ibool[e,:]])
acc[param.iSource] += source[it*param.dt]
# # Boundary conditions :
More information about the CIG-COMMITS
mailing list