diff options
| -rw-r--r-- | pyisda/credit_index.pyx | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index d38416f..2bbfe96 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -220,33 +220,32 @@ cdef class CurveList: CurveList.__init__(self, l) self.base_date = temp - def __deepcopy__(self, memo): - cdef: - CurveList copy = CurveList.__new__(CurveList) - char* buf - char* new_buf - TCurve* curve - int size - CurveName cn - uint16_t offset - copy.base_date = self.base_date - copy._weights = self._weights - copy.base_date = self.base_date - copy._curves.resize(self._curves.size()) - copy.offset_recovery_rates = self.offset_recovery_rates - for p in self.names: - buf = self._curves[p.second].get() - offset = p.first.name - buf - size = offset + p.first.size() - new_buf = <char*>malloc(size) - memcpy(new_buf, buf, size) - curve = <TCurve*>new_buf - curve.fArray = <TRatePt*>(new_buf + sizeof(TCurve)) - cn = CurveName(new_buf + offset) - copy._curves[p.second] = shared_ptr[char](new_buf, char_free) - copy.names[cn] = p.second - copy.tickers = self.tickers - return copy + # def __deepcopy__(self, memo): + # cdef: + # CurveList copy = CurveList.__new__(CurveList) + # char* buf + # char* new_buf + # TCurve* curve + # int size + # CurveName cn + # uint16_t offset + # copy.base_date = self.base_date + # copy._weights = self._weights + # copy._curves.resize(self._curves.size()) + # copy.defaulted = self.defaulted + # copy.offset_recovery_rates = self.offset_recovery_rates + # for p in self.names: + # buf = self._curves[p.second].get() + # offset = p.first.name - buf + # size = offset + p.first.size() + # new_buf = <char*>malloc(size) + # memcpy(new_buf, buf, size) + # curve = <TCurve*>new_buf + # curve.fArray = <TRatePt*>(new_buf + sizeof(TCurve)) + # cn = CurveName(new_buf + offset) + # copy._curves[p.second] = shared_ptr[char](new_buf, char_free) + # copy.names[cn] = p.second + # return copy def __reduce__(self): return (self.__class__, (self.curves, TDate_to_pydate(self.base_date))) @@ -331,7 +330,6 @@ cdef class CreditIndex(CurveList): for p in self.names: buf = self._curves[p.second].get() - n = (<TCurve*>buf).fNumItems offset = p.first.name - buf h ^= Hash64(buf, offset + p.first.size()) |
