From 2c21f5669568a6a254c108199ebc68faa9aced09 Mon Sep 17 00:00:00 2001 From: Iaroslav Date: Mon, 21 Sep 2020 19:00:55 +0700 Subject: [PATCH] Add missing public visibilities and add @author markers --- .../kotlin/kscience/kmath/ejml/EjmlMatrix.kt | 1 + .../kscience/kmath/ejml/EjmlMatrixContext.kt | 17 +++++++++++------ .../kotlin/kscience/kmath/ejml/EjmlVector.kt | 3 ++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt index 478d9c6f8..15574489e 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt +++ b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrix.kt @@ -12,6 +12,7 @@ import kscience.kmath.structures.NDStructure * Represents featured matrix over EJML [SimpleMatrix]. * * @property origin the underlying [SimpleMatrix]. + * @author Iaroslav Postovalov */ public class EjmlMatrix(public val origin: SimpleMatrix, features: Set? = null) : FeaturedMatrix { public override val rowNum: Int diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt index b2d99ac3d..52826a7b1 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt +++ b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlMatrixContext.kt @@ -9,6 +9,8 @@ import kscience.kmath.structures.Matrix /** * Represents context of basic operations operating with [EjmlMatrix]. + * + * @author Iaroslav Postovalov */ public class EjmlMatrixContext(private val space: Space) : MatrixContext { /** @@ -32,22 +34,22 @@ public class EjmlMatrixContext(private val space: Space) : MatrixContext } }) - override fun Matrix.dot(other: Matrix): EjmlMatrix = + public override fun Matrix.dot(other: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin.mult(other.toEjml().origin)) - override fun Matrix.dot(vector: Point): EjmlVector = + public override fun Matrix.dot(vector: Point): EjmlVector = EjmlVector(toEjml().origin.mult(vector.toEjml().origin)) - override fun add(a: Matrix, b: Matrix): EjmlMatrix = + public override fun add(a: Matrix, b: Matrix): EjmlMatrix = EjmlMatrix(a.toEjml().origin + b.toEjml().origin) - override operator fun Matrix.minus(b: Matrix): EjmlMatrix = + public override operator fun Matrix.minus(b: Matrix): EjmlMatrix = EjmlMatrix(toEjml().origin - b.toEjml().origin) - override fun multiply(a: Matrix, k: Number): EjmlMatrix = + public override fun multiply(a: Matrix, k: Number): EjmlMatrix = produce(a.rowNum, a.colNum) { i, j -> space { a[i, j] * k } } - override operator fun Matrix.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value)) + public override operator fun Matrix.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value)) public companion object } @@ -58,6 +60,7 @@ public class EjmlMatrixContext(private val space: Space) : MatrixContext * @param a the base matrix. * @param b n by p matrix. * @return the solution for 'x' that is n by p. + * @author Iaroslav Postovalov */ public fun EjmlMatrixContext.solve(a: Matrix, b: Matrix): EjmlMatrix = EjmlMatrix(a.toEjml().origin.solve(b.toEjml().origin)) @@ -68,6 +71,7 @@ public fun EjmlMatrixContext.solve(a: Matrix, b: Matrix): EjmlMa * @param a the base matrix. * @param b n by p vector. * @return the solution for 'x' that is n by p. + * @author Iaroslav Postovalov */ public fun EjmlMatrixContext.solve(a: Matrix, b: Point): EjmlVector = EjmlVector(a.toEjml().origin.solve(b.toEjml().origin)) @@ -77,5 +81,6 @@ public fun EjmlMatrixContext.solve(a: Matrix, b: Point): EjmlVec * * @param a the matrix. * @return the inverse of this matrix. + * @author Iaroslav Postovalov */ public fun EjmlMatrixContext.inverse(a: Matrix): EjmlMatrix = EjmlMatrix(a.toEjml().origin.invert()) diff --git a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt index ccd660cc6..b3a19849f 100644 --- a/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt +++ b/kmath-ejml/src/main/kotlin/kscience/kmath/ejml/EjmlVector.kt @@ -8,8 +8,9 @@ import kscience.kmath.structures.Buffer * Represents point over EJML [SimpleMatrix]. * * @property origin the underlying [SimpleMatrix]. + * @author Iaroslav Postavalov */ -class EjmlVector internal constructor(val origin: SimpleMatrix) : Point { +public class EjmlVector internal constructor(public val origin: SimpleMatrix) : Point { override val size: Int get() = origin.numRows() init {