Golub-Kahan SVD algorithm for KMP tensors #499

Closed
grinisrit wants to merge 64 commits from dev into dev
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 68609d7846 - Show all commits

View File

@ -841,7 +841,7 @@ public open class DoubleTensorAlgebra :
val size = tensor.dimension val size = tensor.dimension
val commonShape = tensor.shape.sliceArray(0 until size - 2) val commonShape = tensor.shape.sliceArray(0 until size - 2)
val (n, m) = tensor.shape.sliceArray(size - 2 until size) val (n, m) = tensor.shape.sliceArray(size - 2 until size)
val uTensor = zeros(commonShape + intArrayOf(m, n)) val uTensor = zeros(commonShape + intArrayOf(n, m))
val sTensor = zeros(commonShape + intArrayOf(m)) val sTensor = zeros(commonShape + intArrayOf(m))
val vTensor = zeros(commonShape + intArrayOf(m, m)) val vTensor = zeros(commonShape + intArrayOf(m, m))
@ -863,7 +863,7 @@ public open class DoubleTensorAlgebra :
iterations, epsilon) iterations, epsilon)
} }
return Triple(uTensor.transpose(), sTensor, vTensor) return Triple(uTensor, sTensor, vTensor)
} }
/** /**

View File

@ -647,9 +647,9 @@ internal fun MutableStructure2D<Double>.svdGolubKahanHelper(u: MutableStructure2
} }
} }
for (i in 0 until m) { for (i in 0 until n) {
for (j in 0 until n) { for (j in 0 until m) {
u[j, i] = this[i, j] u[j, i] = this[j, i]
} }
} }
} }