Comments (8)
Armadillo has an internal class called arma_rng_cxx11
, but it's not part of the public API.
The ARMA_USE_EXTERN_CXX11_RNG
define is set by the armadillo cmake installer to indicate that the arma::arma_rng_cxx11_instance
is available in the armadillo wrapper library. The define not meant to be used outside of that specific use case. Furthermore, it's only valid on Linux systems with gcc 4.8.3+. It currently doesn't work with macOS or windoze. (it should be trivial to make it work with macOS, now that Apple has proper support for thethread_local
storage class in C++11).
Perhaps it would be sufficient to simply use the public randi(), randu(), randn() and randg() functions ?
In armadillo version 8.400+ all of the above functions were extended to output single scalars.
randg()
was added in version 4.650. randi()
was added in version 3.930.
randu()
and randn()
have been available "since forever".
If armadillo 8.400 is "too recent", it's still possible to use the above functions to generate scalars. Simply use as_scalar()
on a random vector that has only one dimension.
As a sidenote, armadillo 8.400 is available in Ubuntu 18.04.
from ensmallen.
In case of:
std::shuffle(visitationOrder.begin(), visitationOrder.end(), mlpack::math::randGen);
it should be reasonable to use:
visitationOrder = arma::shuffel(visitationOrder);
any thoughts?
from ensmallen.
For the other cases I agree, it would be simple to use: arma::as_scalar(randi(...))
.
from ensmallen.
Agreed on both counts---I wonder why we didn't just use arma::shuffle(visitationOrder)
originally?
from ensmallen.
I guess the benefit is that std::shuffel
works inplace; should be neglectable here.
from ensmallen.
arma:shuffle() should detect aliasing and do an inplace shuffle:
https://gitlab.com/conradsnicta/armadillo-code/blob/9.200.x/include/armadillo_bits/op_shuffle_meat.hpp#L62
https://gitlab.com/conradsnicta/armadillo-code/blob/9.200.x/include/armadillo_bits/op_shuffle_meat.hpp#L129
from ensmallen.
Thanks for the clarification, should have checked first. 05a8743 implements the modifications.
from ensmallen.
I think this one is fully handled now---I see no use of any random object or anything other than Armadillo's existing public random functions.
from ensmallen.
Related Issues (20)
- [regression in 2.17.0] Tests aren't built HOT 2
- armadillo / bandicoot conv_to ambiguity HOT 6
- tests/catch.hpp update to anticipate failure to build with glibc 2.34 HOT 2
- C++20 redudant template argument disallowed in ctor HOT 4
- Debian build (test) failure on armel HOT 24
- Adam with Decay HOT 2
- Compiling errors ensmallen 02.18.02 using VS2019 armadillo.lib 10.08.02 and mlpack.lib 03.04.02 HOT 6
- The example to use the constrained function HOT 4
- AugLagrangian with constraints validation HOT 8
- Multi-objective functions both MOEA/D-DE and NSGA2 - Examples using SchafferFunctionN1 HOT 1
- Implementing Function Type for Partial Derivatives HOT 3
- Does ensmallen work with armadillo >=10.0? HOT 5
- Enable HTTPS on ensmallen.org HOT 1
- Debian build (test) failure on i386 HOT 7
- ProgressBar() does not work with L_BFGS HOT 3
- Bounds for search space HOT 5
- During AugLagrangian's optimization, L_BFGS sets coordinates to nan HOT 6
- Migrate from Catch v2 to v3 HOT 3
- Using optimizer with integers HOT 6
- Custom early stop callback HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ensmallen.