Bug with the `fastVDiag()` function
haziqj opened this issue · 0 comments
haziqj commented
Somehow, re-running the function on the same arguments returns different answers each time. Suspect that it keeps some results in memory and re-uses it.
> H <- fnH3(rnorm(5))
> fastVDiag(H, 1:5)
[,1] [,2] [,3] [,4] [,5]
[1,] 0.26970789 -0.1506874 -0.08902361 -0.3817465 0.3517496
[2,] -0.15068739 4.6687736 -2.03456593 -3.1172434 0.6337231
[3,] -0.08902361 -2.0345659 1.09680087 1.5941589 -0.5673703
[4,] -0.38174646 -3.1172434 1.59415895 3.0434338 -1.1386029
[5,] 0.35174956 0.6337231 -0.56737028 -1.1386029 0.7205005
> fastVDiag(H, 1:5)
[,1] [,2] [,3] [,4] [,5]
[1,] 3.345030 3.128946 -3.800166 -9.258419 6.584607
[2,] 3.128946 36.077689 -16.682934 -32.035877 9.512176
[3,] -3.800166 -16.682934 11.084884 19.345309 -9.947093
[4,] -9.258419 -32.035877 19.345309 42.646019 -20.697033
[5,] 6.584607 9.512176 -9.947093 -20.697033 14.547343
> fastVDiag(H, 1:5)
[,1] [,2] [,3] [,4] [,5]
[1,] 65.34335 67.02975 -84.8986 -189.4826 142.0081
[2,] 67.02975 404.40627 -184.4152 -424.4495 137.4287
[3,] -84.89860 -184.41523 155.6321 307.8244 -194.1427
[4,] -189.48262 -424.44951 307.8244 711.1323 -405.0246
[5,] 142.00813 137.42871 -194.1427 -405.0246 319.7304