Skip to content

Commit a0034d7

Browse files
Merge pull request #29 from jonathan-taylor/master
removing unused C code - the duplicate version of the C code has been removed - Rcpp exports are now in repo: if we change the wrapper cpp we will need to recommit these
2 parents bbf7e19 + 5e671a4 commit a0034d7

File tree

6 files changed

+73
-428
lines changed

6 files changed

+73
-428
lines changed

selectiveInference/R/RcppExports.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Rcpp::compileAttributes
2+
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3+
4+
solve_QP <- function(Sigma, bound, maxiter, theta, linear_func, gradient, ever_active, nactive, kkt_tol, objective_tol, max_active) {
5+
.Call('selectiveInference_solve_QP', PACKAGE = 'selectiveInference', Sigma, bound, maxiter, theta, linear_func, gradient, ever_active, nactive, kkt_tol, objective_tol, max_active)
6+
}
7+
8+
update1_ <- function(Q2, w, m, k) {
9+
.Call('selectiveInference_update1_', PACKAGE = 'selectiveInference', Q2, w, m, k)
10+
}
11+
12+
downdate1_ <- function(Q1, R, j0, m, n) {
13+
.Call('selectiveInference_downdate1_', PACKAGE = 'selectiveInference', Q1, R, j0, m, n)
14+
}
15+

selectiveInference/src/Makevars

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PKG_CFLAGS= -I.
22
PKG_CPPFLAGS= -I.
33
PKG_LIBS=-L.
44

5-
$(SHLIB): Rcpp Rcpp-matrixcomps.o Rcpp-debias.o RcppExports.o debias.o
5+
$(SHLIB): Rcpp Rcpp-matrixcomps.o Rcpp-debias.o RcppExports.o quadratic_program.o
66

77
clean:
88
rm -f *o

selectiveInference/src/Rcpp-debias.cpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -68,68 +68,3 @@ Rcpp::List solve_QP(Rcpp::NumericMatrix Sigma,
6868
Rcpp::Named("max_active_check") = max_active_check));
6969

