infix dot forgotten

This commit is contained in:
Roland Grinis 2021-03-30 14:36:59 +01:00
parent 581c13c573
commit 03455a3beb
2 changed files with 3 additions and 3 deletions

View File

@ -229,7 +229,7 @@ public open class DoubleTensorAlgebra : TensorPartialDivisionAlgebra<Double, Dou
return this.view(other.shape)
}
override fun DoubleTensor.dot(other: DoubleTensor): DoubleTensor {
override infix fun DoubleTensor.dot(other: DoubleTensor): DoubleTensor {
if (this.shape.size == 1 && other.shape.size == 1) {
return DoubleTensor(intArrayOf(1), doubleArrayOf(this.times(other).buffer.array().sum()))
}

View File

@ -203,14 +203,14 @@ internal inline fun DoubleLinearOpsTensorAlgebra.qrHelper(
val vv = v.as1D()
if (j > 0) {
for (i in 0 until j) {
r[i, j] = qT[i].dot(matrixT[j]).value()
r[i, j] = (qT[i] dot matrixT[j]).value()
for (k in 0 until n) {
val qTi = qT[i].as1D()
vv[k] = vv[k] - r[i, j] * qTi[k]
}
}
}
r[j, j] = DoubleAnalyticTensorAlgebra { v.dot(v).sqrt().value() }
r[j, j] = DoubleAnalyticTensorAlgebra { (v dot v).sqrt().value() }
for (i in 0 until n) {
qM[i, j] = vv[i] / r[j, j]
}