Permalink
Browse files

Merge pull request #57 from retronym/topic/build-refresh

Update to SBT 0.11.3.
  • Loading branch information...
2 parents 70fc75c + 42410fa commit 6206a4601322b240d2d08d98a8e6e878275bdfd3 @dlwh dlwh committed Jun 6, 2012
View
1 .gitignore
@@ -1,5 +1,6 @@
*~
.idea/
+.idea_modules/
.manager/
workspace.xml
bin/
View
1 README
@@ -33,6 +33,7 @@ Run sbt (./sbt) and invoke one or more of the following targets:
test -- Runs the unit tests
doc -- Builds scaladoc for the public API
proguard -- Builds a distributable jar
+ gen-idea -- Generate an IntelliJ IDEA project
For project maintainers, the project can be deployed with:
publish
View
17 build.sbt
@@ -5,9 +5,9 @@ version := "1.0.0.RC3-SNAPSHOT"
organization := "org.scalala"
-scalaVersion := "2.9.1"
+scalaVersion := "2.9.2"
-crossScalaVersions := Seq("2.8.2", "2.9.1")
+crossScalaVersions := Seq("2.8.2", "2.9.1", "2.9.2")
resolvers ++= Seq(
"ScalaNLP Maven2" at "http://repo.scalanlp.org/repo",
@@ -30,8 +30,9 @@ libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps) =>
}
libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps) =>
+ val Scala210 = """2\.10\.0.*""".r
sv match {
- case "2.9.1" =>
+ case "2.9.1" | "2.9.2" | Scala210() =>
deps :+ ("jline" % "jline" % "0.9.94") // ("org.scala-lang" % "jline" % "2.9.1")
case x if x.startsWith("2.8") =>
deps :+ ("jline" % "jline" % "0.9.94")
@@ -40,10 +41,12 @@ libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps) =>
}
libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps) =>
+ val Scala210 = """2\.10\.0.*""".r
sv match {
- case "2.9.1" =>
+ case Scala210() => deps
+ case "2.9.1" | "2.9.2" =>
(deps :+ ("org.scalatest" % "scalatest" % "1.4.RC2" % "test")
- :+ ("org.scala-tools.testing" %% "scalacheck" % "1.9" % "test"))
+ :+ ("org.scala-tools.testing" % "scalacheck_2.9.1" % "1.9" % "test"))
case x if x.startsWith("2.8") =>
(deps :+ ("org.scalatest" % "scalatest" % "1.3" % "test")
:+ ("org.scala-tools.testing" % "scalacheck_2.8.1" % "1.8" % "test"))
@@ -53,7 +56,7 @@ libraryDependencies <<= (scalaVersion, libraryDependencies) { (sv, deps) =>
publishTo <<= (version) { version: String =>
val nexus = "http://nexus.scala-tools.org/content/repositories/"
- if (version.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "snapshots/")
+ if (version.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "snapshots/")
else Some("releases" at nexus + "releases/")
}
@@ -77,7 +80,7 @@ proguardOptions ++= Seq (
keepMain("scalala.ScalalaConsole$"),
keepMain("scala.tools.nsc.MainGenericRunner"),
"-dontoptimize",
- "-dontobfuscate",
+ "-dontobfuscate",
keepLimitedSerializability,
keepAllScala,
"-keep class ch.epfl.** { *; }",
View
1 project/build.properties
@@ -0,0 +1 @@
+sbt.version=0.11.3
View
9 project/plugins.sbt
@@ -1,11 +1,6 @@
-libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-proguard-plugin" % (v+"-0.1.1"))
-
resolvers += "Proguard plugin repo" at "http://siasia.github.com/maven2"
-// addSbtPlugin("com.github.siasia" % "xsbt-proguard-plugin" % "0.1-SNAPSHOT")
-
-// resolvers += "retronym-releases" at "http://retronym.github.com/repo/releases"
-// resolvers += "retronym-snapshots" at "http://retronym.github.com/repo/snapshots"
-// addSbtPlugin("com.github.retronym" % "sbt-onejar" % "0.5")
+libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-proguard-plugin" % ("0.11.2-0.1.1"))
+addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")
View
BIN project/sbt-launch-0.11.2.jar
Binary file not shown.
View
433 sbt
@@ -1,3 +1,432 @@
-#!/bin/bash
+#!/usr/bin/env bash
+#
+# A more capable sbt runner, coincidentally also called sbt.
+# Author: Paul Phillips <paulp@typesafe.com>
-java $SBT_OPTS -Dfile.encoding=UTF-8 -Xss4M -Xmx1200M -XX:MaxPermSize=512M -XX:NewSize=128M -XX:NewRatio=3 -jar `dirname $0`/project/sbt-launch-0.11.2.jar "$@"
+# todo - make this dynamic
+declare -r sbt_release_version=0.11.3
+declare -r sbt_snapshot_version=0.13.0-SNAPSHOT
+
+unset sbt_jar sbt_dir sbt_create sbt_snapshot sbt_launch_dir
+unset scala_version java_home sbt_explicit_version
+unset verbose debug quiet
+
+build_props_sbt () {
+ if [[ -f project/build.properties ]]; then
+ versionLine=$(grep ^sbt.version project/build.properties)
+ versionString=${versionLine##sbt.version=}
+ echo "$versionString"
+ fi
+}
+
+update_build_props_sbt () {
+ local ver="$1"
+ local old=$(build_props_sbt)
+
+ if [[ $ver == $old ]]; then
+ return
+ elif [[ -f project/build.properties ]]; then
+ perl -pi -e "s/^sbt\.version=.*\$/sbt.version=${ver}/" project/build.properties
+ grep -q '^sbt.version=' project/build.properties || echo "sbt.version=${ver}" >> project/build.properties
+
+ echo !!!
+ echo !!! Updated file project/build.properties setting sbt.version to: $ver
+ echo !!! Previous value was: $old
+ echo !!!
+ fi
+}
+
+sbt_version () {
+ if [[ -n $sbt_explicit_version ]]; then
+ echo $sbt_explicit_version
+ else
+ local v=$(build_props_sbt)
+ if [[ -n $v ]]; then
+ echo $v
+ else
+ echo $sbt_release_version
+ fi
+ fi
+}
+
+echoerr () {
+ echo 1>&2 "$@"
+}
+vlog () {
+ [[ $verbose || $debug ]] && echoerr "$@"
+}
+dlog () {
+ [[ $debug ]] && echoerr "$@"
+}
+
+# this seems to cover the bases on OSX, and someone will
+# have to tell me about the others.
+get_script_path () {
+ local path="$1"
+ [[ -L "$path" ]] || { echo "$path" ; return; }
+
+ local target=$(readlink "$path")
+ if [[ "${target:0:1}" == "/" ]]; then
+ echo "$target"
+ else
+ echo "$(dirname $path)/$target"
+ fi
+}
+
+# a ham-fisted attempt to move some memory settings in concert
+# so they need not be dicked around with individually.
+get_mem_opts () {
+ local mem=${1:-1536}
+ local perm=$(( $mem / 4 ))
+ (( $perm > 256 )) || perm=256
+ (( $perm < 1024 )) || perm=1024
+ local codecache=$(( $perm / 2 ))
+
+ echo "-Xms${mem}m -Xmx${mem}m -XX:MaxPermSize=${perm}m -XX:ReservedCodeCacheSize=${codecache}m"
+}
+
+die() {
+ echo "Aborting: $@"
+ exit 1
+}
+
+make_url () {
+ groupid="$1"
+ category="$2"
+ version="$3"
+
+ echo "http://typesafe.artifactoryonline.com/typesafe/ivy-$category/$groupid/sbt-launch/$version/sbt-launch.jar"
+}
+
+declare -r default_jvm_opts="-Dfile.encoding=UTF8"
+declare -r default_sbt_opts="-XX:+CMSClassUnloadingEnabled"
+declare -r default_sbt_mem=1536
+declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
+declare -r sbt_opts_file=".sbtopts"
+declare -r jvm_opts_file=".jvmopts"
+declare -r latest_28="2.8.2"
+declare -r latest_29="2.9.1"
+declare -r latest_210="2.10.0-SNAPSHOT"
+
+declare -r script_path=$(get_script_path "$BASH_SOURCE")
+declare -r script_dir="$(dirname $script_path)"
+declare -r script_name="$(basename $script_path)"
+
+# some non-read-onlies set with defaults
+declare java_cmd=java
+declare sbt_launch_dir="$script_dir/.lib"
+declare sbt_mem=$default_sbt_mem
+
+# pull -J and -D options to give to java.
+declare -a residual_args
+declare -a java_args
+declare -a scalac_args
+declare -a sbt_commands
+
+build_props_scala () {
+ if [[ -f project/build.properties ]]; then
+ versionLine=$(grep ^build.scala.versions project/build.properties)
+ versionString=${versionLine##build.scala.versions=}
+ echo ${versionString%% .*}
+ fi
+}
+
+execRunner () {
+ # print the arguments one to a line, quoting any containing spaces
+ [[ $verbose || $debug ]] && echo "# Executing command line:" && {
+ for arg; do
+ if printf "%s\n" "$arg" | grep -q ' '; then
+ printf "\"%s\"\n" "$arg"
+ else
+ printf "%s\n" "$arg"
+ fi
+ done
+ echo ""
+ }
+
+ exec "$@"
+}
+
+sbt_groupid () {
+ case $(sbt_version) in
+ 0.7.*) echo org.scala-tools.sbt ;;
+ 0.10.*) echo org.scala-tools.sbt ;;
+ 0.11.[12]) echo org.scala-tools.sbt ;;
+ *) echo org.scala-sbt ;;
+ esac
+}
+
+sbt_artifactory_list () {
+ local version0=$(sbt_version)
+ local version=${version0%-SNAPSHOT}
+ local url="http://typesafe.artifactoryonline.com/typesafe/ivy-snapshots/$(sbt_groupid)/sbt-launch/"
+ dlog "Looking for snapshot list at: $url "
+
+ curl -s --list-only "$url" | \
+ grep -F $version | \
+ perl -e 'print reverse <>' | \
+ perl -pe 's#^<a href="([^"/]+).*#$1#;'
+}
+
+make_release_url () {
+ make_url $(sbt_groupid) releases $(sbt_version)
+}
+
+# argument is e.g. 0.13.0-SNAPSHOT
+# finds the actual version (with the build id) at artifactory
+make_snapshot_url () {
+ for ver in $(sbt_artifactory_list); do
+ local url=$(make_url $(sbt_groupid) snapshots $ver)
+ dlog "Testing $url"
+ curl -s --head "$url" >/dev/null
+ dlog "curl returned: $?"
+ echo "$url"
+ return
+ done
+}
+
+jar_url () {
+ case $(sbt_version) in
+ 0.7.*) echo "http://simple-build-tool.googlecode.com/files/sbt-launch-0.7.7.jar" ;;
+ *-SNAPSHOT) make_snapshot_url ;;
+ *) make_release_url ;;
+ esac
+}
+
+jar_file () {
+ echo "$sbt_launch_dir/$1/sbt-launch.jar"
+}
+
+download_url () {
+ local url="$1"
+ local jar="$2"
+
+ echo "Downloading sbt launcher $(sbt_version):"
+ echo " From $url"
+ echo " To $jar"
+
+ mkdir -p $(dirname "$jar") && {
+ if which curl >/dev/null; then
+ curl --fail --silent "$url" --output "$jar"
+ elif which wget >/dev/null; then
+ wget --quiet -O "$jar" "$url"
+ fi
+ } && [[ -f "$jar" ]]
+}
+
+acquire_sbt_jar () {
+ sbt_url="$(jar_url)"
+ sbt_jar="$(jar_file $(sbt_version))"
+
+ [[ -f "$sbt_jar" ]] || download_url "$sbt_url" "$sbt_jar"
+}
+
+usage () {
+ cat <<EOM
+Usage: $script_name [options]
+
+ -h | -help print this message
+ -v | -verbose this runner is chattier
+ -d | -debug set sbt log level to Debug
+ -q | -quiet set sbt log level to Error
+ -no-colors disable ANSI color codes
+ -sbt-create start sbt even if current directory contains no sbt project
+ -sbt-dir <path> path to global settings/plugins directory (default: ~/.sbt/<version>)
+ -sbt-boot <path> path to shared boot directory (default: ~/.sbt/boot in 0.11 series)
+ -ivy <path> path to local Ivy repository (default: ~/.ivy2)
+ -mem <integer> set memory options (default: $sbt_mem, which is
+ $(get_mem_opts $sbt_mem) )
+ -no-share use all local caches; no sharing
+ -offline put sbt in offline mode
+ -jvm-debug <port> Turn on JVM debugging, open at the given port.
+ -batch Disable interactive mode
+
+ # sbt version (default: from project/build.properties if present, else latest release)
+ !!! The only way to accomplish this pre-0.12.0 if there is a build.properties file which
+ !!! contains an sbt.version property is to update the file on disk. That's what this does.
+ -sbt-version <version> use the specified version of sbt
+ -sbt-jar <path> use the specified jar as the sbt launcher
+ -sbt-snapshot use a snapshot version of sbt
+ -sbt-launch-dir <path> directory to hold sbt launchers (default: $sbt_launch_dir)
+
+ # scala version (default: as chosen by sbt)
+ -28 use $latest_28
+ -29 use $latest_29
+ -210 use $latest_210
+ -scala-home <path> use the scala build at the specified directory
+ -scala-version <version> use the specified version of scala
+
+ # java version (default: java from PATH, currently $(java -version |& grep version))
+ -java-home <path> alternate JAVA_HOME
+
+ # jvm options and output control
+ JAVA_OPTS environment variable holding jvm args, if unset uses "$default_jvm_opts"
+ SBT_OPTS environment variable holding jvm args, if unset uses "$default_sbt_opts"
+ .jvmopts if file is in sbt root, it is prepended to the args given to the jvm
+ .sbtopts if file is in sbt root, it is prepended to the args given to **sbt**
+ -Dkey=val pass -Dkey=val directly to the jvm
+ -J-X pass option -X directly to the jvm (-J is stripped)
+ -S-X add -X to sbt's scalacOptions (-J is stripped)
+
+In the case of duplicated or conflicting options, the order above
+shows precedence: JAVA_OPTS lowest, command line options highest.
+EOM
+}
+
+addJava () {
+ dlog "[addJava] arg = '$1'"
+ java_args=( "${java_args[@]}" "$1" )
+}
+addSbt () {
+ dlog "[addSbt] arg = '$1'"
+ sbt_commands=( "${sbt_commands[@]}" "$1" )
+}
+addScalac () {
+ dlog "[addScalac] arg = '$1'"
+ scalac_args=( "${scalac_args[@]}" "$1" )
+}
+addResidual () {
+ dlog "[residual] arg = '$1'"
+ residual_args=( "${residual_args[@]}" "$1" )
+}
+addResolver () {
+ addSbt "set resolvers in ThisBuild += $1"
+}
+addDebugger () {
+ addJava "-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$1"
+}
+get_jvm_opts () {
+ # echo "${JAVA_OPTS:-$default_jvm_opts}"
+ # echo "${SBT_OPTS:-$default_sbt_opts}"
+
+ [[ -f "$jvm_opts_file" ]] && cat "$jvm_opts_file"
+}
+
+process_args ()
+{
+ require_arg () {
+ local type="$1"
+ local opt="$2"
+ local arg="$3"
+
+ if [[ -z "$arg" ]] || [[ "${arg:0:1}" == "-" ]]; then
+ die "$opt requires <$type> argument"
+ fi
+ }
+ while [[ $# -gt 0 ]]; do
+ case "$1" in
+ -h|-help) usage; exit 1 ;;
+ -v|-verbose) verbose=1 && shift ;;
+ -d|-debug) debug=1 && shift ;;
+ -q|-quiet) quiet=1 && shift ;;
+
+ -ivy) require_arg path "$1" "$2" && addJava "-Dsbt.ivy.home=$2" && shift 2 ;;
+ -mem) require_arg integer "$1" "$2" && sbt_mem="$2" && shift 2 ;;
+ -no-colors) addJava "-Dsbt.log.noformat=true" && shift ;;
+ -no-share) addJava "$noshare_opts" && shift ;;
+ -sbt-boot) require_arg path "$1" "$2" && addJava "-Dsbt.boot.directory=$2" && shift 2 ;;
+ -sbt-dir) require_arg path "$1" "$2" && sbt_dir="$2" && shift 2 ;;
+ -debug-inc) addJava "-Dxsbt.inc.debug=true" && shift ;;
+ -offline) addSbt "set offline := true" && shift ;;
+ -jvm-debug) require_arg port "$1" "$2" && addDebugger $2 && shift 2 ;;
+ -batch) exec </dev/null && shift ;;
+
+ -sbt-create) sbt_create=true && shift ;;
+ -sbt-snapshot) sbt_explicit_version=$sbt_snapshot_version && shift ;;
+ -sbt-jar) require_arg path "$1" "$2" && sbt_jar="$2" && shift 2 ;;
+ -sbt-version) require_arg version "$1" "$2" && sbt_explicit_version="$2" && shift 2 ;;
+-sbt-launch-dir) require_arg path "$1" "$2" && sbt_launch_dir="$2" && shift 2 ;;
+ -scala-version) require_arg version "$1" "$2" && addSbt "set scalaVersion := \"$2\"" && shift 2 ;;
+ -scala-home) require_arg path "$1" "$2" && addSbt "set scalaHome in ThisBuild := Some(file(\"$2\"))" && shift 2 ;;
+ -java-home) require_arg path "$1" "$2" && java_cmd="$2/bin/java" && shift 2 ;;
+
+ -D*) addJava "$1" && shift ;;
+ -J*) addJava "${1:2}" && shift ;;
+ -S*) addScalac "${1:2}" && shift ;;
+ -28) addSbt "++ $latest_28" && shift ;;
+ -29) addSbt "++ $latest_29" && shift ;;
+ -210) addSbt "++ $latest_210" && shift ;;
+
+ *) addResidual "$1" && shift ;;
+ esac
+ done
+
+ [[ $debug ]] && {
+ case $(sbt_version) in
+ 0.7.*) addSbt "debug" ;;
+ *) addSbt "set logLevel in Global := Level.Debug" ;;
+ esac
+ }
+ [[ $quiet ]] && {
+ case $(sbt_version) in
+ 0.7.*) ;;
+ *) addSbt "set logLevel in Global := Level.Error" ;;
+ esac
+ }
+}
+
+# if .sbtopts exists, prepend its contents to $@ so it can be processed by this runner
+[[ -f "$sbt_opts_file" ]] && {
+ sbtargs=()
+ while IFS= read -r arg; do
+ sbtargs=( "${sbtargs[@]}" "$arg" )
+ done <"$sbt_opts_file"
+
+ set -- "${sbtargs[@]}" "$@"
+}
+
+# process the combined args, then reset "$@" to the residuals
+process_args "$@"
+set -- "${residual_args[@]}"
+argumentCount=$#
+
+# set scalacOptions if we were given any -S opts
+[[ ${#scalac_args[@]} -eq 0 ]] || addSbt "set scalacOptions in ThisBuild += \"${scalac_args[@]}\""
+
+# Update build.properties no disk to set explicit version - sbt gives us no choice
+[[ -n "$sbt_explicit_version" ]] && update_build_props_sbt "$sbt_explicit_version"
+echo "Detected sbt version $(sbt_version)"
+
+[[ -n "$scala_version" ]] && echo "Overriding scala version to $scala_version"
+
+# no args - alert them there's stuff in here
+(( $argumentCount > 0 )) || echo "Starting $script_name: invoke with -help for other options"
+
+# verify this is an sbt dir or -create was given
+[[ -f ./build.sbt || -d ./project || -n "$sbt_create" ]] || {
+ cat <<EOM
+$(pwd) doesn't appear to be an sbt project.
+If you want to start sbt anyway, run:
+ $0 -sbt-create
+
+EOM
+ exit 1
+}
+
+# pick up completion if present; todo
+[[ -f .sbt_completion.sh ]] && source .sbt_completion.sh
+
+# no jar? download it.
+[[ -f "$sbt_jar" ]] || acquire_sbt_jar || {
+ # still no jar? uh-oh.
+ echo "Download failed. Obtain the jar manually and place it at $sbt_jar"
+ exit 1
+}
+
+[[ -n "$sbt_dir" ]] || {
+ sbt_dir=~/.sbt/$(sbt_version)
+ addJava "-Dsbt.global.base=$sbt_dir"
+ echo "Using $sbt_dir as sbt dir, -sbt-dir to override."
+}
+
+# since sbt 0.7 doesn't understand iflast
+(( ${#residual_args[@]} == 0 )) && residual_args=( "shell" )
+
+# run sbt
+execRunner "$java_cmd" \
+ $(get_mem_opts $sbt_mem) \
+ $(get_jvm_opts) \
+ ${java_args[@]} \
+ -jar "$sbt_jar" \
+ "${sbt_commands[@]}" \
+ "${residual_args[@]}"
View
2 sbt.cmd
@@ -1,2 +0,0 @@
-set SCRIPT_DIR=%~dp0
-java %SBT_OPTS% -Dfile.encoding=UTF-8 -Xss4M -Xmx1200M -XX:MaxPermSize=512M -XX:NewSize=128M -XX:NewRatio=3 -jar "%SCRIPT_DIR%\project\sbt-launch-0.11.2.jar" %*
View
6 src/main/scala/scalala/collection/sparse/SparseArray.scala
@@ -50,10 +50,9 @@ import java.util.Arrays
* @author dlwh, dramage
*/
@SerialVersionUID(1L)
-@serializable
final class SparseArray[@specialized T]
(val length : Int, protected var index : Array[Int], protected var data : Array[T], protected var used : Int, initialActiveLength : Int)
-(implicit m : ClassManifest[T], df : DefaultArrayValue[T]) {
+(implicit m : ClassManifest[T], df : DefaultArrayValue[T]) extends Serializable {
def copy: SparseArray[T] = {
val newData = m.newArray(data.length)
@@ -1150,8 +1149,7 @@ trait SparseArrayOps extends LowPrioritySparseArrayOps {
*
* @author dramage
*/
-@serializable
-sealed trait DefaultArrayValue[@specialized T] {
+sealed trait DefaultArrayValue[@specialized T] extends Serializable {
def value : T;
}
View
4 src/main/scala/scalala/library/Library.scala
@@ -190,7 +190,7 @@ trait Library {
val xMinusMu = X(::,i) - mu
K += 1
mu += xMinusMu / K
- Sigma += xMinusMu * xMinusMu.t * (1. - 1. / K)
+ Sigma += xMinusMu * xMinusMu.t * (1d - 1d / K)
}
(Sigma / math.max(1, K-1), mu)
@@ -203,7 +203,7 @@ trait Library {
val xMinusMu = X(i,::) - mu
K += 1
mu += xMinusMu / K
- Sigma += xMinusMu.t * xMinusMu * (1. - 1. / K)
+ Sigma += xMinusMu.t * xMinusMu * (1d - 1d / K)
}
(Sigma / math.max(1, K-1), mu)
}
View
4 src/main/scala/scalala/library/Numerics.scala
@@ -42,7 +42,7 @@ trait Numerics {
x += 1;
}
- val f = 1./(x * x);
+ val f = 1d/(x * x);
val t = f*(-1/12.0 +
f*(1/120.0 +
f*(-1/252.0 +
@@ -112,7 +112,7 @@ trait Numerics {
* Incomplete lgamma function.
*/
def lgamma(a: Double, z:Double) = {
- var res = 0.;
+ var res = 0d;
var m = 21
while( m > 1) {
res = ((1.0-m)*(m-1.0-a)) / (2*m -1+z -a + res);
View
8 src/main/scala/scalala/scalar/RichScalar.scala
@@ -0,0 +1,8 @@
+package scalala.scalar
+
+class RichScalar(value: Double) {
+ def +(c: Complex): Complex = Complex(value, 0) + c;
+ def -(c: Complex): Complex = Complex(value, 0) - c;
+ def *(c: Complex): Complex = Complex(value, 0) * c;
+ def /(c: Complex): Complex = Complex(value, 0) / c;
+}
View
3 src/main/scala/scalala/scalar/Scalar.scala
@@ -29,8 +29,7 @@ import scalala.collection.sparse.DefaultArrayValue;
* @author dramage
*/
@implicitNotFound(msg="${V} is not a scalar value")
-@serializable
-trait Scalar[@specialized(Int,Short,Long,Float,Double) V] {
+trait Scalar[@specialized(Int,Short,Long,Float,Double) V] extends Serializable {
def zero : V;
def one : V;
View
7 src/main/scala/scalala/scalar/package.scala
@@ -27,13 +27,6 @@ package scalala;
package object scalar {
val i = Complex.i;
- class RichScalar(value : Double) {
- def + (c : Complex) : Complex = Complex(value,0) + c;
- def - (c : Complex) : Complex = Complex(value,0) - c;
- def * (c : Complex) : Complex = Complex(value,0) * c;
- def / (c : Complex) : Complex = Complex(value,0) / c;
- }
-
implicit def richInt(value : Int) =
new RichScalar(value);
View
16 src/main/scala/scalala/tensor/SelectAll.scala
@@ -0,0 +1,16 @@
+package scalala.tensor
+
+/**
+ * For selecting all elements from a matrix row or column.
+ * See :: literal.
+ *
+ * @author dramage
+ */
+sealed trait SelectAll;
+
+/**
+ * For selecting all elements from a matrix row or column.
+ *
+ * @author dramage
+ */
+object :: extends SelectAll;
View
4 src/main/scala/scalala/tensor/dense/DenseMatrix.scala
@@ -43,12 +43,12 @@ import library.{LinearAlgebra, Random}
* @author dramage
*/
@SerialVersionUID(1)
-@serializable
class DenseMatrix[@specialized(Int,Long,Float,Double) V]
(override val numRows : Int, override val numCols : Int, data_ : Array[V])
(implicit override val scalar : Scalar[V])
extends DenseArrayTensor[(Int,Int),V] with DenseArrayTensorLike[(Int,Int),V,TableDomain,DenseMatrix[V]]
-with mutable.Matrix[V] with mutable.MatrixLike[V,DenseMatrix[V]] {
+with mutable.Matrix[V] with mutable.MatrixLike[V,DenseMatrix[V]]
+with Serializable {
override val data = data_ // workaround for https://lampsvn.epfl.ch/trac/scala/ticket/4013
if (numRows * numCols != data_.length)
View
3 src/main/scala/scalala/tensor/dense/DenseVector.scala
@@ -503,12 +503,11 @@ extends DenseVector[V] with mutable.VectorRow[V] with mutable.VectorRowLike[V,De
*
* @author dramage
*/
-@serializable
final class DenseVectorCol[@specialized(Int,Long,Float,Double) V]
(override val data : Array[V], override val offset : Int,
override val stride : Int, override val length : Int)
(implicit override val scalar : Scalar[V])
-extends DenseVector[V] with mutable.VectorCol[V] with mutable.VectorColLike[V,DenseVectorCol[V]] {
+extends DenseVector[V] with mutable.VectorCol[V] with mutable.VectorColLike[V,DenseVectorCol[V]] with Serializable {
def this(data : Array[V])(implicit s : Scalar[V]) =
this(data, 0, 1, data.length)(s);
View
3 src/main/scala/scalala/tensor/mutable/Counter.scala
@@ -48,11 +48,10 @@ extends tensor.Counter[K,V] with Tensor1[K,V]
with CounterLike[K,V,scala.collection.mutable.Map[K,V],Counter[K,V]];
object Counter {
- @serializable
class Impl[@specialized(Int,Long) K, @specialized(Int,Long,Float,Double) V]
(override val data : scala.collection.mutable.Map[K,V])
(implicit override final val scalar : Scalar[V])
- extends Counter[K,V];
+ extends Counter[K,V] with Serializable;
/** Returns an empty counter. */
def apply[K,V:Scalar]() : Counter[K,V] =
View
3 src/main/scala/scalala/tensor/mutable/Counter2.scala
@@ -56,11 +56,10 @@ extends tensor.Counter2[K1,K2,V] with Tensor2[K1,K2,V]
with Counter2Like[K1,K2, V,Curried[scala.collection.mutable.Map,K1]#Result,Counter[K2,V],Counter2[K1,K2,V]];
object Counter2 {
- @serializable
class Impl[K1, @specialized(Int,Long) K2, @specialized(Int,Long,Float,Double) V]
(override val data : scala.collection.mutable.Map[K1,Counter[K2,V]])
(implicit override val scalar : Scalar[V])
- extends Counter2[K1,K2,V];
+ extends Counter2[K1,K2,V] with Serializable;
/** Returns a new empty counter. */
def apply[K1,K2,V:Scalar]() : Counter2[K1,K2,V] = {
View
14 src/main/scala/scalala/tensor/package.scala
@@ -20,18 +20,4 @@
package scalala;
package object tensor {
- /**
- * For selecting all elements from a matrix row or column.
- * See :: literal.
- *
- * @author dramage
- */
- sealed trait SelectAll;
-
- /**
- * For selecting all elements from a matrix row or column.
- *
- * @author dramage
- */
- object :: extends SelectAll;
}
View
3 src/main/scala/scalala/tensor/sparse/SparseVector.scala
@@ -37,11 +37,10 @@ import dense.DenseVector
*
* @author dramage
*/
-@serializable
@SerialVersionUID(1)
trait SparseVector[@specialized(Int,Long,Float,Double) V]
extends SparseArrayTensor[Int,V] with SparseArrayTensorLike[Int,V,IndexDomain,SparseVector[V]]
-with mutable.Vector[V] with mutable.VectorLike[V,SparseVector[V]] {
+with mutable.Vector[V] with mutable.VectorLike[V,SparseVector[V]] with Serializable {
override def length = data.length;
override def apply(key : Int) =

0 comments on commit 6206a46

Please sign in to comment.