let G = root(A) be the Cholesky root of the matrix A log(det(A)) = 2*sum(log(vecdiag(G)))
| 36 | // let G = root(A) be the Cholesky root of the matrix A |
| 37 | // log(det(A)) = 2*sum(log(vecdiag(G))) |
| 38 | XlaOp LogDet(XlaOp a) { |
| 39 | XlaOp cholesky = Cholesky(a, /*bool lower=*/true); |
| 40 | |
| 41 | return ScalarLike(a, 2) * |
| 42 | Einsum(Log(cholesky), "...aa->...", xla::PrecisionConfig::HIGHEST); |
| 43 | } |
| 44 | |
| 45 | } // namespace xla |