posdefify              package:sfsmisc              R Documentation

_F_i_n_d _a _C_l_o_s_e _P_o_s_i_t_i_v_e _D_e_f_i_n_i_t_e _M_a_t_r_i_x

_D_e_s_c_r_i_p_t_i_o_n:

     From a matrix 'm', construct a _"close"_ positive definite one.

_U_s_a_g_e:

     posdefify(m, method = c("someEVadd", "allEVadd"), symmetric, eps.ev = 1e-07)

_A_r_g_u_m_e_n_t_s:

       m: a numeric (square) matrix.

  method: a string specifying the method to apply; can be abbreviated.

symmetric: logical, simply passed to 'eigen'.

  eps.ev: number specifying the tolerance to use, see Details below.

_D_e_t_a_i_l_s:

     We form the eigen decomposition

                              m = V L V'

     where L is the diagonal matrix of eigenvalues, L[j,j] = l[j], with
     _decreasing_ eigenvalues l[1] >= l[2] >= ... >= l[n].

     When the smallest eigenvalue l[n] are less than 'Eps <- eps.ev *
     abs(lambda[1])', i.e., negative or "almost zero", some or all
     eigenvalues are replaced by _positive_ ('>= Eps') values, L~[j,j]
     = l~[j]. Then, m~ = V L~ V' is computed and rescaled in order to
     keep the original diagonal (where that is '>= Eps').

_V_a_l_u_e:

     a matrix of the same dimensions and the "same" diagonal (i.e.
     'diag') as 'm' but with the property to be positive definite.

_A_u_t_h_o_r(_s):

     Martin Maechler

_S_e_e _A_l_s_o:

     'eigen' on which the current methods rely.

_E_x_a_m_p_l_e_s:

      set.seed(12)
      m <- matrix(round(rnorm(25),2), 5, 5); m <- 1+ m + t(m); diag(m) <- diag(m) + 4
      m
      posdefify(m)
      1000 * zapsmall(m - posdefify(m))

