Skip to content

Commit

Permalink
Added determination of platform in build
Browse files Browse the repository at this point in the history
  • Loading branch information
mandar2812 committed Dec 20, 2016
1 parent efaacc3 commit 78b24ef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.github.mandar2812.dynaml.kernels
import scalaxy.streams.optimize
import scala.reflect.ClassTag
import breeze.linalg.DenseMatrix
import io.github.mandar2812.dynaml.DynaMLPipe
import io.github.mandar2812.dynaml.algebra.PartitionedPSDMatrix
import io.github.mandar2812.dynaml.pipes._

Expand Down Expand Up @@ -40,10 +39,8 @@ CovarianceFunction[Index, Double, DenseMatrix[Double]]
*
* */
def +[T <: LocalScalarKernel[Index]](otherKernel: T)(implicit ev: ClassTag[Index]): CompositeCovariance[Index] =
//new DecomposableCovariance(this, otherKernel)(DynaMLPipe.genericReplicationEncoder[Index](2))
kernelOps.addLocalScKernels(this, otherKernel)


/**
* Create composite kernel k = k<sub>1</sub> * k<sub>2</sub>
*
Expand All @@ -53,9 +50,6 @@ CovarianceFunction[Index, Double, DenseMatrix[Double]]
* */
def *[T <: LocalScalarKernel[Index]](otherKernel: T)(implicit ev: ClassTag[Index]): CompositeCovariance[Index] =
kernelOps.multLocalScKernels(this, otherKernel)
/*new DecomposableCovariance(this, otherKernel)(
DynaMLPipe.genericReplicationEncoder[Index](2),
Reducer.:*:)*/

def :*[T1](otherKernel: LocalScalarKernel[T1]): CompositeCovariance[(Index, T1)] =
new TensorCombinationKernel[Index, T1](this, otherKernel)
Expand Down
35 changes: 34 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,38 @@ object Dependencies {

val scala = "2.11.8"

val platform = {
// Determine platform name using code similar to javacpp
// com.googlecode.javacpp.Loader.java line 60-84
val jvmName = System.getProperty("java.vm.name").toLowerCase
var osName = System.getProperty("os.name").toLowerCase
var osArch = System.getProperty("os.arch").toLowerCase
if (jvmName.startsWith("dalvik") && osName.startsWith("linux")) {
osName = "android"
} else if (jvmName.startsWith("robovm") && osName.startsWith("darwin")) {
osName = "ios"
osArch = "arm"
} else if (osName.startsWith("mac os x")) {
osName = "macosx"
} else {
val spaceIndex = osName.indexOf(' ')
if (spaceIndex > 0) {
osName = osName.substring(0, spaceIndex)
}
}
if (osArch.equals("i386") || osArch.equals("i486") || osArch.equals("i586") || osArch.equals("i686")) {
osArch = "x86"
} else if (osArch.equals("amd64") || osArch.equals("x86-64") || osArch.equals("x64")) {
osArch = "x86_64"
} else if (osArch.startsWith("arm")) {
osArch = "arm"
}
val platformName = osName + "-" + osArch
println("platform: " + platformName)
platformName
}


val baseDependencies = Seq(
"org.scala-lang" % "scala-compiler" % scala % "compile",
"org.scala-lang" % "scala-library" % scala % "compile",
Expand Down Expand Up @@ -33,7 +65,8 @@ object Dependencies {

val linearAlgebraDependencies = Seq(
"org.scalanlp" % "breeze_2.11" % "0.11.2" % "compile",
"org.scalanlp" % "breeze-natives_2.11" % "0.11.2" % "compile")
"org.scalanlp" % "breeze-natives_2.11" % "0.11.2" % "compile",
"org.la4j" % "la4j" % "0.6.0" % "compile")

val chartsDependencies = Seq(
"com.github.wookietreiber" % "scala-chart_2.11" % "0.4.2" % "compile",
Expand Down

0 comments on commit 78b24ef

Please sign in to comment.