chol                 package:Matrix                 R Documentation

_C_h_o_l_e_s_k_i _D_e_c_o_m_p_o_s_i_t_i_o_n - '_M_a_t_r_i_x' _S_4 _G_e_n_e_r_i_c

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

     Compute the Choleski factorization of a real symmetric
     positive-definite square matrix.

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

     chol(x, ...)
     ## S4 method for signature 'dsCMatrix':
     chol(x, pivot = FALSE, ...)

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

       x: a (sparse or dense) square matrix, here inheriting from class
          'Matrix'; if 'x' is not positive definite, an error is
          signalled.

   pivot: logical indicating if pivoting is used.

     ...: potentially further arguments passed to methods.

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

     a matrix of class 'Cholesky', i.e., upper triangular: R such that
     R R' = x.

_M_e_t_h_o_d_s:

     Use 'showMethods(chol)' to see all; some are worth mentioning
     here:

     _c_h_o_l 'signature(x = "dgeMatrix")': works via '"dpoMatrix"', see
          class 'dpoMatrix'.

     _c_h_o_l 'signature(x = "dpoMatrix")': Returns (and stores) the
          Cholesky decomposition of 'x', via LAPACK routines 'dlacpy'
          and 'dpotrf'.

     _c_h_o_l 'signature(x = "dppMatrix")': Returns (and stores) the
          Cholesky decomposition via LAPACK routine 'dpptrf'.

     _c_h_o_l 'signature(x = "dsCMatrix", pivot = "logical")': Returns (and
          stores) the Cholesky decomposition of 'x'.  If 'pivot' is
          'TRUE' (the default) the Approximate Minimal Degree (AMD)
          algorithm is used to create a reordering of the rows and
          columns of 'x' so as to reduce fill-in.

_R_e_f_e_r_e_n_c_e_s:

     Timothy A. Davis (2006) _Direct Methods for Sparse Linear
     Systems_, SIAM Series Fundamentals of Algorithms.

     Tim Davis (1996), An approximate minimal degree ordering
     algorithm, _SIAM J. Matrix Analysis and Applications_, *17*, 4,
     886-905.

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

     The default from 'base', 'chol'.

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

     showMethods(chol, inherited = FALSE) # show different methods

     sy2 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, NA,32,77))
     (c2 <- chol(sy2))#-> "Cholesky" matrix
     stopifnot(all.equal(c2, chol(as(sy2, "dpoMatrix")), tol= 1e-13))
     str(c2)

     ## An example where chol() can't work
     (sy3 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, -1, 2, -7)))
     try(chol(sy3)) # error, since it is not positive definite

