Is there a way to use ALTREP with Rcpp?












1















Example:



// [[Rcpp::export]]
size_t z1(SEXP x) {
return Rf_xlength(x);
}

// [[Rcpp::export]]
size_t z2(NumericVector x) {
// do anything or nothing
return 1;
}


R:



x <- seq(1,1e10)
z1(x)
[1] 1e+10

z2(x)
# computer hard crash


Suppose as example, I just wanted to take the first 10 elements of an ALTREP vector. What would be the best way to do so in C++?










share|improve this question


















  • 2





    This recent link might be appropriate: purrple.cat/blog/2018/10/14/altrep-and-cpp

    – r2evans
    Nov 14 '18 at 0:01






  • 1





    i) ALTREP is not released. ii) You can look at ChangeLog and NEWS.Rd and scan for ALTREP. There is nothing yet. For why see i) ;-) Help welcome. If you want to experiment, come to the rcpp-devel list and discuss. Last time I met Gabe / talked to Gabe his view still was that package would not have to do all that much. We'll see. I guess it will be more of a topic in 2019.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:05











  • Thanks Dirk, I was wondering if you or Romain would jump in quickly. It's been a low-priority lingering question I've had but didn't have the need to ask (yet).

    – r2evans
    Nov 14 '18 at 0:14






  • 1





    Sorry if I am misunderstanding, but in the change log of R 3.5.0 it says "Arithmetic sequences created by 1:n, seq_along, and the like now use compact internal representations via the ALTREP framework. " Doesn't that mean it is released?

    – thc
    Nov 14 '18 at 0:29













  • @thc: In the narrow sense the answer is of course YES. You can program anything you want with Rcpp. But if your question really is "does Rcpp currently contain ALTREP-aware interfaces" then the answer is no, as you can tell from the Rcpp NEWS and ChangeLog. As I said, likely in 2019. Or whenever someone (you?) starts on it.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:58
















1















Example:



// [[Rcpp::export]]
size_t z1(SEXP x) {
return Rf_xlength(x);
}

// [[Rcpp::export]]
size_t z2(NumericVector x) {
// do anything or nothing
return 1;
}


R:



x <- seq(1,1e10)
z1(x)
[1] 1e+10

z2(x)
# computer hard crash


Suppose as example, I just wanted to take the first 10 elements of an ALTREP vector. What would be the best way to do so in C++?










share|improve this question


















  • 2





    This recent link might be appropriate: purrple.cat/blog/2018/10/14/altrep-and-cpp

    – r2evans
    Nov 14 '18 at 0:01






  • 1





    i) ALTREP is not released. ii) You can look at ChangeLog and NEWS.Rd and scan for ALTREP. There is nothing yet. For why see i) ;-) Help welcome. If you want to experiment, come to the rcpp-devel list and discuss. Last time I met Gabe / talked to Gabe his view still was that package would not have to do all that much. We'll see. I guess it will be more of a topic in 2019.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:05











  • Thanks Dirk, I was wondering if you or Romain would jump in quickly. It's been a low-priority lingering question I've had but didn't have the need to ask (yet).

    – r2evans
    Nov 14 '18 at 0:14






  • 1





    Sorry if I am misunderstanding, but in the change log of R 3.5.0 it says "Arithmetic sequences created by 1:n, seq_along, and the like now use compact internal representations via the ALTREP framework. " Doesn't that mean it is released?

    – thc
    Nov 14 '18 at 0:29













  • @thc: In the narrow sense the answer is of course YES. You can program anything you want with Rcpp. But if your question really is "does Rcpp currently contain ALTREP-aware interfaces" then the answer is no, as you can tell from the Rcpp NEWS and ChangeLog. As I said, likely in 2019. Or whenever someone (you?) starts on it.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:58














1












1








1








Example:



// [[Rcpp::export]]
size_t z1(SEXP x) {
return Rf_xlength(x);
}

// [[Rcpp::export]]
size_t z2(NumericVector x) {
// do anything or nothing
return 1;
}


R:



x <- seq(1,1e10)
z1(x)
[1] 1e+10

z2(x)
# computer hard crash


Suppose as example, I just wanted to take the first 10 elements of an ALTREP vector. What would be the best way to do so in C++?










share|improve this question














Example:



// [[Rcpp::export]]
size_t z1(SEXP x) {
return Rf_xlength(x);
}

// [[Rcpp::export]]
size_t z2(NumericVector x) {
// do anything or nothing
return 1;
}


R:



x <- seq(1,1e10)
z1(x)
[1] 1e+10

z2(x)
# computer hard crash


Suppose as example, I just wanted to take the first 10 elements of an ALTREP vector. What would be the best way to do so in C++?







r rcpp altrep






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 23:57









thcthc

4,82911124




