This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Weibull_mix.cpp */ | |
#include <Rcpp.h> | |
using Rcpp::NumericVector; | |
/* Computes the survival probability of a Weibull mixture. No checks are | |
* made on the length of the input vectors. */ | |
// [[Rcpp::export]] | |
NumericVector Surv_Weibull_mix( | |
NumericVector const t, NumericVector const ps, NumericVector const gs, | |
NumericVector const ls){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### | |
# simple version which stores the indices in a full matrix and then copy | |
# them back later | |
f1 <- function(n){ | |
stopifnot(is.integer(n), n > 1L) | |
nq <- n * (n + 1L) / 2L | |
o <- matrix(0L, n, n) | |
o[lower.tri(o, diag = TRUE)] <- 1:nq | |
o[upper.tri(o)] <- t(o)[upper.tri(o)] |
NewerOlder