Welcome to Saddle Docs

Introduction

Saddle is a data manipulation library for Scala that provides array-backed, indexed, one- and two-dimensional data structures that are judiciously specialized on JVM primitives to avoid the overhead of boxing and unboxing.

Saddle offers vectorized numerical calculations, automatic alignment of data along indices, robustness to missing (N/A) values, and facilities for I/O.

Saddle draws inspiration from several sources, among them the R programming language & statistical environment, the numpy and pandas Python libraries, and the Scala collections library.

License

Saddle is licensed under the Apache License, Version 2.0

Current Version

The current release of Saddle is available to download from the Sonatype OSS repository. Builds are available for Scala 2.9.+, 2.10.+, and 2.11.+. The source and scaladoc packages are available as well.

The latest stable release of Saddle is 1.3.+.

Download and Install

Saddle is built using SBT - the deceptively named Simple Build Tool. It is anything but simple (yet still awesome!). Highly recommended is sbt: The Rebel Cut bash script, which you can install and make executable, for example, with:

$ curl https://raw.github.com/paulp/sbt-extras/master/sbt > ~/bin/sbt
$ chmod +x ~/bin/sbt

If you simply want to play with Saddle, the easiest thing to do is probably build from source: see Build Instructions.

If you want to start a new SBT project from scratch that uses Saddle, probably the easiest way is to use giter8. Once you’ve got g8 installed, run

$ g8 saddle/saddle.g8

follow the prompts, go to your new project directory, and run:

$ sbt console

If you have an existing SBT project, make sure your resolvers include Sonatype, and your dependencies include Saddle:

resolvers ++= Seq(
  "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
  "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases"
)

libraryDependencies ++= Seq(
  "org.scala-saddle" %% "saddle-core" % "1.3.+"
  // (OPTIONAL) "org.scala-saddle" %% "saddle-hdf5" % "1.3.+"
)

If you are using Maven, this might help (e.g. for the Scala 2.9.3 build):

<repositories>
  <repository>
    <id>oss.sonatype.org</id>
    <name>releases</name>
    <url>http://oss.sonatype.org/content/repositories/releases</url>
  </repository>
  <repository>
    <id>oss.sonatype.org</id>
    <name>snapshots</name>
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
  </repository>
</repositories>

<dependency>
  <groupId>org.scala-saddle</groupId>
  <artifactId>saddle_2.9.3</artifactId>
  <version>[1.3.0,)</version>
</dependency>

Build Instructions

To build from source, simply clone the git repository, build Saddle as shown below, and start hacking!

~ $ git clone git@github.com:saddle/saddle.git
~ $ cd saddle
~/saddle $ sbt
... loading ...

[saddle]$ compile
... compilation ...

[saddle]$ test
... running tests ...

[saddle]$ console
... loading some modules ...

scala> vec.rand(100)
...

Dependencies

Saddle relies in whole or in part on some great open source software. It is well worth the time to explore these libraries. All libraries are licensed under one of: Apache 2.0, BSD-style, or LGPL. To satisfy the LGPL, Saddle minimizes coupling so replacing the dependency should be trivial.