Comments (9)
Dear Sacha Epskamp
It is quite weird and I have no clue at moment either. There is no need to comment out lines 82-85. It seems that when you call "opt.minimize(rb, x);" on line 106 and somehow this error has been triggered. Could you please check g++ version you're using on Windows (or the Rtools version)? And also could you please attach the figure of compile information on terminal(as we may find additional information over there).
Thanks!
from roptim.
Hi Yi Pan,
Thank you for your quick reply! I installed Rtools35 which should be the latest, and apparently have G++ 4.9.3 (that seems low, I have a much higher version on Linux). See below for a screenshot:
Best, Sacha
from roptim.
Dear Sacha Epskamp
I have tried to compile your package on linux and it is okay. Actually it is quite hard for me to reproduce the error currently -- I left my only windows PC in the office, and obviously I cannot go back now. Could you please simply try the following change on your PC (as I get the feeling that "control" is somehow not regarded as data member in your case):
roptim.h:
Change
line 86: } control;
to
};
RoptimControl control;
I write the following simple code which might be helpful to find a solution to the problem:
test.cpp:
#include <Rcpp.h>
template <typename T>
class A {
T val = 10;
public:
struct Inner{
int trace = 0;
};
Inner control;
void fun(T v) {
val = v;
if (control.trace > 0)
Rcpp::Rcout << "val = " << val << std::endl;
}
};
// [[Rcpp::export]]
void test_A()
{
A<int> a;
a.control.trace = 1;
a.fun(20);
}
And run the following in R:
library(Rcpp)
sourceCpp("~/test.cpp") # You may need to change the directory
test_A()
If you are able to get the function test_A() above working, then it also means that we have fixed the problem.
Thanks!
from roptim.
By the way, the version of Rtools you're using is definitely okay. And that's something I don't understand -- I was using the same Rtools and roptim in my package on Windows while there was no error.
from roptim.
Thanks! The test_A()
function works regardless of changing that line in roptim.h, but changing the line did not fix the problem in building the package.
from roptim.
Hi, Sacha
I managed to reproduce the error on windows vm and found that the following change may fix the problem:
roptim.h:
Change
int trace = 0;
to
std::size_t trace = 0;
Change
if (control.trace < 0)
Rcpp::warning("read the documentation for 'trace' more carefully");
else if (method_ == "SANN" && control.trace && control.REPORT == 0)
Rcpp::stop("'trace != 0' needs 'REPORT >= 1'");
to
if (method_ == "SANN" && control.trace && control.REPORT == 0)
Rcpp::stop("'trace != 0' needs 'REPORT >= 1'");
Let me know if it also works for you. Thanks a lot!
from roptim.
Yes this worked! Thank you so much for the quick work on this!
from roptim.
It seems that it is a bug of the compiler. But I am still quite confused about this error -- I was doing something similar in my another package and I should get this error message long time ago.
Anyway I will aim to update the package this weekend and afterwards you can specify the minimum roptim version required in the DESCRIPTION file for safe. Thanks.
from roptim.
That is great, thank! Of note, I obtained a similar error on a Linux high performance cloud that was also fixed with this code.
from roptim.
Related Issues (8)
- can't run the demo.cpp HOT 8
- Specify intolerable parameter set in fit function HOT 2
- NOTE in R devel check HOT 2
- Use of numerical gradient HOT 5
- Help with implementation HOT 5
- Citation for the package? HOT 2
- passing other arguments HOT 2
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 roptim.