Three different things, despite the similar names – read the one
you need. tda_minvs is the actual matrix inverse of a
symmetric positive-definite matrix (TDA's minvs, via a
Cholesky-based algorithm; refuses if not positive definite).
tda_minvd inverts only the diagonal elements of A,
element by element – not a matrix inverse at all, and
off-diagonal entries are ignored entirely (TDA's minvd; a
zero diagonal entry is silently left as 0 rather than inverted).
tda_mginv is the Moore-Penrose pseudoinverse, requiring at
least as many rows as columns and full column rank (TDA's
mginv; prints the pseudorank as a side effect, discarded
here – read it from attr(x, "run")$output if needed).
See also
Other matrix algebra:
tda_mcel(),
tda_mcent(),
tda_mch(),
tda_mcross(),
tda_mdiag(),
tda_mev(),
tda_mevs(),
tda_midf(),
tda_midf1(),
tda_midf2(),
tda_midf3(),
tda_mkmet(),
tda_mkp(),
tda_mmul(),
tda_mnc(),
tda_mnrow(),
tda_mpbl(),
tda_mpfit(),
tda_mpinv(),
tda_mpit(),
tda_mple(),
tda_mpz(),
tda_mscal1(),
tda_msqrtd(),
tda_msvd(),
tda_mwvec()
Examples
A <- matrix(c(4, 2, 2, 3), 2)
tda_minvs(A) # == solve(A) for symmetric positive-definite A
#> [,1] [,2]
#> [1,] 0.375 -0.25
#> [2,] -0.250 0.50
tda_minvd(matrix(c(2, 1, 4, 5, 3, 8, 9, 7, 1), 3)) # diag(1/diag(.))
#> [,1] [,2] [,3]
#> [1,] 0.5 0.0000000 0
#> [2,] 0.0 0.3333333 0
#> [3,] 0.0 0.0000000 1
tda_mginv(matrix(c(1, 1, 1, 1, 2, 3), 3))
#> [,1] [,2] [,3]
#> [1,] 1.333333 3.333333e-01 -0.6666667
#> [2,] -0.500000 5.551115e-17 0.5000000