# L-12 MCS 471 Mon 19 Sep 2022 : ourcholesky.jl # Illustrates the formulas for the Cholesky factorization # of a symmetric positive definite matrix. """ ourCholesky(mat::Array{Float64,2}) Performs an inplace Cholesky factorization on mat. """ function ourCholesky(mat::Array{Float64,2}) nbrows, nbcols = size(mat) for col=1:nbcols for idx in 1:col-1 mat[col, col] = mat[col, col] - mat[col, idx]^2; end mat[col, col] = sqrt(mat[col, col]) for row in col+1: nbrows for idx in 1:col-1 mat[row, col] = mat[row, col] - mat[row, idx]*mat[col, idx] end mat[row, col] = mat[row, col]/mat[col, col] end end end