Feature/tensors performance #497
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user