Skip to content

Commit

Permalink
试图解决负的特征值
Browse files Browse the repository at this point in the history
  • Loading branch information
YdrMaster committed Mar 13, 2020
1 parent 71ff758 commit 798126f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

group = "org.mechdancer"
version = "0.2.8-dev-2"
version = "0.2.8-snapshot-3"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fun Matrix.svd(epsilon: Double = 1e-8): Triple<Matrix, Matrix, Matrix> {

fun partEvd(a: Matrix, at: Matrix): Triple<Matrix, Matrix, Matrix> {
val (m, square) = (a * at).evd(epsilon)!!
val s = square.diagonal.map { if (it < DOUBLE_PRECISION) .0 else sqrt(it) }
val s = square.diagonal.map { if (it < DOUBLE_PRECISION) DOUBLE_PRECISION else sqrt(it) }
val w = listMatrixOf(row, column) { r, c -> if (r == c) s[r] else .0 }
val others = (at * m * DiagonalMatrix(s.map { 1 / it }))
return Triple(m, w, others)
Expand Down

0 comments on commit 798126f

Please sign in to comment.