From 09b82a891063630e170faf84fb15cf22490baf0f Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Mon, 14 Sep 2020 20:20:07 +0700 Subject: [PATCH] Override toString and contentEquals --- .../src/main/kotlin/scientifik/kmath/ejml/EjmlVector.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlVector.kt b/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlVector.kt index ab9d4e87c..dd7969e83 100644 --- a/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlVector.kt +++ b/kmath-ejml/src/main/kotlin/scientifik/kmath/ejml/EjmlVector.kt @@ -2,6 +2,7 @@ package scientifik.kmath.ejml import org.ejml.simple.SimpleMatrix import scientifik.kmath.linear.Point +import scientifik.kmath.structures.Buffer /** * Represents point over EJML [SimpleMatrix]. @@ -27,4 +28,11 @@ class EjmlVector internal constructor(val origin: SimpleMatrix) : Point override fun hasNext(): Boolean = cursor < origin.numCols() * origin.numRows() } + + override fun contentEquals(other: Buffer<*>): Boolean { + if (other is EjmlVector) return origin.isIdentical(other.origin, 0.0) + return super.contentEquals(other) + } + + override fun toString(): String = "EjmlVector(origin=$origin)" }