summaryrefslogtreecommitdiffstats
path: root/R
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2015-03-10 14:17:51 -0400
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2015-03-10 14:23:44 -0400
commit544eb106db66e859a0933244bf46624eab1ab555 (patch)
tree12649fe04b627dc0b01b9a30f43fe4260eab2b94 /R
parentc85640622f4686db60f3c6b469e007798f43ad53 (diff)
downloadlossdistrib-544eb106db66e859a0933244bf46624eab1ab555.tar.gz
fix lossdistrib_truncated
Diffstat (limited to 'R')
-rw-r--r--R/distrib.R8
1 files changed, 5 insertions, 3 deletions
diff --git a/R/distrib.R b/R/distrib.R
index 8b10394..277b324 100644
--- a/R/distrib.R
+++ b/R/distrib.R
@@ -294,10 +294,12 @@ lossdistCZ <- function(p, w, S, N, defaultflag=FALSE, rho, Z){
q = matrix(0, N, length(Z)))$q
}
-lossdistC.truncated <- function(p, w, S, N, T=N){
- ## C version of lossdistrib2, roughly 50 times faster
+lossdistC.truncated <- function(p, w, S, N, T=N, defaultflag=FALSE){
+ ## truncated version of lossdistrib
+ ## q[i] is 0 for i>=T
.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
+ as.double(w), as.double(S), as.integer(N), as.integer(T), as.logical(defaultflag),
+ q = double(N))$q
}
recovdistC <- function(dp, pp, w, S, N){