Skip to content

Commit

Permalink
Merge pull request #21 from lukesonnet/lukesonnet/refactor
Browse files Browse the repository at this point in the history
Restructure CPP files; rewrite inference
  • Loading branch information
lukesonnet authored Feb 11, 2018
2 parents 37f2384 + 08b1073 commit 918ebaa
Show file tree
Hide file tree
Showing 20 changed files with 809 additions and 732 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ src/deprecated
^\.travis\.yml$
^appveyor\.yml$
^tests/testthat/test_krlogit_fns\.R$
^tests/testthat/test_old_krls\.R$
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ matrix:

r_packages:
- numDeriv
- KRLS

r_github_packages:
- r-lib/covr
Expand Down
20 changes: 2 additions & 18 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
# Generated by roxygen2: do not edit by hand

S3method(plot,krls2)
S3method(predict,krls2)
export(Ktrunc)
export(bsearch)
export(chunk)
export(euc_dist)
export(fdskrls)
export(generateK)
export(getDhat)
export(inference.krls2)
export(kern_gauss)
export(kern_gauss_1d)
export(krlogit_fn_trunc)
export(krlogit_gr_trunc)
export(krlogit_hess_trunc_inv)
export(krls)
export(krls_gr_trunc)
export(krls_hess_trunc_inv)
export(lambdab.fn)
export(lambdabsearch)
export(lambdaline)
export(lambdasearch)
export(logistic)
export(looloss)
export(mult_diag)
export(newKernel)
export(new_gauss_kern)
export(partial_logit)
export(predict.krls2)
export(pwmfx)
export(pwmfx_novar)
export(solveForDOptim)
export(solve_for_d_ls)
export(solve_for_d_ls_w)
export(summary.krls2)
export(trace_mat)
import(RSpectra)
importFrom(Rcpp,sourceCpp)
importFrom(grDevices,devAskNewPage)
Expand All @@ -44,6 +27,7 @@ importFrom(graphics,plot)
importFrom(stats,as.formula)
importFrom(stats,optim)
importFrom(stats,optimize)
importFrom(stats,plogis)
importFrom(stats,predict)
importFrom(stats,pt)
importFrom(stats,quantile)
Expand Down
44 changes: 12 additions & 32 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,83 +1,63 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @export
mult_diag <- function(x, d) {
.Call(`_KRLS2_mult_diag`, x, d)
}

#' @export
trace_mat <- function(x) {
.Call(`_KRLS2_trace_mat`, x)
}

#' @export
krls_gr_trunc <- function(U, D, y, w, fitted, dhat, lambda) {
.Call(`_KRLS2_krls_gr_trunc`, U, D, y, w, fitted, dhat, lambda)
}

#' @export
krls_hess_trunc_inv <- function(U, D, w, lambda) {
.Call(`_KRLS2_krls_hess_trunc_inv`, U, D, w, lambda)
}

#' @export
krlogit_fn_trunc <- function(par, U, D, y, w, lambda) {
.Call(`_KRLS2_krlogit_fn_trunc`, par, U, D, y, w, lambda)
}

#' @export
krlogit_gr_trunc <- function(par, U, D, y, w, lambda) {
.Call(`_KRLS2_krlogit_gr_trunc`, par, U, D, y, w, lambda)
}

#' @export
partial_logit <- function(K, coef, beta0) {
.Call(`_KRLS2_partial_logit`, K, coef, beta0)
}

#' @export
krlogit_hess_trunc_inv <- function(par, U, D, y, w, lambda) {
.Call(`_KRLS2_krlogit_hess_trunc_inv`, par, U, D, y, w, lambda)
}

#' @export
mult_diag <- function(x, d) {
.Call(`_KRLS2_mult_diag`, x, d)
}

trace_mat <- function(x) {
.Call(`_KRLS2_trace_mat`, x)
}

euc_dist <- function(x1, x2) {
.Call(`_KRLS2_euc_dist`, x1, x2)
}

#' @export
kern_gauss_1d <- function(x1, x2, b) {
.Call(`_KRLS2_kern_gauss_1d`, x1, x2, b)
}

#' @export
kern_gauss <- function(x, b) {
.Call(`_KRLS2_kern_gauss`, x, b)
}

#' @export
new_gauss_kern <- function(newx, oldx, b) {
.Call(`_KRLS2_new_gauss_kern`, newx, oldx, b)
}

#' @export
pwmfx <- function(k, x, coefhat, vcovc_mat, p, p2, b) {
.Call(`_KRLS2_pwmfx`, k, x, coefhat, vcovc_mat, p, p2, b)
}

solve_for_d_ls <- function(y, U, D, lambda) {
.Call(`_KRLS2_solve_for_d_ls`, y, U, D, lambda)
}

#' @export
solve_for_d_ls_w <- function(y, U, D, w, lambda) {
.Call(`_KRLS2_solve_for_d_ls_w`, y, U, D, w, lambda)
}

#' @export
pwmfx <- function(k, x, coefhat, vcovc, p, b) {
.Call(`_KRLS2_pwmfx`, k, x, coefhat, vcovc, p, b)
}

#' @export
pwmfx_novar <- function(k, x, coefhat, p, b) {
.Call(`_KRLS2_pwmfx_novar`, k, x, coefhat, p, b)
}

Loading

0 comments on commit 918ebaa

Please sign in to comment.