diff options
| -rw-r--r-- | python/analytics/tranche_functions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/python/analytics/tranche_functions.py b/python/analytics/tranche_functions.py index 9ccd0e63..8c02c46c 100644 --- a/python/analytics/tranche_functions.py +++ b/python/analytics/tranche_functions.py @@ -109,6 +109,13 @@ libloss.joint_default_averagerecov_distrib.argtypes = [ ndpointer('double', ndim=2, flags='F,writeable') ] +libloss.shockprob.restype = c_double +libloss.shockprob.argtypes = [ + c_double, + c_double, + c_double, + c_int] + def GHquad(n): Z, w = h_roots(n) return Z*np.sqrt(2), w/np.sqrt(np.pi) @@ -124,6 +131,9 @@ def fitprob(Z, w, rho, p0): libloss.fitprob(Z, w, byref(c_int(Z.size)), byref(c_double(rho)), byref(c_double(p0)), result) return result +def shockprob(p, rho, Z, give_log): + return libloss.shockprob(c_double(p), c_double(rho), c_double(Z), c_int(give_log)) + def BCloss_recov_dist(defaultprob, issuerweights, recov, rho, Z, w, Ngrid=101, defaultflag=False): L = np.zeros((Ngrid, defaultprob.shape[1]), order='F') R = np.zeros_like(L) |
