Displaying 1 result from an estimated 1 matches for "b44c8e8d".
2012 Jul 05
1
Fast trace of inverse
Suppose I have a square matrix A like the toy below
set.seed(1234)
(A <- matrix(rnorm(9), nrow = 3))
I want to trace of the inverse of A. I could do
> sum(diag(solve(A)))
[1] 1.259641
Or I could also do
> sum(1/eigen(A)$values)
[1] 1.259641+0i
Now, my actual problem involves a very large, square dense matrix. Is step 2 still the best R-ish way of doing this or is there a smarter and