7070
}
71-
72-
// [[Rcpp::export]]
73-
Rcpp::List find_one_row_debiasingM(Rcpp::NumericMatrix Sigma,
74-
int row, // 0-based
75-
double bound,
76-
int maxiter,
77-
Rcpp::NumericVector theta,
78-
Rcpp::NumericVector gradient,
79-
Rcpp::IntegerVector ever_active,
80-
Rcpp::IntegerVector nactive,
81-
double kkt_tol,
82-
double objective_tol,
83-
int max_active
84-
) {
85-
86-
int nrow = Sigma.nrow(); // number of features
87-
88-
// Active set
89-
90-
int irow;
91-
92-
// Extract the diagonal
93-
Rcpp::NumericVector Sigma_diag(nrow);
94-
double *sigma_diag_p = Sigma_diag.begin();
95-
96-
for (irow=0; irow<nrow; irow++) {
97-
sigma_diag_p[irow] = Sigma(irow, irow);
98-
}
99-
100-
// Now call our C function
101-
102-
int iter = find_one_row_((double *) Sigma.begin(),
103-
(double *) Sigma_diag.begin(),
104-
(double *) gradient.begin(),
105-
(int *) ever_active.begin(),
106-
(int *) nactive.begin(),
107-
nrow,
108-
bound,
109-
(double *) theta.begin(),
110-
maxiter,
111-
row,
112-
kkt_tol,
113-
objective_tol,
114-
max_active);
115-
116-
// Check whether feasible
117-
118-
int kkt_check = check_KKT(theta.begin(),
119-
gradient.begin(),
120-
nrow,
121-
row,
122-
bound,
123-
kkt_tol);
124-
125-
int max_active_check = (*(nactive.begin()) >= max_active);
126-
127-
return(Rcpp::List::create(Rcpp::Named("soln") = theta,
128-
Rcpp::Named("gradient") = gradient,
129-
Rcpp::Named("iter") = iter,
130-
Rcpp::Named("kkt_check") = kkt_check,
131-
Rcpp::Named("ever_active") = ever_active,
132-
Rcpp::Named("nactive") = nactive,
133-
Rcpp::Named("max_active_check") = max_active_check));
134-
135-
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// This file was generated by Rcpp::compileAttributes
2+
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
3+
4+
#include <Rcpp.h>
5+
6+
using namespace Rcpp;
7+
8+
// solve_QP
9+
Rcpp::List solve_QP(Rcpp::NumericMatrix Sigma, double bound, int maxiter, Rcpp::NumericVector theta, Rcpp::NumericVector linear_func, Rcpp::NumericVector gradient, Rcpp::IntegerVector ever_active, Rcpp::IntegerVector nactive, double kkt_tol, double objective_tol, int max_active);
10+
RcppExport SEXP selectiveInference_solve_QP(SEXP SigmaSEXP, SEXP boundSEXP, SEXP maxiterSEXP, SEXP thetaSEXP, SEXP linear_funcSEXP, SEXP gradientSEXP, SEXP ever_activeSEXP, SEXP nactiveSEXP, SEXP kkt_tolSEXP, SEXP objective_tolSEXP, SEXP max_activeSEXP) {
11+
BEGIN_RCPP
12+
Rcpp::RObject __result;
13+
Rcpp::RNGScope __rngScope;
14+
Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type Sigma(SigmaSEXP);
15+
Rcpp::traits::input_parameter< double >::type bound(boundSEXP);
16+
Rcpp::traits::input_parameter< int >::type maxiter(maxiterSEXP);
17+
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type theta(thetaSEXP);
18+
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type linear_func(linear_funcSEXP);
19+
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type gradient(gradientSEXP);
20+
Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type ever_active(ever_activeSEXP);
21+
Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type nactive(nactiveSEXP);
22+
Rcpp::traits::input_parameter< double >::type kkt_tol(kkt_tolSEXP);
23+
Rcpp::traits::input_parameter< double >::type objective_tol(objective_tolSEXP);
24+
Rcpp::traits::input_parameter< int >::type max_active(max_activeSEXP);
25+
__result = Rcpp::wrap(solve_QP(Sigma, bound, maxiter, theta, linear_func, gradient, ever_active, nactive, kkt_tol, objective_tol, max_active));
26+
return __result;
27+
END_RCPP
28+
}
29+
// update1_
30+
Rcpp::List update1_(Rcpp::NumericMatrix Q2, Rcpp::NumericVector w, int m, int k);
31+
RcppExport SEXP selectiveInference_update1_(SEXP Q2SEXP, SEXP wSEXP, SEXP mSEXP, SEXP kSEXP) {
32+
BEGIN_RCPP
33+
Rcpp::RObject __result;
34+
Rcpp::RNGScope __rngScope;
35+
Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type Q2(Q2SEXP);
36+
Rcpp::traits::input_parameter< Rcpp::NumericVector >::type w(wSEXP);
37+
Rcpp::traits::input_parameter< int >::type m(mSEXP);
38+
Rcpp::traits::input_parameter< int >::type k(kSEXP);
39+
__result = Rcpp::wrap(update1_(Q2, w, m, k));
40+
return __result;
41+
END_RCPP
42+
}
43+
// downdate1_
44+
Rcpp::List downdate1_(Rcpp::NumericMatrix Q1, Rcpp::NumericMatrix R, int j0, int m, int n);
45+
RcppExport SEXP selectiveInference_downdate1_(SEXP Q1SEXP, SEXP RSEXP, SEXP j0SEXP, SEXP mSEXP, SEXP nSEXP) {
46+
BEGIN_RCPP
47+
Rcpp::RObject __result;
48+
Rcpp::RNGScope __rngScope;
49+
Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type Q1(Q1SEXP);
50+
Rcpp::traits::input_parameter< Rcpp::NumericMatrix >::type R(RSEXP);
51+
Rcpp::traits::input_parameter< int >::type j0(j0SEXP);
52+
Rcpp::traits::input_parameter< int >::type m(mSEXP);
53+
Rcpp::traits::input_parameter< int >::type n(nSEXP);
54+
__result = Rcpp::wrap(downdate1_(Q1, R, j0, m, n));
55+
return __result;
56+
END_RCPP
57+
}

0 commit comments

Comments
 (0)