Skip to contents

Via the eigen package

Usage

eigen_inv(X, num_cores = 1)

Arguments

X

A numeric matrix of size p x p

num_cores

The number of cores to use. Unless p is large, keep to the default of 1.

Value

The resulting matrix

Examples

  p = 10
  eigen_inv(matrix(rnorm(p^2), nrow = p))
#>            [,1]       [,2]       [,3]       [,4]       [,5]        [,6]
#>  [1,] -2.763419 -1.0521017 -2.8202395 -1.1863866 -0.7613895 -0.26469410
#>  [2,]  0.280314 -0.4441744  0.5129429 -0.3855036  0.6588994 -0.32210827
#>  [3,]  3.117086  1.6697614  4.2132832  1.5200414  0.3803903  0.84172739
#>  [4,]  1.026591  0.3166369  1.3824245  0.3834156  0.4319651 -0.10381343
#>  [5,]  3.248413  1.6592417  4.2278248  1.7051086  1.2058629  0.43247100
#>  [6,] -1.364801 -0.3454313 -1.1387220 -0.6813263 -0.2623399  0.05198132
#>  [7,]  1.231049  0.9162627  2.2541743  0.6841954  0.7554866 -0.16041297
#>  [8,] -1.478194 -0.7675197 -2.4934030 -0.8954730 -0.3720449 -0.58285101
#>  [9,]  1.670830  1.1008050  2.0839895  0.6836001  0.2197600  0.38582682
#> [10,] -6.733663 -2.7817606 -7.8523006 -3.2824203 -1.4749914 -1.29348881
#>             [,7]       [,8]      [,9]      [,10]
#>  [1,] -0.8296822  1.8274087  3.326112  1.6110929
#>  [2,] -0.0348326  0.5080749 -0.221938  1.3104541
#>  [3,]  1.5100528 -3.0991596 -4.064921 -2.9068234
#>  [4,]  0.1979634 -0.5793456 -1.332974 -0.3745257
#>  [5,]  0.9571172 -2.9250362 -4.546277 -2.2358427
#>  [6,] -0.4523373  0.9370717  1.789992  0.6924929
#>  [7,]  0.2917878 -1.2325406 -2.043799 -0.1976313
#>  [8,] -0.4193239  1.7144123  1.448718  1.3131413
#>  [9,]  0.5103697 -1.7478087 -2.083462 -1.5690175
#> [10,] -2.0753702  5.3978756  8.468221  4.9372977