[Rcpp-devel] symmatu does not give symmetric matrix

Jendoubi, Takoua t.jendoubi14 at imperial.ac.uk
Thu Jul 21 12:46:14 CEST 2016


Dear all,

I am using RcppArmadillo to deal with some matrix computations. Specifically I need to cholesky factorization of some symmetric matrices.
I am generating random vectors using Rcpp and using them to construct symmetric matrices.
I have an error stating that my matrix is not symmetric although it definitely should be. Here is the example I am working with (in R):

>x
[1] -1.6683320 -0.8597148
>x%*%t(x)

         [,1]      [,2]

[1,] 2.783332 1.4342896

[2,] 1.434290 0.7391095

Apparently, it is a rounding-off error. Is there any way to ensure that x%*%t(x) gives an exactly symmetric matrix to use for cholesky factorization?
I tried symmatu and symmatl but the error is still there.

Thanks,
Best,

Takoua Jendoubi
PhD student
School of Public Health & Department of Surgery and Cancer
Main address :
Imperial College London | Room 171 | St Mary's Campus | Norfolk Place | London | W2 1PG |

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160721/2ed247c4/attachment.html>


More information about the Rcpp-devel mailing list