4,82911124








  • 2





    This recent link might be appropriate: purrple.cat/blog/2018/10/14/altrep-and-cpp

    – r2evans
    Nov 14 '18 at 0:01






  • 1





    i) ALTREP is not released. ii) You can look at ChangeLog and NEWS.Rd and scan for ALTREP. There is nothing yet. For why see i) ;-) Help welcome. If you want to experiment, come to the rcpp-devel list and discuss. Last time I met Gabe / talked to Gabe his view still was that package would not have to do all that much. We'll see. I guess it will be more of a topic in 2019.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:05











  • Thanks Dirk, I was wondering if you or Romain would jump in quickly. It's been a low-priority lingering question I've had but didn't have the need to ask (yet).

    – r2evans
    Nov 14 '18 at 0:14






  • 1





    Sorry if I am misunderstanding, but in the change log of R 3.5.0 it says "Arithmetic sequences created by 1:n, seq_along, and the like now use compact internal representations via the ALTREP framework. " Doesn't that mean it is released?

    – thc
    Nov 14 '18 at 0:29













  • @thc: In the narrow sense the answer is of course YES. You can program anything you want with Rcpp. But if your question really is "does Rcpp currently contain ALTREP-aware interfaces" then the answer is no, as you can tell from the Rcpp NEWS and ChangeLog. As I said, likely in 2019. Or whenever someone (you?) starts on it.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:58














  • 2





    This recent link might be appropriate: purrple.cat/blog/2018/10/14/altrep-and-cpp

    – r2evans
    Nov 14 '18 at 0:01






  • 1





    i) ALTREP is not released. ii) You can look at ChangeLog and NEWS.Rd and scan for ALTREP. There is nothing yet. For why see i) ;-) Help welcome. If you want to experiment, come to the rcpp-devel list and discuss. Last time I met Gabe / talked to Gabe his view still was that package would not have to do all that much. We'll see. I guess it will be more of a topic in 2019.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:05











  • Thanks Dirk, I was wondering if you or Romain would jump in quickly. It's been a low-priority lingering question I've had but didn't have the need to ask (yet).

    – r2evans
    Nov 14 '18 at 0:14






  • 1





    Sorry if I am misunderstanding, but in the change log of R 3.5.0 it says "Arithmetic sequences created by 1:n, seq_along, and the like now use compact internal representations via the ALTREP framework. " Doesn't that mean it is released?

    – thc
    Nov 14 '18 at 0:29













  • @thc: In the narrow sense the answer is of course YES. You can program anything you want with Rcpp. But if your question really is "does Rcpp currently contain ALTREP-aware interfaces" then the answer is no, as you can tell from the Rcpp NEWS and ChangeLog. As I said, likely in 2019. Or whenever someone (you?) starts on it.

    – Dirk Eddelbuettel
    Nov 14 '18 at 0:58








2




2





This recent link might be appropriate: purrple.cat/blog/2018/10/14/altrep-and-cpp

– r2evans
Nov 14 '18 at 0:01





This recent link might be appropriate: purrple.cat/blog/2018/10/14/altrep-and-cpp

– r2evans
Nov 14 '18 at 0:01




1




1





i) ALTREP is not released. ii) You can look at ChangeLog and NEWS.Rd and scan for ALTREP. There is nothing yet. For why see i) ;-) Help welcome. If you want to experiment, come to the rcpp-devel list and discuss. Last time I met Gabe / talked to Gabe his view still was that package would not have to do all that much. We'll see. I guess it will be more of a topic in 2019.

– Dirk Eddelbuettel
Nov 14 '18 at 0:05





i) ALTREP is not released. ii) You can look at ChangeLog and NEWS.Rd and scan for ALTREP. There is nothing yet. For why see i) ;-) Help welcome. If you want to experiment, come to the rcpp-devel list and discuss. Last time I met Gabe / talked to Gabe his view still was that package would not have to do all that much. We'll see. I guess it will be more of a topic in 2019.

– Dirk Eddelbuettel
Nov 14 '18 at 0:05













Thanks Dirk, I was wondering if you or Romain would jump in quickly. It's been a low-priority lingering question I've had but didn't have the need to ask (yet).

– r2evans
Nov 14 '18 at 0:14





Thanks Dirk, I was wondering if you or Romain would jump in quickly. It's been a low-priority lingering question I've had but didn't have the need to ask (yet).

– r2evans
Nov 14 '18 at 0:14




1




1





Sorry if I am misunderstanding, but in the change log of R 3.5.0 it says "Arithmetic sequences created by 1:n, seq_along, and the like now use compact internal representations via the ALTREP framework. " Doesn't that mean it is released?

– thc
Nov 14 '18 at 0:29







Sorry if I am misunderstanding, but in the change log of R 3.5.0 it says "Arithmetic sequences created by 1:n, seq_along, and the like now use compact internal representations via the ALTREP framework. " Doesn't that mean it is released?

– thc
Nov 14 '18 at 0:29















@thc: In the narrow sense the answer is of course YES. You can program anything you want with Rcpp. But if your question really is "does Rcpp currently contain ALTREP-aware interfaces" then the answer is no, as you can tell from the Rcpp NEWS and ChangeLog. As I said, likely in 2019. Or whenever someone (you?) starts on it.

– Dirk Eddelbuettel
Nov 14 '18 at 0:58





@thc: In the narrow sense the answer is of course YES. You can program anything you want with Rcpp. But if your question really is "does Rcpp currently contain ALTREP-aware interfaces" then the answer is no, as you can tell from the Rcpp NEWS and ChangeLog. As I said, likely in 2019. Or whenever someone (you?) starts on it.

– Dirk Eddelbuettel
Nov 14 '18 at 0:58












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291214%2fis-there-a-way-to-use-altrep-with-rcpp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53291214%2fis-there-a-way-to-use-altrep-with-rcpp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Academy of Television Arts & Sciences

L'Équipe

1995 France bombings