Programming using the R Matrix Package

  1. In versions of the Matrix package up to (and including) 0.999375-30, <determinant(CF) where CF <- Cholesky(A,*) has been computing the determinant of A, whereas e.g., determinant(chol(A)) has always returned the determinant of the Cholesky factor of A = RR' = L'L. Of course, det(A) = det(L)^2 = det(R)^2, or equivalently log(det(A)) = 2 * log(abs(det(L))) = 2 * log(abs(det(R))) which is what determinant() computes with its default setting logarithm = TRUE.

    This behavior is changed for consistency reasons, from Matrix version 0.999375-31 on, notably the upcoming Matrix 1.0-0. "Once per session" warnings are issued in version 0.999375-30 (before the change) and 0.999375-31 (after the change), possibly also for a few further releases.

    Those of you making use of determinant(Cholesky(.)) are strongly advised to make their R code work correctly in older and newer versions of Matrix with something like the following

      .f <- if(package_version(packageDescription("Matrix")$Version) >
               "0.999375-30") 2 else 1
      ## and use
      .f * determinant(myCholesky)$modulus