diff --git a/build.sbt b/build.sbt index 8e78845..7ac922a 100644 --- a/build.sbt +++ b/build.sbt @@ -56,7 +56,7 @@ lazy val verification = project .enablePlugins(NoPublishPlugin) .settings( name := "verification", - Compile / mainClass := Some("ai.dragonfly.math.Verify"), + Compile / mainClass := Some("verification.Verify"), libraryDependencies ++= Seq( "org.apache.commons" % "commons-math3" % "3.6.1", "gov.nist.math" % "jama" % "1.0.3" diff --git a/docs/basics/getting_started.md b/docs/basics/getting_started.md index c6bd564..6ec93e3 100644 --- a/docs/basics/getting_started.md +++ b/docs/basics/getting_started.md @@ -5,7 +5,7 @@ Let's create some vectors ```scala mdoc -import ai.dragonfly.math.vector.* +import slash.vector.* val v = Vec.fromTuple(1.0, 2.0, 3.0, 4.0, 5.0) val v2 = Vec[5](1.0, 2.0, 3.0, 4.0, 5.0) diff --git a/docs/demo/factorial.md b/docs/demo/factorial.md index 63bf3e0..db7ad29 100644 --- a/docs/demo/factorial.md +++ b/docs/demo/factorial.md @@ -4,7 +4,7 @@ Example ```scala mdoc import scala.language.postfixOps // don't forget this import -import ai.dragonfly.math.Factorial.! +import slash.Factorial.! for (x:Int <- Seq(1, 2, 3, 4, 8, 16, 32, 64, 100)) { println(s"${x}! = ${x!}") } diff --git a/docs/demo/gamma.md b/docs/demo/gamma.md index e71c71b..37afbc1 100644 --- a/docs/demo/gamma.md +++ b/docs/demo/gamma.md @@ -3,11 +3,10 @@ Try gamma function ```scala mdoc -import ai.dragonfly.math for ( i <- 1 until 10 ) { val i_1:Int = i - 1 - println(s"\tΓ($i):$i_1! => ${math.gamma(i.toDouble)} : ${math.Factorial(i_1)}") + println(s"\tΓ($i):$i_1! => ${slash.gamma(i.toDouble)} : ${slash.Factorial(i_1)}") } ``` diff --git a/docs/demo/logs.md b/docs/demo/logs.md index d06c208..0a259ae 100644 --- a/docs/demo/logs.md +++ b/docs/demo/logs.md @@ -3,8 +3,8 @@ Example ```scala mdoc -import ai.dragonfly.math.* -import ai.dragonfly.math.Constant +import slash.* +import slash.Constant log[4](16) diff --git a/docs/demo/poisson.md b/docs/demo/poisson.md index eaf3819..6a3b612 100644 --- a/docs/demo/poisson.md +++ b/docs/demo/poisson.md @@ -4,7 +4,7 @@ Example ```scala mdoc -import ai.dragonfly.math.stats.probability.distributions.Poisson +import slash.stats.probability.distributions.Poisson import narr.* val dist1 = Poisson(1) @@ -15,7 +15,7 @@ for (i <- 0 to 5) { dist1.μ dist1.`σ²` -val rand = ai.dragonfly.math.Random.defaultRandom +val rand = slash.Random.defaultRandom type N = 10000 val v : NArray[Long] = dist1.sample(10000, rand) diff --git a/docs/demo/scalarOps.md b/docs/demo/scalarOps.md index 254b450..22a5125 100644 --- a/docs/demo/scalarOps.md +++ b/docs/demo/scalarOps.md @@ -4,7 +4,7 @@ Example ```scala mdoc -import ai.dragonfly.math.vector.* +import slash.vector.* val v1 = Vec[2](1.5, 2.5) v1 + 2.0 diff --git a/docs/design/design.md b/docs/design/design.md index cbcbc1d..5de070a 100644 --- a/docs/design/design.md +++ b/docs/design/design.md @@ -62,7 +62,7 @@ package object vector { ``` Please consider also, the flexibility to enable types that use Vectors of varying sizes: ```scala -package ai.dragonfly.math.vector +package slash.vector import Vector.* // instead of putting the Vector type in the type parameter, just place the vector dimensionality. diff --git a/docs/index.md b/docs/index.md index 23ea338..6a65e2f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -20,7 +20,7 @@ using dep ai.dragonfly::slash:@VERSION@ ## Elevator pitch ```scala mdoc -import ai.dragonfly.math.vector.* +import slash.vector.* val aVector = Vec[3](1,2,3) val times2 = aVector * 2 aVector + times2 diff --git a/docs/matrix/matrix.md b/docs/matrix/matrix.md index 3d97c90..d0f7f93 100644 --- a/docs/matrix/matrix.md +++ b/docs/matrix/matrix.md @@ -1,7 +1,7 @@ # Matricies introduction ```scala mdoc -import ai.dragonfly.math.matrix.* +import slash.matrix.* // create a 3 x 2 matrix of zeros. val m:Matrix[3, 2] = Matrix.zeros[3, 2] ``` diff --git a/jsdocs/src/main/scala/poissonChart.scala b/jsdocs/src/main/scala/poissonChart.scala index da7f3be..6f9a5fc 100644 --- a/jsdocs/src/main/scala/poissonChart.scala +++ b/jsdocs/src/main/scala/poissonChart.scala @@ -3,22 +3,21 @@ package livechart import scala.scalajs.js import com.raquo.laminar.api.L.* import viz.vega.plots.Histogram -import ai.dragonfly.math.stats.probability.distributions.Poisson import narr.* - import viz.PlotTargets.doNothing - import viz.LaminarViz - import viz.vega.facades.VegaView import viz.vega.facades.Helpers.* -import ai.dragonfly.math.vector.Vec +import slash.vector.Vec import com.raquo.airstream.core.Signal import narr.native.NArr + import scala.scalajs.js.typedarray.Float64Array import io.circe.Encoder import io.circe.Decoder import io.circe.parser.decode +import slash.Random +import slash.stats.probability.distributions.Poisson case class HistogramBin( bin0: Double, @@ -27,7 +26,7 @@ case class HistogramBin( ) derives Decoder, Encoder.AsObject def poissonChart(): Div = { - val rand = ai.dragonfly.math.Random.defaultRandom + val rand = Random.defaultRandom val λ_ = Var[Double](5.0) val n_ = Var[Integer](1000) val poissonDist: Signal[Poisson] = λ_.signal.map(Poisson(_)) diff --git a/slash/jvm/src/main/scala/ai/dragonfly/math/matrix/native/package.scala b/slash/jvm/src/main/scala/ai/dragonfly/math/matrix/native/package.scala deleted file mode 100644 index 2bb39c5..0000000 --- a/slash/jvm/src/main/scala/ai/dragonfly/math/matrix/native/package.scala +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2023 dragonfly.ai - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ai.dragonfly.math.matrix - -package object native { - -} \ No newline at end of file diff --git a/slash/jvm/src/main/scala/ai/dragonfly/math/vector/native/package.scala b/slash/jvm/src/main/scala/ai/dragonfly/math/vector/native/package.scala deleted file mode 100644 index 1612ff0..0000000 --- a/slash/jvm/src/main/scala/ai/dragonfly/math/vector/native/package.scala +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2023 dragonfly.ai - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package ai.dragonfly.math.vector - -package object native { - -} diff --git a/slash/js/src/main/scala/ai/dragonfly/math/matrix/native/package.scala b/slash/jvm/src/main/scala/slash/matrix/native/package.scala similarity index 100% rename from slash/js/src/main/scala/ai/dragonfly/math/matrix/native/package.scala rename to slash/jvm/src/main/scala/slash/matrix/native/package.scala diff --git a/slash/js/src/main/scala/ai/dragonfly/math/vector/native/package.scala b/slash/jvm/src/main/scala/slash/vector/native/package.scala similarity index 100% rename from slash/js/src/main/scala/ai/dragonfly/math/vector/native/package.scala rename to slash/jvm/src/main/scala/slash/vector/native/package.scala diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/Bijection.scala b/slash/shared/src/main/scala/slash/Bijection.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/Bijection.scala rename to slash/shared/src/main/scala/slash/Bijection.scala index e8720c8..bb4878e 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/Bijection.scala +++ b/slash/shared/src/main/scala/slash/Bijection.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash trait Bijection[A, B](using a2b: A => B, b2a: B => A) { given Conversion[A, B] with diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/Constant.scala b/slash/shared/src/main/scala/slash/Constant.scala similarity index 97% rename from slash/shared/src/main/scala/ai/dragonfly/math/Constant.scala rename to slash/shared/src/main/scala/slash/Constant.scala index a69a60b..4467f57 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/Constant.scala +++ b/slash/shared/src/main/scala/slash/Constant.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash object Constant { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/Factorial.scala b/slash/shared/src/main/scala/slash/Factorial.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/Factorial.scala rename to slash/shared/src/main/scala/slash/Factorial.scala index b0f55bf..d00cd5d 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/Factorial.scala +++ b/slash/shared/src/main/scala/slash/Factorial.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash import scala.language.postfixOps diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/Gamma.scala b/slash/shared/src/main/scala/slash/Gamma.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/Gamma.scala rename to slash/shared/src/main/scala/slash/Gamma.scala index 5727ff9..934202f 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/Gamma.scala +++ b/slash/shared/src/main/scala/slash/Gamma.scala @@ -14,9 +14,8 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash -import ai.dragonfly.math import narr.* object Gamma { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/Random.scala b/slash/shared/src/main/scala/slash/Random.scala similarity index 93% rename from slash/shared/src/main/scala/ai/dragonfly/math/Random.scala rename to slash/shared/src/main/scala/slash/Random.scala index 15751cc..8995e0b 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/Random.scala +++ b/slash/shared/src/main/scala/slash/Random.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash -import ai.dragonfly.math.Constant.log2 -import ai.dragonfly.math.vector.{Vec, *} +import Constant.log2 +import slash.vector.* import Vec.* import narr.* @@ -33,7 +33,7 @@ object Random { private def digitCount(n: Int) = (n * log2).toInt def nextBigInt(precision: Int): BigInt = BigInt(bitCount(precision), r) def nextBigInt(norm: BigInt): BigInt = { - val precision: Int = digitCount(norm.bitLength); + val precision: Int = digitCount(norm.bitLength) (BigDecimal(norm)(new MathContext(precision + 1)) * BigDecimal(nextBigInt(precision))).toBigInt } def between(min: BigInt, MAX: BigInt): BigInt = min + r.nextBigInt(MAX - min) diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/accumulation/Accumulator.scala b/slash/shared/src/main/scala/slash/accumulation/Accumulator.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/accumulation/Accumulator.scala rename to slash/shared/src/main/scala/slash/accumulation/Accumulator.scala index 0dffc4d..78f03c4 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/accumulation/Accumulator.scala +++ b/slash/shared/src/main/scala/slash/accumulation/Accumulator.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math.accumulation +package slash.accumulation trait Accumulator[T <: BigInt | BigDecimal] { def observe(n:T):Accumulator[T] diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/geometry/Line.scala b/slash/shared/src/main/scala/slash/geometry/Line.scala similarity index 95% rename from slash/shared/src/main/scala/ai/dragonfly/math/geometry/Line.scala rename to slash/shared/src/main/scala/slash/geometry/Line.scala index 4ccdfe3..96e1bb8 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/geometry/Line.scala +++ b/slash/shared/src/main/scala/slash/geometry/Line.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.geometry +package slash.geometry -import ai.dragonfly.math.vector.* -import Vec2.* +import slash.vector.* +import slash.vector.Vec2.* object Line { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/geometry/Tetrahedron.scala b/slash/shared/src/main/scala/slash/geometry/Tetrahedron.scala similarity index 86% rename from slash/shared/src/main/scala/ai/dragonfly/math/geometry/Tetrahedron.scala rename to slash/shared/src/main/scala/slash/geometry/Tetrahedron.scala index 66262fd..b89384d 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/geometry/Tetrahedron.scala +++ b/slash/shared/src/main/scala/slash/geometry/Tetrahedron.scala @@ -14,12 +14,13 @@ * limitations under the License. */ -package ai.dragonfly.math.geometry +package slash.geometry -import ai.dragonfly.math.stats.probability.distributions.Sampleable -import ai.dragonfly.math.vector.* -import ai.dragonfly.math.vector.Vec.* +import slash.vector.* +import slash.vector.Vec.* import narr.* +import slash.Random +import slash.stats.probability.distributions.Sampleable object Tetrahedron { @@ -46,7 +47,7 @@ case class Tetrahedron(vertices:NArray[Vec[3]]) extends Sampleable[Vec[3]] { def volume:Double = `1/6` * Math.abs(`v1-v4` dot (`v2-v4` ⨯ `v3-v4`)) - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Vec[3] = { + override def random(r:scala.util.Random = Random.defaultRandom): Vec[3] = { var w1 = r.nextDouble() var w2 = r.nextDouble() diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/interval/Domain.scala b/slash/shared/src/main/scala/slash/interval/Domain.scala similarity index 98% rename from slash/shared/src/main/scala/ai/dragonfly/math/interval/Domain.scala rename to slash/shared/src/main/scala/slash/interval/Domain.scala index ca7a66e..d3ea37f 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/interval/Domain.scala +++ b/slash/shared/src/main/scala/slash/interval/Domain.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math.interval +package slash.interval import Interval.* diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/interval/Interval.scala b/slash/shared/src/main/scala/slash/interval/Interval.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/interval/Interval.scala rename to slash/shared/src/main/scala/slash/interval/Interval.scala index da24e49..13c6f5b 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/interval/Interval.scala +++ b/slash/shared/src/main/scala/slash/interval/Interval.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.interval +package slash.interval -import ai.dragonfly.math.{nextDown, nextUp} -import ai.dragonfly.math.stats.probability.distributions.Sampleable +import slash.{nextDown, nextUp} +import slash.stats.probability.distributions.Sampleable import scala.reflect.ClassTag import scala.util.Random @@ -124,7 +124,7 @@ trait Interval[DOMAIN:ClassTag] extends Sampleable[DOMAIN] { def rangeContains(x: Double): Boolean // = Interval.rangeContains(this, x) - import ai.dragonfly.math.Random.* + import slash.Random.* override def random(r0:scala.util.Random = defaultRandom): DOMAIN// = Interval.randomFrom(this).asInstanceOf[DOMAIN] diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/interval/package.scala b/slash/shared/src/main/scala/slash/interval/package.scala similarity index 97% rename from slash/shared/src/main/scala/ai/dragonfly/math/interval/package.scala rename to slash/shared/src/main/scala/slash/interval/package.scala index 6f30bf4..81314d6 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/interval/package.scala +++ b/slash/shared/src/main/scala/slash/interval/package.scala @@ -14,11 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash package object interval { - import ai.dragonfly.math.interval.Interval.* + import slash.interval.Interval.* def `[]`(min: Long, MAX: Long): LongInterval = LongInterval(CLOSED, min, MAX) diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/Matrix.scala b/slash/shared/src/main/scala/slash/matrix/Matrix.scala similarity index 98% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/Matrix.scala rename to slash/shared/src/main/scala/slash/matrix/Matrix.scala index 1d20e12..f46a901 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/Matrix.scala +++ b/slash/shared/src/main/scala/slash/matrix/Matrix.scala @@ -14,11 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix +package slash.matrix -import ai.dragonfly.math.matrix.util.CannotExpressMatrixAsVector -import ai.dragonfly.math.vector.* -import ai.dragonfly.math.vector.Vec.* +import slash.matrix.util.CannotExpressMatrixAsVector +import slash.vector.* +import slash.vector.Vec.* import narr.* import scala.math.hypot @@ -56,7 +56,7 @@ object Matrix { */ def random[M <: Int, N <: Int]( maxNorm:Double = 1.0, - r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom + r:scala.util.Random = slash.Random.defaultRandom )(using ValueOf[M], ValueOf[N]): Matrix[M, N] = new Matrix( NArray.tabulate[NArray[Double]](valueOf[M])( _ => NArray.tabulate[Double](valueOf[N])( diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/Cholesky.scala b/slash/shared/src/main/scala/slash/matrix/decomposition/Cholesky.scala similarity index 95% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/Cholesky.scala rename to slash/shared/src/main/scala/slash/matrix/decomposition/Cholesky.scala index d1c65b5..d94e754 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/Cholesky.scala +++ b/slash/shared/src/main/scala/slash/matrix/decomposition/Cholesky.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.decomposition +package slash.matrix.decomposition -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.matrix.util.MatrixNotSymmetricPositiveDefinite +import slash.matrix.* +import slash.matrix.util.MatrixNotSymmetricPositiveDefinite import narr.* object Cholesky { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/Eigen.scala b/slash/shared/src/main/scala/slash/matrix/decomposition/Eigen.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/Eigen.scala rename to slash/shared/src/main/scala/slash/matrix/decomposition/Eigen.scala index ecd6852..aabac71 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/Eigen.scala +++ b/slash/shared/src/main/scala/slash/matrix/decomposition/Eigen.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.decomposition +package slash.matrix.decomposition -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.vector.Vec +import slash.matrix.* +import slash.vector.Vec import narr.* import scala.math.hypot diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/LU.scala b/slash/shared/src/main/scala/slash/matrix/decomposition/LU.scala similarity index 98% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/LU.scala rename to slash/shared/src/main/scala/slash/matrix/decomposition/LU.scala index dadeaf0..d3e8e37 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/LU.scala +++ b/slash/shared/src/main/scala/slash/matrix/decomposition/LU.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.decomposition +package slash.matrix.decomposition -import ai.dragonfly.math.matrix.* +import slash.matrix.* import narr.* object LU { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/QR.scala b/slash/shared/src/main/scala/slash/matrix/decomposition/QR.scala similarity index 97% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/QR.scala rename to slash/shared/src/main/scala/slash/matrix/decomposition/QR.scala index 118898a..a8fb30b 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/QR.scala +++ b/slash/shared/src/main/scala/slash/matrix/decomposition/QR.scala @@ -14,14 +14,14 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.decomposition +package slash.matrix.decomposition -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.vector.Vec +import slash.matrix.* +import slash.vector.Vec import narr.* import scala.math.hypot -//import ai.dragonfly.math.matrix.decomposition.SV.hypot +//import slash.matrix.decomposition.SV.hypot object QR { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/SV.scala b/slash/shared/src/main/scala/slash/matrix/decomposition/SV.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/SV.scala rename to slash/shared/src/main/scala/slash/matrix/decomposition/SV.scala index 1f8e805..cbb9c3a 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/decomposition/SV.scala +++ b/slash/shared/src/main/scala/slash/matrix/decomposition/SV.scala @@ -14,11 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.decomposition +package slash.matrix.decomposition -import ai.dragonfly.math.vector.* -import ai.dragonfly.math.vector.Vec.* -import ai.dragonfly.math.matrix.* +import slash.vector.* +import slash.vector.Vec.* +import slash.matrix.* import narr.* import scala.math.hypot import scala.compiletime.ops.int.* diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/data/Data.scala b/slash/shared/src/main/scala/slash/matrix/ml/data/Data.scala similarity index 98% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/data/Data.scala rename to slash/shared/src/main/scala/slash/matrix/ml/data/Data.scala index 0243211..dd372b7 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/data/Data.scala +++ b/slash/shared/src/main/scala/slash/matrix/ml/data/Data.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.ml.data +package slash.matrix.ml.data import narr.* -import ai.dragonfly.math.* +import slash.* import interval.* import Interval.* import vector.{Vec, *} diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegression.scala b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegression.scala similarity index 85% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegression.scala rename to slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegression.scala index ef169f8..eaa62f0 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegression.scala +++ b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegression.scala @@ -14,15 +14,15 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.ml.supervized.regression +package slash.matrix.ml.supervized.regression -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.matrix.ml.data.SupervisedData -import ai.dragonfly.math.matrix.ml.supervized -import ai.dragonfly.math.matrix.ml.supervized.regression +import slash.matrix.* +import slash.matrix.ml.data.SupervisedData +import slash.matrix.ml.supervized +import slash.matrix.ml.supervized.regression -import ai.dragonfly.math.stats.probability.distributions.{EstimatedGaussian} -import ai.dragonfly.math.vector.* +import slash.stats.probability.distributions.{EstimatedGaussian} +import slash.vector.* trait LinearRegression[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]) { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionModel.scala b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionModel.scala similarity index 87% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionModel.scala rename to slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionModel.scala index 6db53ca..98a9c9a 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionModel.scala +++ b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionModel.scala @@ -14,11 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.ml.supervized.regression +package slash.matrix.ml.supervized.regression -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.vector.* -import ai.dragonfly.math.vector.Vec.* +import slash.matrix.* +import slash.vector.* +import slash.vector.Vec.* /** * @param A diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionQR.scala b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionQR.scala similarity index 85% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionQR.scala rename to slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionQR.scala index cea20a9..1daa526 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionQR.scala +++ b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionQR.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.ml.supervized.regression +package slash.matrix.ml.supervized.regression -import ai.dragonfly.math.matrix.decomposition.QR -import ai.dragonfly.math.matrix.* +import slash.matrix.decomposition.QR +import slash.matrix.* class LinearRegressionQR[M <: Int, N <: Int](using ValueOf[M], ValueOf[N]) extends LinearRegression[M, N] { override def estimateBeta(X: Matrix[M, N], Y: Matrix[M, 1]): Matrix[N, 1] = QR[M, N](X).solve(Y) diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionSVD.scala b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionSVD.scala similarity index 88% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionSVD.scala rename to slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionSVD.scala index a6ebed2..81c2358 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/supervized/regression/LinearRegressionSVD.scala +++ b/slash/shared/src/main/scala/slash/matrix/ml/supervized/regression/LinearRegressionSVD.scala @@ -14,11 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.ml.supervized.regression +package slash.matrix.ml.supervized.regression - -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.matrix.decomposition.SV +import slash.matrix.* +import slash.matrix.decomposition.SV import scala.compiletime.ops.int.* diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/unsupervised/dimreduction/PCA.scala b/slash/shared/src/main/scala/slash/matrix/ml/unsupervised/dimreduction/PCA.scala similarity index 90% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/unsupervised/dimreduction/PCA.scala rename to slash/shared/src/main/scala/slash/matrix/ml/unsupervised/dimreduction/PCA.scala index 73408af..0641208 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/ml/unsupervised/dimreduction/PCA.scala +++ b/slash/shared/src/main/scala/slash/matrix/ml/unsupervised/dimreduction/PCA.scala @@ -14,16 +14,16 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.ml.unsupervised.dimreduction +package slash.matrix.ml.unsupervised.dimreduction -import ai.dragonfly.math.* +import slash.* -import ai.dragonfly.math.matrix.util.* -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.matrix.decomposition.SV -import ai.dragonfly.math.matrix.ml.data.* +import slash.matrix.util.* +import slash.matrix.* +import slash.matrix.decomposition.SV +import slash.matrix.ml.data.* -import ai.dragonfly.math.vector.* +import slash.vector.* import Vec.* import narr.* diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/util/Exceptions.scala b/slash/shared/src/main/scala/slash/matrix/util/Exceptions.scala similarity index 93% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/util/Exceptions.scala rename to slash/shared/src/main/scala/slash/matrix/util/Exceptions.scala index aa79676..4e5da2d 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/util/Exceptions.scala +++ b/slash/shared/src/main/scala/slash/matrix/util/Exceptions.scala @@ -14,9 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix.util +package slash.matrix.util -import ai.dragonfly.math.matrix.* +import slash.matrix.* +import slash.matrix.Matrix case class CannotExpressMatrixAsVector[M <: Int, N <: Int](m:Matrix[M, N]) extends Exception( s"To convert a Matrix to a Vector, one of its dimensions must be 1, but this matrix has dimensions: [${m.rows}x${m.columns}]" diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/util/util.scala b/slash/shared/src/main/scala/slash/matrix/util/util.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/matrix/util/util.scala rename to slash/shared/src/main/scala/slash/matrix/util/util.scala index a8a0e89..7229a8d 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/matrix/util/util.scala +++ b/slash/shared/src/main/scala/slash/matrix/util/util.scala @@ -14,12 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.matrix +package slash.matrix import narr.* -import ai.dragonfly.math.vector.{Vec, *} -import ai.dragonfly.math.matrix.* -import ai.dragonfly.math.matrix.decomposition.{SV, *} +import slash.vector.{Vec, *} +import slash.matrix.* +import slash.matrix.decomposition.{SV, *} import scala.compiletime.ops.int.* package object util { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/package.scala b/slash/shared/src/main/scala/slash/package.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/package.scala rename to slash/shared/src/main/scala/slash/package.scala index 23038c6..f62237d 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/package.scala +++ b/slash/shared/src/main/scala/slash/package.scala @@ -14,9 +14,7 @@ * limitations under the License. */ -package ai.dragonfly - -package object math { +package object slash { inline def squareInPlace(b:Byte): Byte = (b*b).toByte inline def squareInPlace(s:Short): Short = (s*s).toShort diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/BoundedMean.scala b/slash/shared/src/main/scala/slash/stats/BoundedMean.scala similarity index 94% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/BoundedMean.scala rename to slash/shared/src/main/scala/slash/stats/BoundedMean.scala index cd79512..de916fc 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/BoundedMean.scala +++ b/slash/shared/src/main/scala/slash/stats/BoundedMean.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.stats +package slash.stats -import ai.dragonfly.math.interval.Interval +import slash.interval.Interval import scala.reflect.ClassTag diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/LabeledVec.scala b/slash/shared/src/main/scala/slash/stats/LabeledVec.scala similarity index 94% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/LabeledVec.scala rename to slash/shared/src/main/scala/slash/stats/LabeledVec.scala index 4f96b77..550052b 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/LabeledVec.scala +++ b/slash/shared/src/main/scala/slash/stats/LabeledVec.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.stats +package slash.stats -import ai.dragonfly.math.vector.* +import slash.vector.* trait LabeledVec[N <: Int] { def label: Double diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/MeanAndVariance.scala b/slash/shared/src/main/scala/slash/stats/MeanAndVariance.scala similarity index 95% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/MeanAndVariance.scala rename to slash/shared/src/main/scala/slash/stats/MeanAndVariance.scala index 5aa6a12..8134252 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/MeanAndVariance.scala +++ b/slash/shared/src/main/scala/slash/stats/MeanAndVariance.scala @@ -14,6 +14,6 @@ * limitations under the License. */ -package ai.dragonfly.math.stats +package slash.stats case class MeanAndVariance[DOMAIN](μ:Double, `σ²`:Double, ℕ̂:DOMAIN) \ No newline at end of file diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/PointStatistics.scala b/slash/shared/src/main/scala/slash/stats/PointStatistics.scala similarity index 91% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/PointStatistics.scala rename to slash/shared/src/main/scala/slash/stats/PointStatistics.scala index 74161b9..2b16a68 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/PointStatistics.scala +++ b/slash/shared/src/main/scala/slash/stats/PointStatistics.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.stats +package slash.stats -import ai.dragonfly.math.interval.Interval +import slash.interval.Interval case class PointStatistics[DOMAIN](μ:Double, `σ²`:Double, bounds: Interval[DOMAIN], ℕ:DOMAIN) { def min:DOMAIN = bounds.min diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/UnivariateHistogram.scala b/slash/shared/src/main/scala/slash/stats/UnivariateHistogram.scala similarity index 98% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/UnivariateHistogram.scala rename to slash/shared/src/main/scala/slash/stats/UnivariateHistogram.scala index 88d5efa..4336bdc 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/UnivariateHistogram.scala +++ b/slash/shared/src/main/scala/slash/stats/UnivariateHistogram.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.stats +package slash.stats -import ai.dragonfly.math.stats.probability.distributions.Sampleable +import slash.stats.probability.distributions.Sampleable import scala.collection.{immutable, mutable} import scala.reflect.ClassTag @@ -266,7 +266,7 @@ class UnivariateGenerativeModel[T:ClassTag]( private val cumulative: immutable.TreeMap[Double, Int] ) extends Sampleable[T] { - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): T = { + override def random(r:scala.util.Random = slash.Random.defaultRandom): T = { val pX = r.nextDouble() * hist.mass val (top, bINdex) = cumulative.rangeTo(pX).last diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/kernel/Kernel.scala b/slash/shared/src/main/scala/slash/stats/kernel/Kernel.scala similarity index 93% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/kernel/Kernel.scala rename to slash/shared/src/main/scala/slash/stats/kernel/Kernel.scala index 1f51740..99b1c19 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/kernel/Kernel.scala +++ b/slash/shared/src/main/scala/slash/stats/kernel/Kernel.scala @@ -14,13 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.kernel +package slash.stats.kernel -import ai.dragonfly.math.* -import Constant.π -import ai.dragonfly.math.stats.probability.distributions.Gaussian -import ai.dragonfly.math.vector.* -import Vec.* +import slash.* +import Constant.* +import slash.stats.probability.distributions.Gaussian +import slash.vector.* import narr.* trait Kernel[N <: Int] { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Beta.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/Beta.scala similarity index 95% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Beta.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/Beta.scala index 0bee289..e5ccac7 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Beta.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/Beta.scala @@ -14,12 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.* +import slash.* +import slash.interval.* import stats.* -import interval.* -import Interval.* object Beta { @@ -64,7 +63,7 @@ case class Beta(α:Double, β:Double, min:Double = 0.0, MAX:Double = 1.0) extend // BB+BC version of Cheng's algorithm // ported from: https://commons.apache.org/proper/commons-math/javadocs/api-3.6.1/src-html/org/apache/commons/math3/distribution/BetaDistribution.html - override def random(rand:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Double = { + override def random(rand:scala.util.Random = slash.Random.defaultRandom): Double = { var w:Double = 0.0 if (α > 1 && β > 1) { // Cheng's BB algorithm var continue:Boolean = true diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Binomial.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/Binomial.scala similarity index 91% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Binomial.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/Binomial.scala index 8fd0b2d..8e80cad 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Binomial.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/Binomial.scala @@ -14,13 +14,13 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.* +import slash.* import stats.* -import ai.dragonfly.math.Factorial.! -import ai.dragonfly.math.interval.* -import Interval.* +import slash.Factorial.! +import slash.interval.* +import slash.interval.{Domain, Interval} import scala.language.postfixOps @@ -69,7 +69,7 @@ case class Binomial(n:Long, P:Double) extends ParametricProbabilityDistribution[ * Naive implementation not suitable for large N. * @return a random number of successes. */ - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Long = { + override def random(r:scala.util.Random = slash.Random.defaultRandom): Long = { var successCount = 0L var i:Long = 0L; while (i < n) { if (r.nextDouble() < P) successCount = successCount + 1L diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/DiscreteUniform.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/DiscreteUniform.scala similarity index 86% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/DiscreteUniform.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/DiscreteUniform.scala index 93f395c..2093e60 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/DiscreteUniform.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/DiscreteUniform.scala @@ -14,12 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.* +import slash.* import stats.* -import ai.dragonfly.math.interval.* -import Interval.* +import slash.interval.* +import slash.interval.{Domain, Interval} import scala.language.postfixOps @@ -43,7 +43,7 @@ case class DiscreteUniform(interval:Interval[Long]) extends ParametricProbabilit override def p(x:Long):Double = if (interval.contains(x)) `1 / (MAX-min)` else 0.0 - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Long = interval.min + r.nextLong(interval.MAX - interval.min) + override def random(r:scala.util.Random = slash.Random.defaultRandom): Long = interval.min + r.nextLong(interval.MAX - interval.min) override def toString: String = s"DiscreteUniform( min = ${interval.min}, μ = $μ, MAX = ${interval.MAX}, σ² = ${`σ²`}, σ = $σ )" diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/EstimatedProbabilityDistribution.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/EstimatedProbabilityDistribution.scala similarity index 91% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/EstimatedProbabilityDistribution.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/EstimatedProbabilityDistribution.scala index 7a9e0b4..0ffd793 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/EstimatedProbabilityDistribution.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/EstimatedProbabilityDistribution.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.interval.Interval +import slash.interval.* trait EstimatedProbabilityDistribution[DOMAIN: Numeric, PPD <: ParametricProbabilityDistribution[DOMAIN]] { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Gaussian.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/Gaussian.scala similarity index 86% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Gaussian.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/Gaussian.scala index 9df9bb3..7e36126 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Gaussian.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/Gaussian.scala @@ -14,12 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.* -import Constant.`√(2π)` +import slash.* +import Constant.* +import slash.interval.* import stats.* -import interval.* object Gaussian { @@ -39,7 +39,7 @@ case class Gaussian(override val μ:Double, override val `σ²`:Double) extends override inline def p(x: Double): Double = p2(squareInPlace(x - μ)) def p2(magSquared: Double): Double = `1/σ√(2π)` * Math.exp(`-1/(2σ²)` * magSquared) - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Double = μ + (r.nextGaussian() * σ) + override def random(r:scala.util.Random = slash.Random.defaultRandom): Double = μ + (r.nextGaussian() * σ) override def toString: String = s"Gaussian(μ = $μ, σ² = ${`σ²`}, σ = $σ)" } diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/LogNormal.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/LogNormal.scala similarity index 91% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/LogNormal.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/LogNormal.scala index 820a3d4..48a49b5 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/LogNormal.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/LogNormal.scala @@ -14,12 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.* +import slash.* +import Constant.* +import slash.interval.* import stats.* -import interval.* -import Constant.π // https://en.wikipedia.org/wiki/Log-normal_distribution#Generation_and_parameters @@ -55,7 +55,7 @@ case class LogNormal(override val μ:Double, override val `σ²`: Double) extend def p(x:Double):Double = LogNormal.p(x, μ, σ) - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Double = { + override def random(r:scala.util.Random = slash.Random.defaultRandom): Double = { Math.exp(G.random(r)) } diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/PERT.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/PERT.scala similarity index 78% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/PERT.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/PERT.scala index 2e628b7..597f5c7 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/PERT.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/PERT.scala @@ -14,13 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions - -import ai.dragonfly.math.{B, Random} -import ai.dragonfly.math.stats.* -import ai.dragonfly.math.interval.* -import Interval.* +import slash.{B, Random} +import slash.stats.* +import slash.interval.* +import slash.interval.Interval case class PERT(min:Double, mode:Double, MAX:Double) extends ParametricProbabilityDistribution[Double] { @@ -37,8 +36,8 @@ case class PERT(min:Double, mode:Double, MAX:Double) extends ParametricProbabili Math.pow(x - min, α - 1.0) * Math.pow(MAX - x, β - 1.0) / `B(α,β)*(MAX-min)^α+β-1` } - lazy val asBeta:probability.distributions.Beta = probability.distributions.Beta(α, β, min, MAX) - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Double = asBeta.random(r) + lazy val asBeta:Beta = probability.distributions.Beta(α, β, min, MAX) + override def random(r:scala.util.Random = slash.Random.defaultRandom): Double = asBeta.random(r) override def toString: String = s"PERT( min = ${interval.min}, μ = $μ, MAX = ${interval.MAX}, σ² = ${`σ²`}, σ = $σ )" diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Poisson.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/Poisson.scala similarity index 90% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Poisson.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/Poisson.scala index 4ab7c6b..0c728d3 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Poisson.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/Poisson.scala @@ -14,11 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions -import ai.dragonfly.math.* +import slash.* +import slash.interval.{Domain, Interval} import stats.* -import interval.* object Poisson { val domain:Domain[Long] = Domain.ℕ_Long @@ -44,7 +44,7 @@ case class Poisson(λ:Double) extends ParametricProbabilityDistribution[Long] { } // Knuth's method: - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Long = { + override def random(r:scala.util.Random = slash.Random.defaultRandom): Long = { var k = 0L var p = 1.0 while (p > L) { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/ProbabilityDistribution.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/ProbabilityDistribution.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/ProbabilityDistribution.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/ProbabilityDistribution.scala index 69caf3b..e72033c 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/ProbabilityDistribution.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/ProbabilityDistribution.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions import scala.reflect.ClassTag diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Sampleable.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/Sampleable.scala similarity index 70% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Sampleable.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/Sampleable.scala index 3135518..65062ef 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Sampleable.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/Sampleable.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions +package slash.stats.probability.distributions import narr.* @@ -22,8 +22,8 @@ import scala.reflect.ClassTag trait Sampleable[DOMAIN:ClassTag] { - def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): DOMAIN + def random(r:scala.util.Random = slash.Random.defaultRandom): DOMAIN - inline def sample(n: Int, r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): NArray[DOMAIN] = NArray.tabulate(n)(_ => random(r)) + inline def sample(n: Int, r:scala.util.Random = slash.Random.defaultRandom): NArray[DOMAIN] = NArray.tabulate(n)(_ => random(r)) } diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Uniform.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/Uniform.scala similarity index 88% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Uniform.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/Uniform.scala index 150f355..5257f87 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/Uniform.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/Uniform.scala @@ -14,14 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions - -import ai.dragonfly.math.* +package slash.stats.probability.distributions +import slash.* import stats.* -import ai.dragonfly.math.interval.* -import Interval.* - +import slash.interval.* +import slash.interval.{Domain, Interval} import scala.language.postfixOps @@ -47,7 +45,7 @@ case class Uniform(interval:Interval[Double]) extends ParametricProbabilityDistr override def p(x:Double):Double = if (interval.rangeContains(x)) `1 / (MAX-min)` else 0.0 - override def random(r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom): Double = { + override def random(r:scala.util.Random = slash.Random.defaultRandom): Double = { interval.random(r) } diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Beta.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Beta.scala similarity index 93% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Beta.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Beta.scala index e17116c..6d5abd5 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Beta.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Beta.scala @@ -14,11 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.interval.* -import ai.dragonfly.math.stats.* +import slash.interval.* +import slash.stats.* import probability.distributions +import slash.interval.Interval class Beta extends OnlineProbabilityDistributionEstimator[Double, distributions.Beta] with EstimatesPointStatistics[Double] { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Binomial.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Binomial.scala similarity index 92% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Binomial.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Binomial.scala index c256c4d..1e07ef2 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Binomial.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Binomial.scala @@ -14,13 +14,13 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.stats.probability.distributions -import ai.dragonfly.math.* -import ai.dragonfly.math.interval.* -import Interval.* -import ai.dragonfly.math.accumulation.DiscreteAccumulator +import slash.stats.probability.distributions +import slash.* +import slash.interval.* +import slash.accumulation.DiscreteAccumulator +import slash.interval.Interval import scala.language.postfixOps import scala.language.implicitConversions diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Gaussian.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Gaussian.scala similarity index 93% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Gaussian.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Gaussian.scala index 1c0276a..d9a3da0 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Gaussian.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Gaussian.scala @@ -14,11 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.interval.* -import ai.dragonfly.math.stats.* +import slash.interval.* +import slash.stats.* import probability.distributions +import slash.interval.Interval diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/LogNormal.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/LogNormal.scala similarity index 91% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/LogNormal.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/LogNormal.scala index 7757d00..8297fac 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/LogNormal.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/LogNormal.scala @@ -14,11 +14,12 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.interval.* -import ai.dragonfly.math.{ln, squareInPlace} -import ai.dragonfly.math.stats.probability.distributions +import slash.interval.* +import slash.{ln, squareInPlace} +import slash.stats.probability.distributions +import slash.interval.Interval class LogNormal extends OnlineProbabilityDistributionEstimator[Double, distributions.LogNormal] with EstimatesPointStatistics[Double] { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/OnlineEstimator.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/OnlineEstimator.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/OnlineEstimator.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/OnlineEstimator.scala index add8382..6ec2def 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/OnlineEstimator.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/OnlineEstimator.scala @@ -14,12 +14,13 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.* +import slash.* import stats.* -import ai.dragonfly.math.interval.* +import slash.interval.* import probability.distributions.* +import slash.interval.Interval import scala.reflect.ClassTag diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Poisson.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Poisson.scala similarity index 86% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Poisson.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Poisson.scala index e70c9fe..b42e685 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/Poisson.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/Poisson.scala @@ -14,13 +14,14 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.stats.probability.distributions -import ai.dragonfly.math.* -import ai.dragonfly.math.accumulation.DiscreteAccumulator -import ai.dragonfly.math.interval.* -import ai.dragonfly.math.interval.Interval.* +import slash.stats.probability.distributions +import slash.* +import slash.interval.* +import slash.interval.Interval.* +import slash.accumulation.DiscreteAccumulator +import slash.interval.Interval import scala.language.postfixOps import scala.language.implicitConversions diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/StreamingVectorStats.scala b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/StreamingVectorStats.scala similarity index 95% rename from slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/StreamingVectorStats.scala rename to slash/shared/src/main/scala/slash/stats/probability/distributions/stream/StreamingVectorStats.scala index b7a4f30..6388404 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/stats/probability/distributions/stream/StreamingVectorStats.scala +++ b/slash/shared/src/main/scala/slash/stats/probability/distributions/stream/StreamingVectorStats.scala @@ -14,11 +14,11 @@ * limitations under the License. */ -package ai.dragonfly.math.stats.probability.distributions.stream +package slash.stats.probability.distributions.stream -import ai.dragonfly.math.vector.* -import Vec.* +import slash.vector.* import narr.* +import slash.vector.VecBounds /** * Created by c on 1/10/17. diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/unicode/package.scala b/slash/shared/src/main/scala/slash/unicode/package.scala similarity index 99% rename from slash/shared/src/main/scala/ai/dragonfly/math/unicode/package.scala rename to slash/shared/src/main/scala/slash/unicode/package.scala index 7d08056..80a72c5 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/unicode/package.scala +++ b/slash/shared/src/main/scala/slash/unicode/package.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash package object unicode { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/vector/Vec2.scala b/slash/shared/src/main/scala/slash/vector/Vec2.scala similarity index 94% rename from slash/shared/src/main/scala/ai/dragonfly/math/vector/Vec2.scala rename to slash/shared/src/main/scala/slash/vector/Vec2.scala index 0b9775f..d6c5d01 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/vector/Vec2.scala +++ b/slash/shared/src/main/scala/slash/vector/Vec2.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -package ai.dragonfly.math.vector +package slash.vector -import ai.dragonfly.math.* +import slash.* import narr.* /** diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/vector/VecBounds.scala b/slash/shared/src/main/scala/slash/vector/VecBounds.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/vector/VecBounds.scala rename to slash/shared/src/main/scala/slash/vector/VecBounds.scala index 14a3b0b..c7103b8 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/vector/VecBounds.scala +++ b/slash/shared/src/main/scala/slash/vector/VecBounds.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -package ai.dragonfly.math.vector +package slash.vector import Vec.* case class VecBounds[N <: Int](min: Vec[N], MAX: Vec[N]) { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/vector/VectorSpace.scala b/slash/shared/src/main/scala/slash/vector/VectorSpace.scala similarity index 93% rename from slash/shared/src/main/scala/ai/dragonfly/math/vector/VectorSpace.scala rename to slash/shared/src/main/scala/slash/vector/VectorSpace.scala index 4c5e259..778cd65 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/vector/VectorSpace.scala +++ b/slash/shared/src/main/scala/slash/vector/VectorSpace.scala @@ -14,9 +14,10 @@ * limitations under the License. */ -package ai.dragonfly.math.vector +package slash.vector import narr.NArray +import slash.Random import scala.compiletime.ops.int.* @@ -61,12 +62,12 @@ class VectorSpace[N0 <: Int](using dt: ValueOf[N0]) { inline def ones: Vec[N] = apply(NArray.fill[Double](dimension)(1.0)) - import ai.dragonfly.math.Random.nextVec + import slash.Random.nextVec inline def random( MAX: Double = 1.0, min: Double = 0.0, - r: scala.util.Random = ai.dragonfly.math.Random.defaultRandom + r: scala.util.Random = Random.defaultRandom ): Vec[N] = r.nextVec[N](min, MAX) } diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/vector/WeightedVec.scala b/slash/shared/src/main/scala/slash/vector/WeightedVec.scala similarity index 96% rename from slash/shared/src/main/scala/ai/dragonfly/math/vector/WeightedVec.scala rename to slash/shared/src/main/scala/slash/vector/WeightedVec.scala index e693fe4..e743a31 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/vector/WeightedVec.scala +++ b/slash/shared/src/main/scala/slash/vector/WeightedVec.scala @@ -14,7 +14,8 @@ * limitations under the License. */ -package ai.dragonfly.math.vector +package slash.vector + import Vec.* case class WeightedVec[N <: Int](unweighted: Vec[N], private var w: Double = 0.0) { diff --git a/slash/shared/src/main/scala/ai/dragonfly/math/vector/package.scala b/slash/shared/src/main/scala/slash/vector/package.scala similarity index 98% rename from slash/shared/src/main/scala/ai/dragonfly/math/vector/package.scala rename to slash/shared/src/main/scala/slash/vector/package.scala index 3bdc7d6..7dbeddd 100644 --- a/slash/shared/src/main/scala/ai/dragonfly/math/vector/package.scala +++ b/slash/shared/src/main/scala/slash/vector/package.scala @@ -14,13 +14,13 @@ * limitations under the License. */ -package ai.dragonfly.math +package slash -import ai.dragonfly.math.Random.nextVec -import ai.dragonfly.math.interval.Interval -import ai.dragonfly.math.vector.Vec -import unicode.* +import slash.Random.nextVec +import slash.vector.Vec import narr.* +import slash.interval.* +import slash.unicode.* import scala.language.implicitConversions import scala.compiletime.ops.any.== @@ -45,7 +45,7 @@ package object vector { inline def random[N <: Int]( MAX:Double = 1.0, min:Double = 0.0, - r:scala.util.Random = ai.dragonfly.math.Random.defaultRandom + r:scala.util.Random = slash.Random.defaultRandom ): Vec[N] = r.nextVec[N](min, MAX) inline def apply(x: Double, y: Double): Vec[2] = NArray[Double](x, y) diff --git a/tests/shared/src/test/scala/Gamma.scala b/tests/shared/src/test/scala/Gamma.scala index b8d3f1c..4a1fc7f 100644 --- a/tests/shared/src/test/scala/Gamma.scala +++ b/tests/shared/src/test/scala/Gamma.scala @@ -14,8 +14,8 @@ * limitations under the License. */ -import ai.dragonfly.math.gamma -import ai.dragonfly.math.Factorial +import slash.gamma +import slash.Factorial class Gamma extends munit.FunSuite: test("gamma") { diff --git a/tests/shared/src/test/scala/Instantiate.scala b/tests/shared/src/test/scala/Instantiate.scala index ff5d178..1629fa2 100644 --- a/tests/shared/src/test/scala/Instantiate.scala +++ b/tests/shared/src/test/scala/Instantiate.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -import ai.dragonfly.math.vector.Vec +import slash.vector.Vec import narr.* class Instantiate extends munit.FunSuite: diff --git a/tests/shared/src/test/scala/IntervalTest.scala b/tests/shared/src/test/scala/IntervalTest.scala index f064717..3790a5a 100644 --- a/tests/shared/src/test/scala/IntervalTest.scala +++ b/tests/shared/src/test/scala/IntervalTest.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -import ai.dragonfly.math.* -import ai.dragonfly.math.interval.* -import ai.dragonfly.math.interval.Interval.* +import slash.* +import slash.interval.* +import slash.interval.Interval.* import scala.reflect.ClassTag diff --git a/tests/shared/src/test/scala/Log.scala b/tests/shared/src/test/scala/Log.scala index 86e04b3..4068df1 100644 --- a/tests/shared/src/test/scala/Log.scala +++ b/tests/shared/src/test/scala/Log.scala @@ -14,8 +14,8 @@ * limitations under the License. */ -import ai.dragonfly.math.log -import ai.dragonfly.math.Constant +import slash.log +import slash.Constant class Log extends munit.FunSuite: test("logs") { diff --git a/tests/shared/src/test/scala/SimpleStats.scala b/tests/shared/src/test/scala/SimpleStats.scala index 32e196b..de2a15c 100644 --- a/tests/shared/src/test/scala/SimpleStats.scala +++ b/tests/shared/src/test/scala/SimpleStats.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -import ai.dragonfly.math.vector.Vec +import slash.vector.Vec import narr.* class SimpleStats extends munit.FunSuite: diff --git a/tests/shared/src/test/scala/TestBeta.scala b/tests/shared/src/test/scala/TestBeta.scala index 8966e93..2b48b6b 100644 --- a/tests/shared/src/test/scala/TestBeta.scala +++ b/tests/shared/src/test/scala/TestBeta.scala @@ -14,10 +14,10 @@ * limitations under the License. */ -import ai.dragonfly.math.interval.* -import ai.dragonfly.math.stats.PointStatistics -import ai.dragonfly.math.stats.probability.distributions.{Beta, EstimatedBeta, stream} -import ai.dragonfly.math.vector.* +import slash.interval.* +import slash.stats.PointStatistics +import slash.stats.probability.distributions.{Beta, EstimatedBeta, stream} +import slash.vector.* class TestBeta extends munit.FunSuite { diff --git a/tests/shared/src/test/scala/TestBinomial.scala b/tests/shared/src/test/scala/TestBinomial.scala index 7d14d81..aa9a94b 100644 --- a/tests/shared/src/test/scala/TestBinomial.scala +++ b/tests/shared/src/test/scala/TestBinomial.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -import ai.dragonfly.math.stats.probability.distributions.{EstimatedBinomial, Binomial, stream} +import slash.stats.probability.distributions.{EstimatedBinomial, Binomial, stream} class TestBinomial extends munit.FunSuite: diff --git a/tests/shared/src/test/scala/TestGaussian.scala b/tests/shared/src/test/scala/TestGaussian.scala index db81d83..a5024a2 100644 --- a/tests/shared/src/test/scala/TestGaussian.scala +++ b/tests/shared/src/test/scala/TestGaussian.scala @@ -14,8 +14,8 @@ * limitations under the License. */ -import ai.dragonfly.math.vector.* -import ai.dragonfly.math.stats.probability.distributions.{EstimatedGaussian, Gaussian, stream} +import slash.vector.* +import slash.stats.probability.distributions.{EstimatedGaussian, Gaussian, stream} class TestGaussian extends munit.FunSuite { diff --git a/tests/shared/src/test/scala/TestLogNormal.scala b/tests/shared/src/test/scala/TestLogNormal.scala index c6f9db6..7ba67bb 100644 --- a/tests/shared/src/test/scala/TestLogNormal.scala +++ b/tests/shared/src/test/scala/TestLogNormal.scala @@ -14,8 +14,8 @@ * limitations under the License. */ -import ai.dragonfly.math.stats.probability.distributions.{EstimatedLogNormal, LogNormal, stream} -import ai.dragonfly.math.vector.* +import slash.stats.probability.distributions.{EstimatedLogNormal, LogNormal, stream} +import slash.vector.* class TestLogNormal extends munit.FunSuite { diff --git a/tests/shared/src/test/scala/TestPERT.scala b/tests/shared/src/test/scala/TestPERT.scala index 027805c..c7795a1 100644 --- a/tests/shared/src/test/scala/TestPERT.scala +++ b/tests/shared/src/test/scala/TestPERT.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -import ai.dragonfly.math.stats.probability.distributions.{PERT, Beta} +import slash.stats.probability.distributions.{PERT, Beta} class TestPERT extends munit.FunSuite { diff --git a/tests/shared/src/test/scala/TestPoisson.scala b/tests/shared/src/test/scala/TestPoisson.scala index f8f97db..a2b6e9c 100644 --- a/tests/shared/src/test/scala/TestPoisson.scala +++ b/tests/shared/src/test/scala/TestPoisson.scala @@ -14,9 +14,9 @@ * limitations under the License. */ -import ai.dragonfly.math.stats.probability.distributions.{EstimatedPoisson, Poisson, stream} +import slash.stats.probability.distributions.{EstimatedPoisson, Poisson, stream} import narr.* -import ai.dragonfly.math.vector.* +import slash.vector.* class TestPoisson extends munit.FunSuite: test("poisson.p(x)") { diff --git a/tests/shared/src/test/scala/VectorSpaces.scala b/tests/shared/src/test/scala/VectorSpaces.scala index e91cc0e..45d1069 100644 --- a/tests/shared/src/test/scala/VectorSpaces.scala +++ b/tests/shared/src/test/scala/VectorSpaces.scala @@ -15,11 +15,11 @@ */ import narr.* -import ai.dragonfly.math.* -import ai.dragonfly.math.vector.* -import ai.dragonfly.math.Constant.π +import slash.* +import slash.vector.* +import slash.Constant.π -import ai.dragonfly.math.Random.defaultRandom as r +import slash.Random.defaultRandom as r class VectorSpaces extends munit.FunSuite { test(" testing kitchen sink ") { diff --git a/tests/shared/src/test/scala/helpers.forTests.scala b/tests/shared/src/test/scala/helpers.forTests.scala index 93904df..e790d0d 100644 --- a/tests/shared/src/test/scala/helpers.forTests.scala +++ b/tests/shared/src/test/scala/helpers.forTests.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -import ai.dragonfly.math.vector.Vec +import slash.vector.Vec inline def assertVecEquals[N <: Int](inline v1: Vec[N], inline v2: Vec[N])(implicit loc: munit.Location): Unit = { diff --git a/tests/shared/src/test/scala/simple.vec.ops.scala b/tests/shared/src/test/scala/simple.vec.ops.scala index 00244a1..e980e53 100644 --- a/tests/shared/src/test/scala/simple.vec.ops.scala +++ b/tests/shared/src/test/scala/simple.vec.ops.scala @@ -14,7 +14,7 @@ * limitations under the License. */ -import ai.dragonfly.math.vector.* +import slash.vector.* import narr.* diff --git a/verification/src/main/scala/ai/dragonfly/math/VerifyBeta.scala b/verification/src/main/scala/slash/VerifyBeta.scala similarity index 84% rename from verification/src/main/scala/ai/dragonfly/math/VerifyBeta.scala rename to verification/src/main/scala/slash/VerifyBeta.scala index 521953b..e33421e 100644 --- a/verification/src/main/scala/ai/dragonfly/math/VerifyBeta.scala +++ b/verification/src/main/scala/slash/VerifyBeta.scala @@ -1,7 +1,7 @@ -package ai.dragonfly.math +package slash -import ai.dragonfly.math.stats.DenseHistogramOfContinuousDistribution -import ai.dragonfly.math.stats.probability.distributions.Beta +import slash.stats.DenseHistogramOfContinuousDistribution +import slash.stats.probability.distributions.Beta import org.apache.commons.math3.distribution.BetaDistribution object VerifyBeta extends App { diff --git a/verification/src/main/scala/verification/Verification.scala b/verification/src/main/scala/verification/Verification.scala index 6ee5587..dc88ed1 100644 --- a/verification/src/main/scala/verification/Verification.scala +++ b/verification/src/main/scala/verification/Verification.scala @@ -17,7 +17,7 @@ object Verification { if (a1(i) != a2(i)) { discrepancies += 1 - var error: Double = Math.abs(a1(i) - a2(i)) + val error: Double = Math.abs(a1(i) - a2(i)) combinedError += error } @@ -76,13 +76,13 @@ trait Verification { ) val squareJaMa: Jama.Matrix = new Jama.Matrix(squarValues) - val squareMa: ai.dragonfly.math.matrix.Matrix[11, 11] = ai.dragonfly.math.matrix.Matrix[11, 11](squarValues) + val squareMa: slash.matrix.Matrix[11, 11] = slash.matrix.Matrix[11, 11](squarValues) val wideJaMa: Jama.Matrix = new Jama.Matrix(wideValues) - val wideMa: ai.dragonfly.math.matrix.Matrix[11, 19] = ai.dragonfly.math.matrix.Matrix[11, 19](wideValues) + val wideMa: slash.matrix.Matrix[11, 19] = slash.matrix.Matrix[11, 19](wideValues) val tallJaMa: Jama.Matrix = new Jama.Matrix(tallValues) - val tallMa: ai.dragonfly.math.matrix.Matrix[21, 12] = ai.dragonfly.math.matrix.Matrix[21, 12](tallValues) + val tallMa: slash.matrix.Matrix[21, 12] = slash.matrix.Matrix[21, 12](tallValues) def name:String def run: Unit diff --git a/verification/src/main/scala/verification/decomposition/Cholesky.scala b/verification/src/main/scala/verification/decomposition/Cholesky.scala index ee00c2f..6488e97 100644 --- a/verification/src/main/scala/verification/decomposition/Cholesky.scala +++ b/verification/src/main/scala/verification/decomposition/Cholesky.scala @@ -2,9 +2,9 @@ package verification.decomposition import Jama.{CholeskyDecomposition, Matrix} -import ai.dragonfly.math.Random.* +import slash.Random.* -import ai.dragonfly.math.matrix +import slash.matrix import narr.* import verification.Verification diff --git a/verification/src/main/scala/verification/decomposition/Eigen.scala b/verification/src/main/scala/verification/decomposition/Eigen.scala index a76e334..c86b26c 100644 --- a/verification/src/main/scala/verification/decomposition/Eigen.scala +++ b/verification/src/main/scala/verification/decomposition/Eigen.scala @@ -1,7 +1,7 @@ package verification.decomposition import Jama.EigenvalueDecomposition -import ai.dragonfly.math.matrix +import slash.matrix import verification.Verification import scala.Console.* diff --git a/verification/src/main/scala/verification/decomposition/LU.scala b/verification/src/main/scala/verification/decomposition/LU.scala index f6e9791..46bff51 100644 --- a/verification/src/main/scala/verification/decomposition/LU.scala +++ b/verification/src/main/scala/verification/decomposition/LU.scala @@ -1,7 +1,7 @@ package verification.decomposition import Jama.LUDecomposition -import ai.dragonfly.math.matrix +import slash.matrix import verification.Verification import scala.Console.* diff --git a/verification/src/main/scala/verification/decomposition/QR.scala b/verification/src/main/scala/verification/decomposition/QR.scala index 026454d..485a055 100644 --- a/verification/src/main/scala/verification/decomposition/QR.scala +++ b/verification/src/main/scala/verification/decomposition/QR.scala @@ -1,7 +1,7 @@ package verification.decomposition import Jama.QRDecomposition -import ai.dragonfly.math.matrix +import slash.matrix import verification.Verification import scala.Console.* diff --git a/verification/src/main/scala/verification/decomposition/SV.scala b/verification/src/main/scala/verification/decomposition/SV.scala index c9f37bd..efea125 100644 --- a/verification/src/main/scala/verification/decomposition/SV.scala +++ b/verification/src/main/scala/verification/decomposition/SV.scala @@ -1,7 +1,7 @@ package verification.decomposition import Jama.SingularValueDecomposition -import ai.dragonfly.math.matrix +import slash.matrix import verification.Verification import scala.Console.*