Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

SVD.pseudoSolve #45

Open
fommil opened this issue Apr 11, 2014 · 0 comments
Open

SVD.pseudoSolve #45

fommil opened this issue Apr 11, 2014 · 0 comments

Comments

@fommil
Copy link
Owner

fommil commented Apr 11, 2014

e.g. (in Scala)

def pseudoSolve(m: Matrix, b: Vector) = {
    val svd = SVD.factorize(m)
    val ps = new BandMatrix(m.numRows(), 0, 0)
    // calculate pseudo-inverse of sigma
    svd.getS.zipWithIndex.foreach { case (v, i) =>
        if (v > 0.001) ps.set(i, i, 1 / v)
    }
    val tmpA = new DenseVector(b.size())
    svd.getU.transMult(b, tmpA)
    val tmpB = new DenseVector(b.size())
    ps.mult(tmpA, tmpB)
    tmpA
    svd.getVt.transMult(tmpB, tmpA)
  }

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant