I have a package called geogrid that I and others have recently updated. I want to submit these updates to CRAN in a new version of the package. All of my tests pass and I pass all the criteria needed for successful submission to CRAN except for one.
Valgrind is reporting this error. The main error is: Conditional jump or move depends on uninitialised value(s). Which, as I understand, relates to non-declaration of variables before their use and memory issues.
When creating the package I integrated some really helpful C++ code from a collaborator into the package. This can be found at https://github.com/jbaileyh/geogrid/blob/master/src/minimal-assignment.cpp. I think this is the code that's causing the error - namely the function step_two() in this file.
Unfortunately, the code is quite iterative and i'm not well versed in how R shares inputs / variables with C++.
Any suggestions on how to prevent the error or on materials from which I could learn are much appreciated!
Side note: apologies for posting full link. New users cannot use more than 2 links in the first post.
Thanks for suggesting this and for pointing me to the Armadillo docs. There are lots of options for initialising the memory as suggested (potentially relevant ones below):
|fill::zeros| = |set all elements to 0|
|fill::ones| = |set all elements to 1|
|fill::none| = |do not modify the elements|
When trying to supply a default value, I don't think it expects one:
devtools::check() returns:
minimal-assignment.cpp:434:15: error: no matching constructor for initialization of 'arma::mat' (aka 'Mat<double>')
arma::mat cost(input_cost, 0);
I think this suggests that it won't take additional arguments such as the fill_value outlined here see: mat(size(X), fill_type) (memory is initialised).
Apologies if this is obvious and thanks for the help.