Skip to content

Compute trace and determinant #9

Description

@andreaferretti

The computation of eigenvalues can be used for the determinant, or perhaps there is a more specific LAPACK function

Activity

  1. andreaferretti commented on Jun 15, 2017

    @andreaferretti
    OwnerAuthor

    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)

  2. andreaferretti commented on Jun 16, 2017

    @andreaferretti
    OwnerAuthor

    742c60f introduced the two functions. det can be optimized, but as remarked it only makes sense for small matrices anyway, so it not much of an issue for now

  3. ryandvmartin commented on Aug 10, 2018

    @ryandvmartin

    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..
    anyway here it is:

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions