Skip to content

Commit b4380ee

Browse files
committed
Minor documentation refresh for two utility functions
1 parent 31a1b62 commit b4380ee

File tree

6 files changed

+48
-114
lines changed

6 files changed

+48
-114
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2025-09-16 Dirk Eddelbuettel <[email protected]>
2+
3+
* src/RcppArmadillo.cpp: Refresh documentation for seed setting function
4+
* man/armadillo_set_seed.Rd: Regenerated, also for *_random() variant
5+
* man/armadillo_version.Rd: Regenerated
6+
17
2025-09-11 Dirk Eddelbuettel <[email protected]>
28

39
* README.md: Link to ldlasb2 repo and its 'benchmarks' writeup

R/RcppExports.R

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,20 @@ armadillo_version <- function(single) {
1414
.Call(`_RcppArmadillo_armadillo_version`, single)
1515
}
1616

17-
#' Set the Armadillo Random Number Generator to a random value
18-
#'
19-
#' @details
20-
#' Depending on whether RcppArmadillo was compiled for the C++98 standard
21-
#' (currently the default) or for C++11 (optional), two different RNGs may be used.
22-
#' This function resets either. For C++98, the R programming language's RNG is used.
23-
#' For C++11, the RNG included in the \code{<random>} library is used only when
24-
#' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include <RcppArmadillo.h>}.
25-
#' Otherwise, the R programming language's RNG will be used.
26-
#' @return The function is invoked for its side effect and has no return value.
27-
#' @note This has been found to not work as espected in \pkg{RStudio}
28-
#' as its code also uses the system RNG library. You may have to either
29-
#' not run within \pkg{RStudio} or change your code to use a different RNG such
30-
#' as the one from R.
31-
#' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
17+
#' @rdname armadillo_set_seed
3218
armadillo_set_seed_random <- function() {
3319
invisible(.Call(`_RcppArmadillo_armadillo_set_seed_random`))
3420
}
3521

36-
#' Set the Armadillo Random Number Generator to the given value
22+
#' @title Set the Armadillo Random Number Generator to given or random value
3723
#'
3824
#' @param val The seed used to initialize Armadillo's random number generator.
3925
#' @details
40-
#' Depending on whether RcppArmadillo was compiled for the C++98 standard
41-
#' (currently the default) or for C++11 (optional), two different RNGs may be used.
42-
#' This function resets either. For C++98, the R programming language's RNG is used.
43-
#' For C++11, the RNG included in the \code{<random>} library is used only when
44-
#' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include <RcppArmadillo.h>}.
45-
#' Otherwise, the R programming language's RNG will be used.
26+
#' Armadillo can switch between two random number generator implementations dependeding
27+
#' on the compilation standard used. Under normal circumstances RcppArmadillo will connect
28+
#' Armadillo to the R random number generator which also implies that \code{set.seed()}
29+
#' should be used from R. To use this function, one also needs to undefine \code{ARMA_RNG_ALT}
30+
#' so that the Armadillo generators are used.
4631
#' @return The function is invoked for its side effect and has no return value.
4732
#' @note This has been found to not work as espected in \pkg{RStudio}
4833
#' as its code also uses the system RNG library. You may have to either

man/armadillo_set_seed.Rd

Lines changed: 19 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/armadillo_set_seed_random.Rd

Lines changed: 0 additions & 33 deletions
This file was deleted.

man/armadillo_version.Rd

Lines changed: 8 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RcppArmadillo.cpp

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
// RcppArmadillo.cpp: Rcpp/Armadillo glue
33
//
4-
// Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates
4+
// Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates
55
//
66
// This file is part of RcppArmadillo.
77
//
@@ -49,36 +49,21 @@ Rcpp::IntegerVector armadillo_version(bool single) {
4949

5050
// Per request of Gábor Csárdi in https://github.com/RcppCore/RcppArmadillo/issues/11
5151
//
52-
//' Set the Armadillo Random Number Generator to a random value
53-
//'
54-
//' @details
55-
//' Depending on whether RcppArmadillo was compiled for the C++98 standard
56-
//' (currently the default) or for C++11 (optional), two different RNGs may be used.
57-
//' This function resets either. For C++98, the R programming language's RNG is used.
58-
//' For C++11, the RNG included in the \code{<random>} library is used only when
59-
//' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include <RcppArmadillo.h>}.
60-
//' Otherwise, the R programming language's RNG will be used.
61-
//' @return The function is invoked for its side effect and has no return value.
62-
//' @note This has been found to not work as espected in \pkg{RStudio}
63-
//' as its code also uses the system RNG library. You may have to either
64-
//' not run within \pkg{RStudio} or change your code to use a different RNG such
65-
//' as the one from R.
66-
//' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
52+
//' @rdname armadillo_set_seed
6753
// [[Rcpp::export]]
6854
void armadillo_set_seed_random() {
6955
arma::arma_rng::set_seed_random(); // set the seed to a random value
7056
}
7157

72-
//' Set the Armadillo Random Number Generator to the given value
58+
//' @title Set the Armadillo Random Number Generator to given or random value
7359
//'
7460
//' @param val The seed used to initialize Armadillo's random number generator.
7561
//' @details
76-
//' Depending on whether RcppArmadillo was compiled for the C++98 standard
77-
//' (currently the default) or for C++11 (optional), two different RNGs may be used.
78-
//' This function resets either. For C++98, the R programming language's RNG is used.
79-
//' For C++11, the RNG included in the \code{<random>} library is used only when
80-
//' \code{#define ARMA_USE_CXX11_RNG} is placed before \code{#include <RcppArmadillo.h>}.
81-
//' Otherwise, the R programming language's RNG will be used.
62+
//' Armadillo can switch between two random number generator implementations dependeding
63+
//' on the compilation standard used. Under normal circumstances RcppArmadillo will connect
64+
//' Armadillo to the R random number generator which also implies that \code{set.seed()}
65+
//' should be used from R. To use this function, one also needs to undefine \code{ARMA_RNG_ALT}
66+
//' so that the Armadillo generators are used.
8267
//' @return The function is invoked for its side effect and has no return value.
8368
//' @note This has been found to not work as espected in \pkg{RStudio}
8469
//' as its code also uses the system RNG library. You may have to either
@@ -87,7 +72,6 @@ void armadillo_set_seed_random() {
8772
//' @seealso The R documentation on its RNGs all of which are accessible via \pkg{Rcpp}.
8873
// [[Rcpp::export]]
8974
void armadillo_set_seed(unsigned int val) {
90-
//Rcpp::Rcout << "Setting value " << val << std::endl;
9175
arma::arma_rng::set_seed(val); // set the seed to given value
9276
}
9377

0 commit comments

Comments
 (0)