diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2020-09-25 13:42:33 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2020-09-25 13:42:33 -0400 |
| commit | 20b378876a27e833160d6d039f46c0e0723a4a48 (patch) | |
| tree | 7561e8d751e87b835987aa5cf42a49da928ae797 | |
| parent | 2656a785c2f1b941e52787684a0609405dc8e8c3 (diff) | |
| download | pyisda-20b378876a27e833160d6d039f46c0e0723a4a48.tar.gz | |
bugfix cl_pv wasn't initialized in the paralllel section
| -rw-r--r-- | pyisda/credit_index.pyx | 7 |
1 files 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): |
