Skip to content

Commit 13765c0

Browse files
committed
minimal PR
1 parent 5638f93 commit 13765c0

File tree

6 files changed

+1343
-1442
lines changed

6 files changed

+1343
-1442
lines changed

cpp11test/R/cpp11.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ row_sums <- function(x) {
108108
.Call(`_cpp11test_row_sums`, x)
109109
}
110110

111+
mat_mat_copy_dimnames <- function(x) {
112+
.Call(`_cpp11test_mat_mat_copy_dimnames`, x)
113+
}
114+
115+
mat_sexp_copy_dimnames <- function(x) {
116+
.Call(`_cpp11test_mat_sexp_copy_dimnames`, x)
117+
}
118+
119+
mat_mat_create_dimnames <- function() {
120+
.Call(`_cpp11test_mat_mat_create_dimnames`)
121+
}
122+
111123
col_sums <- function(x) {
112124
.Call(`_cpp11test_col_sums`, x)
113125
}

cpp11test/src/cpp11.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,27 @@ extern "C" SEXP _cpp11test_row_sums(SEXP x) {
209209
END_CPP11
210210
}
211211
// matrix.cpp
212+
cpp11::doubles_matrix<> mat_mat_copy_dimnames(cpp11::doubles_matrix<> x);
213+
extern "C" SEXP _cpp11test_mat_mat_copy_dimnames(SEXP x) {
214+
BEGIN_CPP11
215+
return cpp11::as_sexp(mat_mat_copy_dimnames(cpp11::as_cpp<cpp11::decay_t<cpp11::doubles_matrix<>>>(x)));
216+
END_CPP11
217+
}
218+
// matrix.cpp
219+
SEXP mat_sexp_copy_dimnames(cpp11::doubles_matrix<> x);
220+
extern "C" SEXP _cpp11test_mat_sexp_copy_dimnames(SEXP x) {
221+
BEGIN_CPP11
222+
return cpp11::as_sexp(mat_sexp_copy_dimnames(cpp11::as_cpp<cpp11::decay_t<cpp11::doubles_matrix<>>>(x)));
223+
END_CPP11
224+
}
225+
// matrix.cpp
226+
cpp11::doubles_matrix<> mat_mat_create_dimnames();
227+
extern "C" SEXP _cpp11test_mat_mat_create_dimnames() {
228+
BEGIN_CPP11
229+
return cpp11::as_sexp(mat_mat_create_dimnames());
230+
END_CPP11
231+
}
232+
// matrix.cpp
212233
cpp11::doubles col_sums(cpp11::doubles_matrix<cpp11::by_column> x);
213234
extern "C" SEXP _cpp11test_col_sums(SEXP x) {
214235
BEGIN_CPP11
@@ -488,6 +509,9 @@ static const R_CallMethodDef CallEntries[] = {
488509
{"_cpp11test_gibbs_rcpp", (DL_FUNC) &_cpp11test_gibbs_rcpp, 2},
489510
{"_cpp11test_gibbs_rcpp2", (DL_FUNC) &_cpp11test_gibbs_rcpp2, 2},
490511
{"_cpp11test_grow_", (DL_FUNC) &_cpp11test_grow_, 1},
512+
{"_cpp11test_mat_mat_copy_dimnames", (DL_FUNC) &_cpp11test_mat_mat_copy_dimnames, 1},
513+
{"_cpp11test_mat_mat_create_dimnames", (DL_FUNC) &_cpp11test_mat_mat_create_dimnames, 0},
514+
{"_cpp11test_mat_sexp_copy_dimnames", (DL_FUNC) &_cpp11test_mat_sexp_copy_dimnames, 1},
491515
{"_cpp11test_my_message", (DL_FUNC) &_cpp11test_my_message, 2},
492516
{"_cpp11test_my_message_n1", (DL_FUNC) &_cpp11test_my_message_n1, 1},
493517
{"_cpp11test_my_message_n1fmt", (DL_FUNC) &_cpp11test_my_message_n1fmt, 1},

inst/include/cpp11/matrix.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#pragma once
22

3+
#include <initializer_list> // for initializer_list
34
#include <iterator>
45
#include <string> // for string
5-
#include <initializer_list> // for initializer_list
66

77
#include "cpp11/R.hpp" // for SEXP, SEXPREC, R_xlen_t, INT...
88
#include "cpp11/attribute_proxy.hpp" // for attribute_proxy

0 commit comments

Comments
 (0)