Skip to content

Commit

Permalink
Hail Mary
Browse files Browse the repository at this point in the history
  • Loading branch information
Quafadas committed Nov 10, 2023
1 parent b22f12b commit 78afb76
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
10 changes: 9 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ ThisBuild / githubWorkflowBuildPreamble ++= Seq(
)

ThisBuild / tlCiDocCheck := false
// ThisBuild / githubWorkflowBuildPreamble ++= nativeBrewInstallWorkflowSteps.value
// ThisBuild / nativeBrewInstallCond := Some("matrix.project == 'rootNative'")

// publish to s01.oss.sonatype.org (set to true to publish to oss.sonatype.org instead)
ThisBuild / tlSonatypeUseLegacyHost := false
Expand All @@ -48,6 +50,7 @@ ThisBuild / tlSonatypeUseLegacyHost := false
ThisBuild / tlSitePublishBranch := Some("main")
ThisBuild / scalaVersion := "3.3.1"
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("17"))
ThisBuild / tlJdkRelease := Some(17)

lazy val root = tlCrossRootProject.aggregate(core, tests)

Expand Down Expand Up @@ -78,7 +81,12 @@ lazy val core = crossProject(
new NodeJSEnv(NodeJSEnv.Config().withArgs(List("--enable-source-maps")))
}
)
.nativeSettings()
.nativeSettings(
// nativeBrewFormulas += "atlas", //??
libraryDependencies += "org.ekrich" %%% "sblas" % "0.5.0",

nativeConfig ~= { c => c.withLinkingOptions(c.linkingOptions :+ "-latlas") },
)

lazy val docs = project
.in(file("site"))
Expand Down
11 changes: 5 additions & 6 deletions core/native/src/main/scala/vecxt/array.extensions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package vecxt
import vecxt.BoundsCheck
import vecxt.Limits.Limit
import vecxt.Retentions.Retention
import org.ekrich.blas.unsafe.*
import scala.scalanative.unsafe.*

type NArray = Array[Double]

Expand Down Expand Up @@ -184,12 +186,9 @@ extension (vec: Array[Double])
out
end -

inline def -=(vec2: Array[Double]): Unit =
var i = 0
while i < vec.length do
vec(i) = vec(i) - vec2(i)
i = i + 1
end while
inline def -=(vec2: Array[Double])(using inline boundsCheck: BoundsCheck): Unit =
dimCheck(vec, vec2)
blas.cblas_daxpy(vec.length, -1.0, vec2.at(0) , 1, vec.at(0), 1)
end -=

inline def +(vec2: Array[Double]) =
Expand Down
6 changes: 6 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.6.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.6.1")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7")

// scary ...
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.1")
addSbtPlugin("com.armanbilge" % "sbt-scala-native-config-brew-github-actions" % "0.1.3")

0 comments on commit 78afb76

Please sign in to comment.