Skip to content

Commit

Permalink
Fix issue with sigmasq caching, fix dtype of inner product (gwastro#1347
Browse files Browse the repository at this point in the history
)

* enable sigmasq caching without sigmsq cumulative vector, fix dtype of inner product output

* remove unused variable
  • Loading branch information
ahnitz authored and spxiwh committed Jan 13, 2017
1 parent cbb1427 commit 36bbb9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions pycbc/types/array_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def weighted_inner(self, other, weight):
def inner_inline_real(self, other):
x = _np.array(self._data, copy=False)
y = _np.array(other, copy=False)
total = _np.array([0])
total = _np.array([0.], dtype=float64)
N = len(self)
inline(inner_code, ['x', 'y', 'total', 'N'], libraries=omp_libs,
extra_compile_args=code_flags)
Expand All @@ -139,12 +139,9 @@ def inner(self, other):
"""
cdtype = common_kind(self.dtype, other.dtype)
if cdtype.kind == 'c':
acum_dtype = complex128
return _np.sum(self.data.conj() * other, dtype=complex128)
else:
return inner_inline_real(self, other)
acum_dtype = float64
return _np.sum(self.data.conj() * other, dtype=acum_dtype)
#return _np.vdot(self.data, other)

def vdot(self, other):
""" Return the inner product of the array with complex conjugation.
Expand Down
2 changes: 1 addition & 1 deletion pycbc/waveform/bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def sigma_cached(self, psd):
if not hasattr(psd, 'invsqrt'):
psd.invsqrt = 1.0 / psd[self.sslice]

return self.sigma_view.inner(psd.invsqrt)
self._sigmasq[key] = self.sigma_view.inner(psd.invsqrt)
return self._sigmasq[key]

# dummy class needed for loading LIGOLW files
Expand Down

0 comments on commit 36bbb9a

Please sign in to comment.