From 544eb106db66e859a0933244bf46624eab1ab555 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Tue, 10 Mar 2015 14:17:51 -0400 Subject: fix lossdistrib_truncated --- R/distrib.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'R/distrib.R') 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){ -- cgit v1.2.3-70-g09d2