Skip to content

Commit

Permalink
organise imports , remove unused
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Nov 20, 2024
1 parent 5928b22 commit 40ed90e
Show file tree
Hide file tree
Showing 26 changed files with 125 additions and 143 deletions.
27 changes: 24 additions & 3 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
rules = [
OrganizeImports
LeakingImplicitClassVal,
OrganizeImports,
RedundantSyntax,
LeakingImplicitClassVal,
NoAutoTupling,
DisableSyntax,
NoValInForComprehension,
RemoveUnused
]

OrganizeImports.removeUnused = false
OrganizeImports {
coalesceToWildcardImportThreshold = 5
expandRelative = true
groupedImports = Explode
groups = [
"java",
"scala",
"org",
"com",
"vecxt"
],
importsOrder = Ascii
removeUnused = true
}
OrganizeImports.removeUnused = true
OrganizeImports.targetDialect = Scala3
2 changes: 1 addition & 1 deletion build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait Common extends ScalaModule with PublishModule with ScalafixModule {
ivy"io.github.quafadas::narr::0.0.5"
)

override def scalacOptions: Target[Seq[String]] = super.scalacOptions() ++ Seq("-explain-cyclic")
override def scalacOptions: Target[Seq[String]] = super.scalacOptions() ++ Seq("-explain-cyclic", "-Wunused:imports")

