forked from kscience/kmath
infix dot forgotten
This commit is contained in:
parent
581c13c573
commit
03455a3beb
@ -229,7 +229,7 @@ public open class DoubleTensorAlgebra : TensorPartialDivisionAlgebra<Double, Dou
|
|||||||
return this.view(other.shape)
|
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) {
|
if (this.shape.size == 1 && other.shape.size == 1) {
|
||||||
return DoubleTensor(intArrayOf(1), doubleArrayOf(this.times(other).buffer.array().sum()))
|
return DoubleTensor(intArrayOf(1), doubleArrayOf(this.times(other).buffer.array().sum()))
|
||||||
}
|
}
|
||||||
|
@ -203,14 +203,14 @@ internal inline fun DoubleLinearOpsTensorAlgebra.qrHelper(
|
|||||||
val vv = v.as1D()
|
val vv = v.as1D()
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
for (i in 0 until j) {
|
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) {
|
for (k in 0 until n) {
|
||||||
val qTi = qT[i].as1D()
|
val qTi = qT[i].as1D()
|
||||||
vv[k] = vv[k] - r[i, j] * qTi[k]
|
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) {
|
for (i in 0 until n) {
|
||||||
qM[i, j] = vv[i] / r[j, j]
|
qM[i, j] = vv[i] / r[j, j]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user