Added strides equality and fixed tests
This commit is contained in:
parent
f356e8956b
commit
4c1547ba5c
@ -56,9 +56,7 @@ data class Complex(val re: Double, val im: Double) : FieldElement<Complex, Compl
|
|||||||
val abs: Double
|
val abs: Double
|
||||||
get() = kotlin.math.sqrt(square)
|
get() = kotlin.math.sqrt(square)
|
||||||
|
|
||||||
companion object {
|
companion object
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Double.toComplex() = Complex(this, 0.0)
|
fun Double.toComplex() = Complex(this, 0.0)
|
@ -24,9 +24,7 @@ inline class Real(val value: Double) : FieldElement<Double, Real, RealField> {
|
|||||||
|
|
||||||
override val context get() = RealField
|
override val context get() = RealField
|
||||||
|
|
||||||
companion object {
|
companion object
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,6 +102,20 @@ class DefaultStrides private constructor(override val shape: IntArray) : Strides
|
|||||||
override val linearSize: Int
|
override val linearSize: Int
|
||||||
get() = strides[shape.size]
|
get() = strides[shape.size]
|
||||||
|
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (other !is DefaultStrides) return false
|
||||||
|
|
||||||
|
if (!shape.contentEquals(other.shape)) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return shape.contentHashCode()
|
||||||
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val defaultStridesCache = HashMap<IntArray, Strides>()
|
private val defaultStridesCache = HashMap<IntArray, Strides>()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user