KMP library for tensors #300
@ -2,7 +2,6 @@ package space.kscience.kmath.tensors.core
|
|||||||
|
|
||||||
import space.kscience.kmath.tensors.TensorAlgebra
|
import space.kscience.kmath.tensors.TensorAlgebra
|
||||||
import space.kscience.kmath.tensors.TensorStructure
|
import space.kscience.kmath.tensors.TensorStructure
|
||||||
import kotlin.math.abs
|
|
||||||
|
|
||||||
|
|
||||||
internal inline fun <T, TensorType : TensorStructure<T>,
|
internal inline fun <T, TensorType : TensorStructure<T>,
|
||||||
@ -71,13 +70,4 @@ internal inline fun DoubleLinearOpsTensorAlgebra.checkPositiveDefinite(
|
|||||||
check(mat.asTensor().detLU().value() > 0.0){
|
check(mat.asTensor().detLU().value() > 0.0){
|
||||||
"Tensor contains matrices which are not positive definite ${mat.asTensor().detLU().value()}"
|
"Tensor contains matrices which are not positive definite ${mat.asTensor().detLU().value()}"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
internal inline fun DoubleLinearOpsTensorAlgebra.checkNonSingularMatrix(tensor: DoubleTensor): Unit {
|
|
||||||
for( mat in tensor.matrixSequence()) {
|
|
||||||
val detTensor = mat.asTensor().detLU()
|
|
||||||
check(!(detTensor.eq(detTensor.zeroesLike()))){
|
|
||||||
"Tensor contains matrices which are singular"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user