Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Hi Conrad, all, Thanks for the fixes and fast release. I have just tested RcppArmadillo_0.2.22 on my code and it works fine. Best regards, baptiste On 7 June 2011 03:52, Conrad Sand conradsand.r...@gmail.com wrote: Hi Baptise Terrance, I've fixed several issues in Armadillo and released an updated version (1.99.4). Dirk has wrapped it up in RcppArmadillo 0.2.22, which should be hitting the mirrors soon. Could you try your code again and let me know if you encounter any problems ? With regards, Conrad On 1 June 2011 05:58, baptiste auguie baptiste.aug...@googlemail.com wrote: Thanks so much, Conrad! Best regards, Baptiste On 31 May 2011 23:37, Conrad Sand wrote: I've found the cause of the issue (involves handling of small matrices). The fix is easy (and already done in the SVN repo), but I currently don't have the time to roll out another release. I'll aim to release a fix on the weekend, which will also give me time to double-check if there is a problem in inv(). In the meantime I recommend sticking to the previous version of Armadillo and RcppArmadillo. btw, for dot products I recommend using the dot() and cdot() functions -- they're generally faster than going through the multiplication operator. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Hello Dr. Sanderson, I find no issues in RcppArmadillo 0.2.22. In fact, I was unable to reproduce the error (under 0.2.21) I found via a simple example; in my case, a simple Bayesian regression routine with unknown variances. I continue to experience a transient error that I believe derives from my end and is unrelated to Armadillo; in particular, the inversion of a matrix becomes numerically unstable, causing a crash of an MCMC routine. The error event is rare and I have been unable to duplicate it in a systematic way by running 100's of monte carlo simulations. When the error event does occur, however, successive runs will all error out unless I re-load the library which re-sets the random seed. I built a multivariate Gaussian random number generator that uses arma structures in which I use randn() that is where the error manifests. Terrance -Original Message- From: Conrad Sand [mailto:conradsand.r...@gmail.com] Sent: Monday, June 06, 2011 8:53 AM To: baptiste auguie Cc: Savitsky, Terrance; rcpp-de...@r-forge.wu-wien.ac.at Subject: Re: [Rcpp-devel] trans() changed in latest RcppArmadillo Hi Baptise Terrance, I've fixed several issues in Armadillo and released an updated version (1.99.4). Dirk has wrapped it up in RcppArmadillo 0.2.22, which should be hitting the mirrors soon. Could you try your code again and let me know if you encounter any problems ? With regards, Conrad On 1 June 2011 05:58, baptiste auguie baptiste.aug...@googlemail.com wrote: Thanks so much, Conrad! Best regards, Baptiste On 31 May 2011 23:37, Conrad Sand wrote: I've found the cause of the issue (involves handling of small matrices). The fix is easy (and already done in the SVN repo), but I currently don't have the time to roll out another release. I'll aim to release a fix on the weekend, which will also give me time to double-check if there is a problem in inv(). In the meantime I recommend sticking to the previous version of Armadillo and RcppArmadillo. btw, for dot products I recommend using the dot() and cdot() functions -- they're generally faster than going through the multiplication operator. __ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
For tiny matrices (ie. = 4x4), Armadillo by default uses fast algorithms for det(), inv() and solve(). In rare instances these fast algorithms may not be as precise as the standard algorithms found in Lapack. As such, in the updated version of Armadillo I've added an option to det(), inv() and solve() to force the use of the standard slow algorithms: http://arma.sourceforge.net/docs.html#inv On 8 June 2011 01:21, Savitsky, Terrance savit...@rand.org wrote: Hello Dr. Sanderson, I find no issues in RcppArmadillo 0.2.22. In fact, I was unable to reproduce the error (under 0.2.21) I found via a simple example; in my case, a simple Bayesian regression routine with unknown variances. I continue to experience a transient error that I believe derives from my end and is unrelated to Armadillo; in particular, the inversion of a matrix becomes numerically unstable, causing a crash of an MCMC routine. The error event is rare and I have been unable to duplicate it in a systematic way by running 100's of monte carlo simulations. ... ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Hi Baptise Terrance, I've fixed several issues in Armadillo and released an updated version (1.99.4). Dirk has wrapped it up in RcppArmadillo 0.2.22, which should be hitting the mirrors soon. Could you try your code again and let me know if you encounter any problems ? With regards, Conrad On 1 June 2011 05:58, baptiste auguie baptiste.aug...@googlemail.com wrote: Thanks so much, Conrad! Best regards, Baptiste On 31 May 2011 23:37, Conrad Sand wrote: I've found the cause of the issue (involves handling of small matrices). The fix is easy (and already done in the SVN repo), but I currently don't have the time to roll out another release. I'll aim to release a fix on the weekend, which will also give me time to double-check if there is a problem in inv(). In the meantime I recommend sticking to the previous version of Armadillo and RcppArmadillo. btw, for dot products I recommend using the dot() and cdot() functions -- they're generally faster than going through the multiplication operator. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Thanks so much, Conrad! Best regards, Baptiste On 31 May 2011 23:37, Conrad Sand conradsand.r...@gmail.com wrote: I've found the cause of the issue (involves handling of small matrices). The fix is easy (and already done in the SVN repo), but I currently don't have the time to roll out another release. I'll aim to release a fix on the weekend, which will also give me time to double-check if there is a problem in inv(). In the meantime I recommend sticking to the previous version of Armadillo and RcppArmadillo. btw, for dot products I recommend using the dot() and cdot() functions -- they're generally faster than going through the multiplication operator. On 31 May 2011 11:39, Conrad Sand conradsand.r...@gmail.com wrote: Hi Baptiste, Thanks for the bug report. I'll take a look at the underlying issues. On 31 May 2011 09:48, baptiste auguie baptiste.aug...@googlemail.com wrote: Sorry, I had too many spaces in the vectors. The conclusion is the same though. library(inline) require( RcppArmadillo ) ## let's calculate this product c(-1-1i, 1-1i) %*% c(1i, -1i) ## 0-2i ## trans() with v0.2.19 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1) (+1,-1);, B = (+0,1) (+0,-1); ; arma::cx_colvec res = trans(A) * B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 0-2i ## strans() with v0.2.21 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1) (+1,-1);, B = (+0,1) (+0,-1); ; arma::cx_colvec res = strans(A) * B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 1-1i ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
On 30 May 2011, Terrance Savitsky wrote: Hello, After upgrading to the 0.2.21 release of RcppArmadillo, my previously working code (across many functions) ceased working (on a Windows XP installation). I re-installed the previous version (0.2.20) from CRAN (via a server location not yet updated to 0.2.21); didn't fix it. The timing may be a coincidence, though reading the post on trans() encourages me to make this post. While I use 'trans' across my functions, it is not applied on complex-valued matrices; only real-valued. So the prior post wouldn't explain my issue. Hi, I'm the main author of Armadillo. I'm interested in hearing about all regressions -- can you provide more details ? There have been a lot of changes between Armadillo 1.2 and the latest beta (1.99.3). I'd like to shake out all known bugs before releasing 2.0. Cheers, Conrad -- Dr Conrad Sanderson : Sr Research Scientist : NICTA : http://arma.sf.net/cs ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Hello Dr. Sanderson. Thank you, so much, for your work; along with the work of Dirk and Romain, your tools make it possible for me to have impact I otherwise would never achieve. Anyway, I separately tested my (typical) use of trans() in a simple code and received no problems. I have various Rcpp-written functions that perform Bayesian regression modeling; so I'm simulating samples from a set of conditional distributions. Until last night, I'd used these functions for some months on a particular dataset without incident (though I've intermittently tuned them for speed and functionality). Anyway, further analysis suggests that I'm experiencing numerical instability not previously an issue. I noted that Armadillo included some changes for faster inverse computation on small size matrices. Was there an algorithm change that might allow such instability? I intend to test by replacing inv() with pinv(). Thanks, Terrance -Original Message- From: Conrad Sand [mailto:conradsand.r...@gmail.com] Sent: Monday, May 30, 2011 6:34 AM To: rcpp-de...@r-forge.wu-wien.ac.at Cc: Savitsky, Terrance Subject: Re: trans() changed in latest RcppArmadillo On 30 May 2011, Terrance Savitsky wrote: Hello, After upgrading to the 0.2.21 release of RcppArmadillo, my previously working code (across many functions) ceased working (on a Windows XP installation). I re-installed the previous version (0.2.20) from CRAN (via a server location not yet updated to 0.2.21); didn't fix it. The timing may be a coincidence, though reading the post on trans() encourages me to make this post. While I use 'trans' across my functions, it is not applied on complex-valued matrices; only real-valued. So the prior post wouldn't explain my issue. Hi, I'm the main author of Armadillo. I'm interested in hearing about all regressions -- can you provide more details ? There have been a lot of changes between Armadillo 1.2 and the latest beta (1.99.3). I'd like to shake out all known bugs before releasing 2.0. Cheers, Conrad -- Dr Conrad Sanderson : Sr Research Scientist : NICTA : http://arma.sf.net/cs __ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Dr. Sanderson, I've been able to verify that my issue resides in the inv() function (that I typically apply to small p x p matrices, where p = 3 - 10). In particular, the new version/algorithm induces numerical instability. I've not yet tested that the results of the inv() computation are generally accurate, only that they are not numerically robust in comparison to 0.2.19. I'm up against a deadline, so I switched back to 0.2.19, which resolves my problem, for now, but will provide a reproducible example when finished with my work. Terrance -Original Message- From: Conrad Sand [mailto:conradsand.r...@gmail.com] Sent: Monday, May 30, 2011 6:34 AM To: rcpp-de...@r-forge.wu-wien.ac.at Cc: Savitsky, Terrance Subject: Re: trans() changed in latest RcppArmadillo On 30 May 2011, Terrance Savitsky wrote: Hello, After upgrading to the 0.2.21 release of RcppArmadillo, my previously working code (across many functions) ceased working (on a Windows XP installation). I re-installed the previous version (0.2.20) from CRAN (via a server location not yet updated to 0.2.21); didn't fix it. The timing may be a coincidence, though reading the post on trans() encourages me to make this post. While I use 'trans' across my functions, it is not applied on complex-valued matrices; only real-valued. So the prior post wouldn't explain my issue. Hi, I'm the main author of Armadillo. I'm interested in hearing about all regressions -- can you provide more details ? There have been a lot of changes between Armadillo 1.2 and the latest beta (1.99.3). I'd like to shake out all known bugs before releasing 2.0. Cheers, Conrad -- Dr Conrad Sanderson : Sr Research Scientist : NICTA : http://arma.sf.net/cs __ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
After a couple hours switching back and forth between versions, I found a problem with the scalar product of complex vectors. Here is a minimal example, library(inline) require( RcppArmadillo ) ## let's calculate this product c(-1-1i, 1-1i) %*% c(1i, -1i) ## 0-2i ## trans() with v0.2.19 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1)(+1,-1) ;, B = (+0,1) (+0,-1) ; ; arma::cx_colvec res = trans(A) * B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 0-2i ## strans() with v0.2.21 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1)(+1,-1) ;, B = (+0,1) (+0,-1) ; ; arma::cx_colvec res = strans(A) *B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 1-1i Best regards, baptiste On 31 May 2011 10:01, baptiste auguie baptiste.aug...@googlemail.com wrote: I was a bit optimistic yesterday; I have not yet been able to produce a minimal example but it seems trans/strans was not the end of the story in my code. Something else was broken with the change to 0.2.21.Thankfully the end results are very visibly wrong. Best regards, Baptiste On 31 May 2011 07:02, Savitsky, Terrance savit...@rand.org wrote: Dr. Sanderson, I've been able to verify that my issue resides in the inv() function (that I typically apply to small p x p matrices, where p = 3 - 10). In particular, the new version/algorithm induces numerical instability. I've not yet tested that the results of the inv() computation are generally accurate, only that they are not numerically robust in comparison to 0.2.19. I'm up against a deadline, so I switched back to 0.2.19, which resolves my problem, for now, but will provide a reproducible example when finished with my work. Terrance -Original Message- From: Conrad Sand [mailto:conradsand.r...@gmail.com] Sent: Monday, May 30, 2011 6:34 AM To: rcpp-de...@r-forge.wu-wien.ac.at Cc: Savitsky, Terrance Subject: Re: trans() changed in latest RcppArmadillo On 30 May 2011, Terrance Savitsky wrote: Hello, After upgrading to the 0.2.21 release of RcppArmadillo, my previously working code (across many functions) ceased working (on a Windows XP installation). I re-installed the previous version (0.2.20) from CRAN (via a server location not yet updated to 0.2.21); didn't fix it. The timing may be a coincidence, though reading the post on trans() encourages me to make this post. While I use 'trans' across my functions, it is not applied on complex-valued matrices; only real-valued. So the prior post wouldn't explain my issue. Hi, I'm the main author of Armadillo. I'm interested in hearing about all regressions -- can you provide more details ? There have been a lot of changes between Armadillo 1.2 and the latest beta (1.99.3). I'd like to shake out all known bugs before releasing 2.0. Cheers, Conrad -- Dr Conrad Sanderson : Sr Research Scientist : NICTA : http://arma.sf.net/cs __ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Sorry, I had too many spaces in the vectors. The conclusion is the same though. library(inline) require( RcppArmadillo ) ## let's calculate this product c(-1-1i, 1-1i) %*% c(1i, -1i) ## 0-2i ## trans() with v0.2.19 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1) (+1,-1);, B = (+0,1) (+0,-1); ; arma::cx_colvec res = trans(A) * B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 0-2i ## strans() with v0.2.21 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1) (+1,-1);, B = (+0,1) (+0,-1); ; arma::cx_colvec res = strans(A) * B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 1-1i On 31 May 2011 11:42, baptiste auguie baptiste.aug...@googlemail.com wrote: After a couple hours switching back and forth between versions, I found a problem with the scalar product of complex vectors. Here is a minimal example, library(inline) require( RcppArmadillo ) ## let's calculate this product c(-1-1i, 1-1i) %*% c(1i, -1i) ## 0-2i ## trans() with v0.2.19 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1) (+1,-1) ;, B = (+0,1) (+0,-1) ; ; arma::cx_colvec res = trans(A) * B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 0-2i ## strans() with v0.2.21 fx - cxxfunction( signature() , ' arma::cx_colvec A = (-1,-1) (+1,-1) ;, B = (+0,1) (+0,-1) ; ; arma::cx_colvec res = strans(A) *B; return wrap( res ) ; ', plugin = RcppArmadillo ) fx() ## 1-1i Best regards, baptiste On 31 May 2011 10:01, baptiste auguie baptiste.aug...@googlemail.com wrote: I was a bit optimistic yesterday; I have not yet been able to produce a minimal example but it seems trans/strans was not the end of the story in my code. Something else was broken with the change to 0.2.21.Thankfully the end results are very visibly wrong. Best regards, Baptiste On 31 May 2011 07:02, Savitsky, Terrance savit...@rand.org wrote: Dr. Sanderson, I've been able to verify that my issue resides in the inv() function (that I typically apply to small p x p matrices, where p = 3 - 10). In particular, the new version/algorithm induces numerical instability. I've not yet tested that the results of the inv() computation are generally accurate, only that they are not numerically robust in comparison to 0.2.19. I'm up against a deadline, so I switched back to 0.2.19, which resolves my problem, for now, but will provide a reproducible example when finished with my work. Terrance -Original Message- From: Conrad Sand [mailto:conradsand.r...@gmail.com] Sent: Monday, May 30, 2011 6:34 AM To: rcpp-de...@r-forge.wu-wien.ac.at Cc: Savitsky, Terrance Subject: Re: trans() changed in latest RcppArmadillo On 30 May 2011, Terrance Savitsky wrote: Hello, After upgrading to the 0.2.21 release of RcppArmadillo, my previously working code (across many functions) ceased working (on a Windows XP installation). I re-installed the previous version (0.2.20) from CRAN (via a server location not yet updated to 0.2.21); didn't fix it. The timing may be a coincidence, though reading the post on trans() encourages me to make this post. While I use 'trans' across my functions, it is not applied on complex-valued matrices; only real-valued. So the prior post wouldn't explain my issue. Hi, I'm the main author of Armadillo. I'm interested in hearing about all regressions -- can you provide more details ? There have been a lot of changes between Armadillo 1.2 and the latest beta (1.99.3). I'd like to shake out all known bugs before releasing 2.0. Cheers, Conrad -- Dr Conrad Sanderson : Sr Research Scientist : NICTA : http://arma.sf.net/cs __ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
On 31 May 2011 05:02, Savitsky, Terrance savit...@rand.org wrote: Dr. Sanderson, I've been able to verify that my issue resides in the inv() function (that I typically apply to small p x p matrices, where p = 3 - 10). In particular, the new version/algorithm induces numerical instability. This is a bit strange, as the underlying algorithm for inv() hasn't changed. For matrix sizes = 4x4, a fast version is used (and has been since the early days of Armadillo). For sizes = 5x5, Lapack is used. Can you provide an example matrix which provides different results with the new Armadillo ? btw, in the new Armadillo the solve() function now calls inv() for matrix sizes = 4x4. Otherwise it uses Lapack. I've not yet tested that the results of the inv() computation are generally accurate, only that they are not numerically robust in comparison to 0.2.19. I'm up against a deadline, so I switched back to 0.2.19, which resolves my problem, for now, but will provide a reproducible example when finished with my work. That would be great -- as the issue affects you, it's likely to affect other people. Cheers, Conrad -- Dr Conrad Sanderson : Sr Research Scientist : NICTA : http://arma.sf.net/cs ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
[Rcpp-devel] trans() changed in latest RcppArmadillo
Dear list, The latest RcppArmadillo broke some code that worked for me before, and produces erroneous results. I have just tracked down the origin of the problem to a change in the armadillo library: applying trans() to complex matrices now takes the complex conjugate as well as transposing. Using strans() restores the original behavior. I though I'd warn other RcppArmadillo users to check their code if it uses complex linear algebra. Rather curiously, strans() cannot be applied on real matrices, so trans() should be kept there. Best regards, baptiste ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
Re: [Rcpp-devel] trans() changed in latest RcppArmadillo
Hello, After upgrading to the 0.2.21 release of RcppArmadillo, my previously working code (across many functions) ceased working (on a Windows XP installation). I re-installed the previous version (0.2.20) from CRAN (via a server location not yet updated to 0.2.21); didn't fix it. The timing may be a coincidence, though reading the post on trans() encourages me to make this post. While I use 'trans' across my functions, it is not applied on complex-valued matrices; only real-valued. So the prior post wouldn't explain my issue. Thanks, Terrance Savitsky __ This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ___ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel