From 20b378876a27e833160d6d039f46c0e0723a4a48 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Fri, 25 Sep 2020 13:42:33 -0400 Subject: bugfix cl_pv wasn't initialized in the paralllel section --- pyisda/credit_index.pyx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 28bf0c1..32e6c56 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -482,11 +482,12 @@ cdef class CreditIndex(CurveList): double* recovery_rate with nogil: - cl = JpmcdsCdsContingentLegMake(self._start_date, + with parallel(): + cl = JpmcdsCdsContingentLegMake(self._start_date, maturity_c, 1., True) - with parallel(): + cl_pv = 0.0 for i in prange(self._curves.size()): sc = self._curves[i].get() recovery_rate = self.recovery_rates[i].get() @@ -502,7 +503,7 @@ cdef class CreditIndex(CurveList): deref(recovery_rate), &cl_pv) r += self._weights[i] * cl_pv - free(cl) + free(cl) return r def duration(self, step_in_date, cash_settle_date, maturity, YieldCurve yc not None): -- cgit v1.2.3-70-g09d2