override def pomSettings = T {
PomSettings(
Expand Down
3 changes: 2 additions & 1 deletion vecxt/js-native/src/array.scala
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package vecxt

import narr._
import vecxt.matrix.Matrix

import narr.*

// These use project panama (SIMD) on the JVM, so need own JS native implementation
object JsNativeDoubleArrays:

Expand Down
9 changes: 5 additions & 4 deletions vecxt/js/src/array.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
*/
package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck

import scala.scalajs.js
import scala.scalajs.js.typedarray.Float64Array
import scala.util.chaining._
import scala.util.chaining.*

import vecxt.BoundsCheck.BoundsCheck

import narr.*

object arrayUtil:
extension [A](d: Array[A]) def printArr: String = d.mkString("[", ",", "]")
Expand Down
6 changes: 2 additions & 4 deletions vecxt/js/src/dimCheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
*/

package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck

import scala.scalajs.js
import scala.scalajs.js.typedarray.Float64Array

import vecxt.BoundsCheck.BoundsCheck

protected[vecxt] object dimCheckLen:
inline def apply(a: Float64Array, b: Int)(using inline doCheck: BoundsCheck) =
inline if doCheck then if a.length != b then throw VectorDimensionMismatch(a.length, b)
Expand Down
15 changes: 6 additions & 9 deletions vecxt/js/src/doublematrix.scala
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.MatrixHelper._
import vecxt.MatrixInstance._
import vecxt.arrays._
import vecxt.rangeExtender.MatrixRange.RangeExtender
import vecxt.rangeExtender.MatrixRange.range

import scala.scalajs.js.typedarray.Float64Array

import matrix._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.MatrixInstance.*
import vecxt.arrays.*
import vecxt.matrix.*

import narr.*

object JsDoubleMatrix:

Expand Down
7 changes: 2 additions & 5 deletions vecxt/js/src/rpt.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package vecxt.reinsurance

import vecxt.arrays._

import scala.scalajs.js.typedarray.Float64Array

import Limits.Limit
import Retentions.Retention
import vecxt.reinsurance.Limits.Limit
import vecxt.reinsurance.Retentions.Retention

/*
Expand Down
2 changes: 1 addition & 1 deletion vecxt/jvm-native/src/dimCheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package vecxt

import vecxt.BoundsCheck.BoundsCheck
import vecxt.matrix._
import vecxt.matrix.*

protected[vecxt] object dimCheckLen:
inline def apply[A](a: Array[A], b: Int)(using inline doCheck: BoundsCheck) =
Expand Down
11 changes: 2 additions & 9 deletions vecxt/jvm-native/src/doublematrix.scala
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.DoubleArrays._
import vecxt.MatrixInstance._
import vecxt.arrays._

import scala.reflect.ClassTag

import matrix._
import vecxt.arrays.*
import vecxt.matrix.*

object JvmNativeDoubleMatrix:
extension (m: Matrix[Double])
Expand Down
11 changes: 5 additions & 6 deletions vecxt/jvm/src/arrays.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
*/
package vecxt

import dev.ludovic.netlib.blas.JavaBLAS.{getInstance => blas}
import scala.util.chaining.*

import vecxt.BoundsCheck.BoundsCheck

import dev.ludovic.netlib.blas.JavaBLAS.getInstance as blas
import jdk.incubator.vector.ByteVector
import jdk.incubator.vector.DoubleVector
import jdk.incubator.vector.VectorMask
import jdk.incubator.vector.VectorOperators
import jdk.incubator.vector.VectorSpecies
import vecxt.BoundsCheck.BoundsCheck

import scala.util.chaining._

object arrays:

Expand Down
14 changes: 6 additions & 8 deletions vecxt/jvm/src/doublematrix.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package vecxt

import dev.ludovic.netlib.blas.JavaBLAS.{getInstance => blas}
import narr._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.DoubleArrays._
import vecxt.MatrixInstance._
import vecxt.arrays._

import scala.reflect.ClassTag

import matrix._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.DoubleArrays.*
import vecxt.MatrixInstance.*
import vecxt.matrix.*

import dev.ludovic.netlib.blas.JavaBLAS.getInstance as blas

object JvmDoubleMatrix:
extension (m: Matrix[Double])
Expand Down
7 changes: 2 additions & 5 deletions vecxt/jvm/src/rpt.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package vecxt.reinsurance

import vecxt.arrays._
import vecxt.reinsurance.Limits._
import vecxt.reinsurance.Retentions._
import vecxt.reinsurance._
import vecxt.reinsurance.Limits.*
import vecxt.reinsurance.Retentions.*

/*
Expand Down
14 changes: 6 additions & 8 deletions vecxt/native/src/array.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
*/
package vecxt

import org.ekrich.blas._
import org.ekrich.blas.unsafe._
import vecxt.BoundsCheck
import vecxt.BoundsCheck.BoundsCheck
import vecxt.dimCheck
import vecxt.matrix._
import scala.scalanative.unsafe.*
import scala.util.chaining.*

import org.ekrich.blas.*
import org.ekrich.blas.unsafe.*

import scala.scalanative.unsafe._
import scala.util.chaining._
import vecxt.BoundsCheck.BoundsCheck

object arrays:

Expand Down
11 changes: 4 additions & 7 deletions vecxt/native/src/doublematrix.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package vecxt
import scala.scalanative.unsafe.*

import narr._
import org.ekrich.blas.unsafe.blas
import org.ekrich.blas.unsafe.blasEnums
import vecxt.BoundsCheck.BoundsCheck
import vecxt.MatrixInstance._
import vecxt.arrays._
import vecxt.matrix._
import vecxt.matrixUtil._

import scala.scalanative.unsafe._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.MatrixInstance.*
import vecxt.matrix.*
// import vecxt.rangeExtender.MatrixRange.range

object NativeDoubleMatrix:
Expand Down
7 changes: 2 additions & 5 deletions vecxt/native/src/rpt.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package vecxt.reinsurance

import vecxt.arrays

import Limits.Limit
import Retentions.Retention
import vecxt.reinsurance.Limits.Limit
import vecxt.reinsurance.Retentions.Retention

/*
Expand Down
11 changes: 5 additions & 6 deletions vecxt/src/MatrixHelper.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.arrays._

import scala.compiletime._
import scala.compiletime.*
import scala.reflect.ClassTag

import matrix._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.matrix.*

import narr.*

object MatrixHelper:
extension (m: Matrix.type)
Expand Down
13 changes: 5 additions & 8 deletions vecxt/src/MatrixInstance.scala
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.arrays._
import vecxt.rangeExtender._

import scala.annotation.targetName
import scala.compiletime._
import scala.reflect.ClassTag

import matrix._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.matrix.*
import vecxt.rangeExtender.*

import narr.*

object MatrixInstance:
extension [A](m: Matrix[A])
Expand Down
38 changes: 20 additions & 18 deletions vecxt/src/all.scala
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package vecxt.all
package vecxt

// arrays
export vecxt.arrayUtil.*
export vecxt.arrays.*
export vecxt.DoubleArrays.*
export vecxt.JsNativeDoubleArrays.*
object all:
// arrays
export vecxt.arrayUtil.*
export vecxt.arrays.*
export vecxt.DoubleArrays.*
export vecxt.JsNativeDoubleArrays.*

// matricies
// matricies

export vecxt.matrix.*
export vecxt.matrixUtil.*
export vecxt.MatrixHelper.*
export vecxt.MatrixInstance.*
export vecxt.JvmDoubleMatrix.*
export vecxt.JsDoubleMatrix.*
export vecxt.NativeDoubleMatrix.*
export vecxt.DoubleMatrix.*
export vecxt.JvmNativeDoubleMatrix.*
export vecxt.matrix.*
export vecxt.matrixUtil.*
export vecxt.MatrixHelper.*
export vecxt.MatrixInstance.*
export vecxt.JvmDoubleMatrix.*
export vecxt.JsDoubleMatrix.*
export vecxt.NativeDoubleMatrix.*
export vecxt.DoubleMatrix.*
export vecxt.JvmNativeDoubleMatrix.*

// Random
export vecxt.cosineSimilarity
// Random
export vecxt.cosineSimilarity
end all
3 changes: 2 additions & 1 deletion vecxt/src/cosineSimilarity.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package vecxt

import narr.NArray
import vecxt.BoundsCheck.BoundsCheck
import vecxt.arrays.dot
import vecxt.arrays.norm

import narr.NArray

/** Compute the cosine similarity between two vectors
*
* @param v1
Expand Down
7 changes: 4 additions & 3 deletions vecxt/src/dimMatCheck.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package vecxt

import narr._
import vecxt.BoundsCheck.BoundsCheck
import vecxt.MatrixInstance._
import vecxt.matrix._
import vecxt.MatrixInstance.*
import vecxt.matrix.*

import narr.*

protected[vecxt] object dimMatCheck:
inline def apply[A](a: Matrix[A], b: Matrix[A])(using inline doCheck: BoundsCheck) =
Expand Down
7 changes: 4 additions & 3 deletions vecxt/src/doublearray.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package vecxt

import narr._
import vecxt.JsNativeDoubleArrays._
import narr.*

import arrays._
import vecxt.JsNativeDoubleArrays.*

import arrays.*

object DoubleArrays:
extension (vec: NArray[Double])
Expand Down
Loading

0 comments on commit 40ed90e

Please sign in to comment.