Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

with .registration=TRUE, change C++ fastLm to fastLm_impl (closes #163)#164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
eddelbuettel merged 1 commit intomasterfrombugfix/registration
Aug 19, 2017
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
with .registration=TRUE, change C++ fastLm to fastLm_impl
  • Loading branch information
@eddelbuettel
eddelbuettel committedAug 19, 2017
commitb5a774c54f582e340ce6ee237ec0de9028cc4eda
10 changes: 5 additions & 5 deletionsR/RcppExports.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

fastLm <- function(X, y) {
.Call(RcppArmadillo_fastLm, X, y)
fastLm_impl <- function(X, y) {
.Call(`_RcppArmadillo_fastLm_impl`, X, y)
}

#' Report the version of Armadillo
Expand All@@ -14,7 +14,7 @@ fastLm <- function(X, y) {
#' or a named vector with three elements \code{major}, \code{minor} and \code{patch}.
#' @seealso Armadillo header file \code{arma_version.hpp}.
armadillo_version <- function(single) {
.Call(RcppArmadillo_armadillo_version, single)
.Call(`_RcppArmadillo_armadillo_version`, single)
}

#' Set the Armadillo Random Number Generator to a random value
Expand All@@ -33,7 +33,7 @@ armadillo_version <- function(single) {
#' as the one from R.
#' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
armadillo_set_seed_random <- function() {
invisible(.Call(RcppArmadillo_armadillo_set_seed_random))
invisible(.Call(`_RcppArmadillo_armadillo_set_seed_random`))
}

#' Set the Armadillo Random Number Generator to the given value
Expand All@@ -53,6 +53,6 @@ armadillo_set_seed_random <- function() {
#' as the one from R.
#' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
armadillo_set_seed <- function(val) {
invisible(.Call(RcppArmadillo_armadillo_set_seed, val))
invisible(.Call(`_RcppArmadillo_armadillo_set_seed`, val))
}

4 changes: 2 additions & 2 deletionsR/fastLm.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
## fastLm.R: Rcpp/Armadillo implementation of lm()
##
## Copyright (C) 2010 -2013 Dirk Eddelbuettel, Romain Francois and Douglas Bates
## Copyright (C) 2010 -2017 Dirk Eddelbuettel, Romain Francois and Douglas Bates
##
## This file is part of RcppArmadillo.
##
Expand All@@ -21,7 +21,7 @@ fastLmPure <- function(X, y) {

stopifnot(is.matrix(X), is.numeric(y), nrow(y)==nrow(X))

.Call( "RcppArmadillo_fastLm", X, y, PACKAGE = "RcppArmadillo")
.Call(`_RcppArmadillo_fastLm_impl`, X, y)
}

fastLm <- function(X, ...) UseMethod("fastLm")
Expand Down
9 changes: 3 additions & 6 deletionsinst/unitTests/runit.fastLm.R
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
#!/usr/bin/r -t
#
# Copyright (C) 2010 -2012 Dirk Eddelbuettel, Romain Francois and Douglas Bates
# Copyright (C) 2010 -2017 Dirk Eddelbuettel, Romain Francois and Douglas Bates
#
# This file is part of RcppArmadillo.
#
Expand All@@ -21,11 +21,8 @@

test.fastLm <- function() {
data(trees, package="datasets")
flm <- .Call( "RcppArmadillo_fastLm",
cbind(1, log(trees$Girth)),
log(trees$Volume),
PACKAGE = "RcppArmadillo"
)
flm <- fastLmPure(cbind(1, log(trees$Girth)),
log(trees$Volume))
fit <- lm(log(Volume) ~ log(Girth), data=trees)

checkEquals(as.numeric(flm$coefficients), as.numeric(coef(fit)),
Expand Down
1 change: 1 addition & 0 deletionsman/fastLm.Rd
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
\name{fastLm}
\alias{fastLm}
\alias{fastLm_cpp}
\alias{fastLmPure}
\alias{fastLm.default}
\alias{fastLm.formula}
Expand Down
22 changes: 11 additions & 11 deletionssrc/RcppExports.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -6,21 +6,21 @@

using namespace Rcpp;

//fastLm
ListfastLm(const arma::mat& X, const arma::colvec& y);
RcppExport SEXPRcppArmadillo_fastLm(SEXP XSEXP, SEXP ySEXP) {
//fastLm_impl
ListfastLm_impl(const arma::mat& X, const arma::colvec& y);
RcppExport SEXP_RcppArmadillo_fastLm_impl(SEXP XSEXP, SEXP ySEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const arma::mat& >::type X(XSEXP);
Rcpp::traits::input_parameter< const arma::colvec& >::type y(ySEXP);
rcpp_result_gen = Rcpp::wrap(fastLm(X, y));
rcpp_result_gen = Rcpp::wrap(fastLm_impl(X, y));
return rcpp_result_gen;
END_RCPP
}
// armadillo_version
IntegerVector armadillo_version(bool single);
RcppExport SEXPRcppArmadillo_armadillo_version(SEXP singleSEXP) {
RcppExport SEXP_RcppArmadillo_armadillo_version(SEXP singleSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Expand All@@ -31,7 +31,7 @@ END_RCPP
}
// armadillo_set_seed_random
void armadillo_set_seed_random();
RcppExport SEXPRcppArmadillo_armadillo_set_seed_random() {
RcppExport SEXP_RcppArmadillo_armadillo_set_seed_random() {
BEGIN_RCPP
Rcpp::RNGScope rcpp_rngScope_gen;
armadillo_set_seed_random();
Expand All@@ -40,7 +40,7 @@ END_RCPP
}
// armadillo_set_seed
void armadillo_set_seed(unsigned int val);
RcppExport SEXPRcppArmadillo_armadillo_set_seed(SEXP valSEXP) {
RcppExport SEXP_RcppArmadillo_armadillo_set_seed(SEXP valSEXP) {
BEGIN_RCPP
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< unsigned int >::type val(valSEXP);
Expand All@@ -50,10 +50,10 @@ END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
{"RcppArmadillo_fastLm", (DL_FUNC) &RcppArmadillo_fastLm, 2},
{"RcppArmadillo_armadillo_version", (DL_FUNC) &RcppArmadillo_armadillo_version, 1},
{"RcppArmadillo_armadillo_set_seed_random", (DL_FUNC) &RcppArmadillo_armadillo_set_seed_random, 0},
{"RcppArmadillo_armadillo_set_seed", (DL_FUNC) &RcppArmadillo_armadillo_set_seed, 1},
{"_RcppArmadillo_fastLm_impl", (DL_FUNC) &_RcppArmadillo_fastLm_impl, 2},
{"_RcppArmadillo_armadillo_version", (DL_FUNC) &_RcppArmadillo_armadillo_version, 1},
{"_RcppArmadillo_armadillo_set_seed_random", (DL_FUNC) &_RcppArmadillo_armadillo_set_seed_random, 0},
{"_RcppArmadillo_armadillo_set_seed", (DL_FUNC) &_RcppArmadillo_armadillo_set_seed, 1},
{NULL, NULL, 0}
};

Expand Down
2 changes: 1 addition & 1 deletionsrc/fastLm.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -23,7 +23,7 @@
using namespace Rcpp;

// [[Rcpp::export]]
ListfastLm(const arma::mat& X, const arma::colvec& y) {
ListfastLm_impl(const arma::mat& X, const arma::colvec& y) {
int n = X.n_rows, k = X.n_cols;

arma::colvec coef = arma::solve(X, y); // fit model y ~ X
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp