Skip to content

Fix warning in .rhoPrior and trMVNmatrixRcpp - #2

Open
philipptandler wants to merge 4 commits into
cran:masterfrom
philipptandler:bugfix
Open

Fix warning in .rhoPrior and trMVNmatrixRcpp#2
philipptandler wants to merge 4 commits into
cran:masterfrom
philipptandler:bugfix

Conversation

@philipptandler

Copy link
Copy Markdown

During the execution of gjam() in my project, I had two warning that were displayed repeatedly:

In gjamHfunctions.R in the .rhoPrior function a matrix is initialised. The there is an error if the data (rep(1:M, M*S)) is of unequal length as the number of elements in the matrix (nrow = S*M, ncol = S). To match the length of data with the number of elements, data must be rep(1:M, S*S) to get S*M*S elements in the matrix.

In cppFns.cpp in the trMVNmatrixRcpp function, the smat matrix is inverted. In case the xdata used in the input is not normalized, especially if the mean is >> 0, the elements in the smat matrix can be very high and low, yielding numerical imprecisions and the function arma::inv_sympd() returns a warning: given matrix is not symmetric. This can be resolved through either forcing it symmetric or make sure the xdata provided is (roughly) normalized. For the first issue, I force it twice, such that first high and low values are roughly equal (L118) and exactly equal in floating point precision (L119). For the latter option, I would recommend add a step where the .gjam ensures the xdata is normalized and add this to the description in the package.

@gaborcsardi

Copy link
Copy Markdown

Hi, this is a read only mirror of CRAN, please see the package authors in the DESCRIPTION file. Look for Maintainer, BugReports and URL. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants