diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2017-11-17 15:59:52 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2017-11-17 17:23:40 -0500 |
| commit | a972241805699489b2d827a95f65ee9ebb9551b0 (patch) | |
| tree | 26528c4ab5eded63e57892afcc6b460814d26535 | |
| parent | a05f8b80149ee9c8f0cb402d5649f83dcccdd55d (diff) | |
| download | pyisda-a972241805699489b2d827a95f65ee9ebb9551b0.tar.gz | |
slightly faster
| -rw-r--r-- | pyisda/credit_index.pyx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pyisda/credit_index.pyx b/pyisda/credit_index.pyx index 8bfc769..ab78ce7 100644 --- a/pyisda/credit_index.pyx +++ b/pyisda/credit_index.pyx @@ -16,10 +16,13 @@ from cdsone cimport JpmcdsStringToStubMethod, TStubMethod from date cimport ACT_365F cimport numpy as np np.import_array() +import numpy as np import pandas as pd cdef class CurveList: - def __init__(self, list curves, double[:] weights=None): + + @cython.initializedcheck(False) + def __init__(self, list curves not None, double[:] weights=None): cdef: SpreadCurve sc size_t i @@ -91,8 +94,8 @@ cdef class CurveList: @property def weights(self): cdef np.npy_intp shape = self.weights.size() - cdef np.ndarray[np.float64_t] out = \ - np.PyArray_SimpleNewFromData(1, &shape, np.NPY_DOUBLE, self.weights.data()) + cdef np.ndarray out = \ + np.PyArray_SimpleNewFromData(1, &shape, np.NPY_DOUBLE, self.weights.data()) out.base = <PyObject*>self Py_INCREF(self) return out @@ -116,7 +119,7 @@ cdef class CurveList: return r @curves.setter - def curves(self, list l): + def curves(self, list l not None): cdef: size_t len_l = len(l) size_t i |
