Change package and specify public visibilities, fix old plugin ID

This commit is contained in:
Iaroslav 2020-09-21 18:59:02 +07:00
parent 029f534cc2
commit 267b6086a9
No known key found for this signature in database
GPG Key ID: 46E15E4A31B3BCD7
4 changed files with 33 additions and 33 deletions

View File

@ -1,5 +1,5 @@
plugins {
id("scientifik.jvm")
id("ru.mipt.npm.jvm")
}
dependencies {

View File

@ -1,29 +1,29 @@
package scientifik.kmath.ejml
package kscience.kmath.ejml
import org.ejml.dense.row.factory.DecompositionFactory_DDRM
import org.ejml.simple.SimpleMatrix
import scientifik.kmath.linear.DeterminantFeature
import scientifik.kmath.linear.FeaturedMatrix
import scientifik.kmath.linear.LUPDecompositionFeature
import scientifik.kmath.linear.MatrixFeature
import scientifik.kmath.structures.NDStructure
import kscience.kmath.linear.DeterminantFeature
import kscience.kmath.linear.FeaturedMatrix
import kscience.kmath.linear.LUPDecompositionFeature
import kscience.kmath.linear.MatrixFeature
import kscience.kmath.structures.NDStructure
/**
* Represents featured matrix over EJML [SimpleMatrix].
*
* @property origin the underlying [SimpleMatrix].
*/
class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null) : FeaturedMatrix<Double> {
override val rowNum: Int
public class EjmlMatrix(public val origin: SimpleMatrix, features: Set<MatrixFeature>? = null) : FeaturedMatrix<Double> {
public override val rowNum: Int
get() = origin.numRows()
override val colNum: Int
public override val colNum: Int
get() = origin.numCols()
override val shape: IntArray
public override val shape: IntArray
get() = intArrayOf(origin.numRows(), origin.numCols())
override val features: Set<MatrixFeature> = setOf(
public override val features: Set<MatrixFeature> = setOf(
object : LUPDecompositionFeature<Double>, DeterminantFeature<Double> {
override val determinant: Double
get() = origin.determinant()
@ -50,21 +50,21 @@ class EjmlMatrix(val origin: SimpleMatrix, features: Set<MatrixFeature>? = null)
}
) union features.orEmpty()
override fun suggestFeature(vararg features: MatrixFeature): FeaturedMatrix<Double> =
public override fun suggestFeature(vararg features: MatrixFeature): FeaturedMatrix<Double> =
EjmlMatrix(origin, this.features + features)
override operator fun get(i: Int, j: Int): Double = origin[i, j]
public override operator fun get(i: Int, j: Int): Double = origin[i, j]
override fun equals(other: Any?): Boolean {
public override fun equals(other: Any?): Boolean {
if (other is EjmlMatrix) return origin.isIdentical(other.origin, 0.0)
return NDStructure.equals(this, other as? NDStructure<*> ?: return false)
}
override fun hashCode(): Int {
public override fun hashCode(): Int {
var result = origin.hashCode()
result = 31 * result + features.hashCode()
return result
}
override fun toString(): String = "EjmlMatrix(origin=$origin, features=$features)"
public override fun toString(): String = "EjmlMatrix(origin=$origin, features=$features)"
}

View File

@ -1,26 +1,26 @@
package scientifik.kmath.ejml
package kscience.kmath.ejml
import org.ejml.simple.SimpleMatrix
import scientifik.kmath.linear.MatrixContext
import scientifik.kmath.linear.Point
import scientifik.kmath.operations.Space
import scientifik.kmath.operations.invoke
import scientifik.kmath.structures.Matrix
import kscience.kmath.linear.MatrixContext
import kscience.kmath.linear.Point
import kscience.kmath.operations.Space
import kscience.kmath.operations.invoke
import kscience.kmath.structures.Matrix
/**
* Represents context of basic operations operating with [EjmlMatrix].
*/
class EjmlMatrixContext(private val space: Space<Double>) : MatrixContext<Double> {
public class EjmlMatrixContext(private val space: Space<Double>) : MatrixContext<Double> {
/**
* Converts this matrix to EJML one.
*/
fun Matrix<Double>.toEjml(): EjmlMatrix =
public fun Matrix<Double>.toEjml(): EjmlMatrix =
if (this is EjmlMatrix) this else produce(rowNum, colNum) { i, j -> get(i, j) }
/**
* Converts this vector to EJML one.
*/
fun Point<Double>.toEjml(): EjmlVector =
public fun Point<Double>.toEjml(): EjmlVector =
if (this is EjmlVector) this else EjmlVector(SimpleMatrix(size, 1).also {
(0 until it.numRows()).forEach { row -> it[row, 0] = get(row) }
})
@ -49,7 +49,7 @@ class EjmlMatrixContext(private val space: Space<Double>) : MatrixContext<Double
override operator fun Matrix<Double>.times(value: Double): EjmlMatrix = EjmlMatrix(toEjml().origin.scale(value))
companion object
public companion object
}
/**
@ -59,7 +59,7 @@ class EjmlMatrixContext(private val space: Space<Double>) : MatrixContext<Double
* @param b n by p matrix.
* @return the solution for 'x' that is n by p.
*/
fun EjmlMatrixContext.solve(a: Matrix<Double>, b: Matrix<Double>): EjmlMatrix =
public fun EjmlMatrixContext.solve(a: Matrix<Double>, b: Matrix<Double>): EjmlMatrix =
EjmlMatrix(a.toEjml().origin.solve(b.toEjml().origin))
/**
@ -69,7 +69,7 @@ fun EjmlMatrixContext.solve(a: Matrix<Double>, b: Matrix<Double>): EjmlMatrix =
* @param b n by p vector.
* @return the solution for 'x' that is n by p.
*/
fun EjmlMatrixContext.solve(a: Matrix<Double>, b: Point<Double>): EjmlVector =
public fun EjmlMatrixContext.solve(a: Matrix<Double>, b: Point<Double>): EjmlVector =
EjmlVector(a.toEjml().origin.solve(b.toEjml().origin))
/**
@ -78,4 +78,4 @@ fun EjmlMatrixContext.solve(a: Matrix<Double>, b: Point<Double>): EjmlVector =
* @param a the matrix.
* @return the inverse of this matrix.
*/
fun EjmlMatrixContext.inverse(a: Matrix<Double>): EjmlMatrix = EjmlMatrix(a.toEjml().origin.invert())
public fun EjmlMatrixContext.inverse(a: Matrix<Double>): EjmlMatrix = EjmlMatrix(a.toEjml().origin.invert())

View File

@ -1,8 +1,8 @@
package scientifik.kmath.ejml
package kscience.kmath.ejml
import org.ejml.simple.SimpleMatrix
import scientifik.kmath.linear.Point
import scientifik.kmath.structures.Buffer
import kscience.kmath.linear.Point
import kscience.kmath.structures.Buffer
/**
* Represents point over EJML [SimpleMatrix].