aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--R/tranche_functions.R14
1 files changed, 7 insertions, 7 deletions
diff --git a/R/tranche_functions.R b/R/tranche_functions.R
index 49b1c218..6bea5143 100644
--- a/R/tranche_functions.R
+++ b/R/tranche_functions.R
@@ -235,7 +235,7 @@ lossdist.prepay.joint <- function(dp, pp, w, S, N, defaultflag=FALSE){
lossdistC <- function(p, w, S, N, defaultflag=FALSE){
## C version of lossdistrib2, roughly 50 times faster
if(!is.loaded("lossdistrib")){
- dyn.load(paste0("lossdistrib", .Platform$dynlib.ext))
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
.C("lossdistrib", as.double(p), as.integer(length(p)),
as.double(w), as.double(S), as.integer(N), as.logical(defaultflag), q = double(N))$q
@@ -244,9 +244,9 @@ lossdistC <- function(p, w, S, N, defaultflag=FALSE){
lossdistC.truncated <- function(p, w, S, N, T=N){
## C version of lossdistrib2, roughly 50 times faster
if(!is.loaded("lossdistrib_truncated")){
- dyn.load(paste0("lossdistrib", .Platform$dynlib.ext))
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
- dyn.load("lossdistrib.dll")
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
.C("lossdistrib_truncated", as.double(p), as.integer(length(p)),
as.double(w), as.double(S), as.integer(N), as.integer(T), q = double(T))$q
}
@@ -254,7 +254,7 @@ lossdistC.truncated <- function(p, w, S, N, T=N){
recovdistC <- function(dp, pp, w, S, N){
## C version of recovdist
if(!is.loaded("recovdist")){
- dyn.load(paste0("lossdistrib", .Platform$dynlib.ext))
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
.C("recovdist", as.double(dp), as.double(pp), as.integer(length(dp)),
as.double(w), as.double(S), as.integer(N), q = double(N))$q
@@ -263,7 +263,7 @@ recovdistC <- function(dp, pp, w, S, N){
lossdistC.joint <- function(p, w, S, N, defaultflag=FALSE){
## C version of lossdistrib.joint, roughly 20 times faster
if(!is.loaded("lossdistrib_joint")){
- dyn.load(paste0("lossdistrib", .Platform$dynlib.ext))
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
.C("lossdistrib_joint", as.double(p), as.integer(length(p)), as.double(w),
as.double(S), as.integer(N), as.logical(defaultflag), q = matrix(0, N, N))$q
@@ -272,7 +272,7 @@ lossdistC.joint <- function(p, w, S, N, defaultflag=FALSE){
lossdistC.prepay.joint <- function(dp, pp, w, S, N, defaultflag=FALSE){
## C version of lossdist.prepay.joint
if(!is.loaded("lossdistrib_prepay_joint")){
- dyn.load(paste0("lossdistrib", .Platform$dynlib.ext))
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
r <- .C("lossdistrib_prepay_joint", as.double(dp), as.double(pp), as.integer(length(dp)),
as.double(w), as.double(S), as.integer(N), as.logical(defaultflag), q=matrix(0, N, N))$q
@@ -553,7 +553,7 @@ BClossdist <- function(SurvProb, issuerweights, recov, rho, N=length(recov)+1,
BClossdistC <- function(SurvProb, issuerweights, recov, rho,
N=length(issuerweights)+1, n.int=100, defaultflag){
if(!is.loaded("BClossdist")){
- dyn.load(paste0("lossdistrib", .Platform$dynlib.ext))
+ dyn.load(file.path(root.dir, "code", "R", paste0("lossdistrib", .Platform$dynlib.ext)))
}
quadrature <- gauss.quad.prob(n.int, "normal")
Z <- quadrature$nodes