diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2021-09-17 14:31:10 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2021-09-17 14:31:10 -0400 |
| commit | 60ea3e046ddc0942677a51c3b6688885d755df8b (patch) | |
| tree | d6a94bbfcafc3ba1646d3315fbb740da4bb576d6 | |
| parent | 2eef49e91679e84ca4b9d9d9f06d1cec6356f67c (diff) | |
| download | pyisda-60ea3e046ddc0942677a51c3b6688885d755df8b.tar.gz | |
pv is not defined in case of empty curves
- return NaN
- as a side effect, do not segfault when epsilon != 0
| -rw-r--r-- | pyisda/credit_index.pyx | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 2f90b01..0951f35 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -862,6 +862,8 @@ cdef double pv(const vector[shared_ptr[TCurve]]& curves, size_t i = 0 double* recovery_rate + if curves.size() == 0: + return nan("") if epsilon == 0.: with parallel(): fl_pv = 0. |
