## re-define cPsi as psiFuncCached.
F0 <- function(x=1, .) rep.int(0, length(x))
F1 <- function(x=1, .) rep.int(1, length(x))
cPsi2 <- psiFuncCached(rho = function(x, .) x^2 / 2,
psi = function(x, .) x,
wgt = F1, Dwgt = F0, Dpsi = F1,
name = "classic (x^2/2)",
. = Inf ## dummy, need at least one parameter
)
stopifnot(all.equal(cPsi@Erho(), cPsi2@Erho()),
all.equal(cPsi@Epsi2(), cPsi2@Epsi2()),
all.equal(cPsi@EDpsi(), cPsi2@EDpsi()))
Run the code above in your browser using DataLab