aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/tranche_functions.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/python/tranche_functions.py b/python/tranche_functions.py
index d1297177..090e9072 100644
--- a/python/tranche_functions.py
+++ b/python/tranche_functions.py
@@ -4,6 +4,7 @@ from quantlib.time.schedule import Schedule, CDS
from quantlib.time.api import Actual360, Period, UnitedStates, Following, today
from quantlib.util.converter import qldate_to_pydate, pydate_to_qldate
import pandas as pd
+from scipy.special import h_roots
libloss = np.ctypeslib.load_library("lossdistrib", "/home/share/CorpCDOs/code/R/lossdistrib/src")
libloss.fitprob.restype = None
@@ -48,10 +49,8 @@ libgq.GHquad.argtypes = [c_int,
np.ctypeslib.ndpointer('double', ndim=1, flags='F'),
np.ctypeslib.ndpointer('double', ndim=1, flags='F')]
def GHquad(n):
- Z = np.zeros(n, dtype='double')
- w = np.zeros(n, dtype='double')
- libgq.GHquad(n, Z, w)
- return Z, w
+ Z, w = h_roots(n)
+ return Z*np.sqrt(2), w/np.sqrt(np.pi)
def stochasticrecov(R, Rtilde, Z, w, rho, porig, pmod):
q = np.zeros_like(Z)