-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compute trace and determinant #9
Comments
The Faq mentions:
In gonum this is done using the LU factorization of the matrix.
|
Yeah, I know it's not very stable. There is no LU factorization here yet, but the Schur form can be used for now (although it is more costly; the determinant will be unstable for large matrices anyway) |
742c60f introduced the two functions. |
I'm too new to nim and this to make a PR, but I cobbled together a cholesky decomp. I'm not sure if I used the T right since I think that has to be float64 with the dpotrf call.. proc cholesky*[T](a: Matrix[T]): Matrix[T] =
var
h = a.clone()
n = a.ld.cint
info: cint
ulo: cstring
ulo = "L"
dpotrf(ulo, addr n, h.fp, addr n, addr info)
if info > 0:
raise newException(LinearAlgebraError, "ERROR finding the LU decomp")
for i in 0 ..< n:
for j in i + 1 ..< n:
h[i, j] = 0.0
return h awesome work on this package! |
The computation of eigenvalues can be used for the determinant, or perhaps there is a more specific LAPACK function
The text was updated successfully, but these errors were encountered: