Gan_SquMatrix smS, smL, *psmL; /* declare matrices S & L */ /* ... create and fill matrix S, which must be symmetric and positive definite, create L ... */ gan_symmat_cholesky_q ( &smS, &smL ); /* L = chol(S), OR */ psmL = gan_symmat_cholesky_s ( &smS ); /* L = chol(S) */ gan_symmat_cholesky_i ( &smS ); /* replace S = chol(S) */The last option gan_symmat_cholesky_i() replaces in-place by .
Error detection: If is not either symmetric or positive definite in the above routines, NULL is returned and the Gandalf error handler is invoked. Another failure mode is failing to create the result matrix.