Packages

  • package root
    Definition Classes
    root
  • package org
    Definition Classes
    root
  • package saddle

    Saddle is a Scala Data Library.

    Saddle

    Saddle is a Scala Data Library.

    Saddle provides array-backed, indexed one- and two-dimensional data structures.

    These data structures are specialized on JVM primitives. With them one can often avoid the overhead of boxing and unboxing.

    Basic operations also aim to be robust to missing values (NA's)

    The building blocks are intended to be easily composed.

    The foundational building blocks are:

    Inspiration for Saddle comes from many sources, including the R programming language, the pandas data analysis library for Python, and the Scala collections library.

    Definition Classes
    org
  • package array

    This package contains utilities for working with arrays that are specialized for numeric types.

    This package contains utilities for working with arrays that are specialized for numeric types.

    Definition Classes
    saddle
  • package binary

    Binary serialization for Frame[String,String,T] or Mat[T] with primitive T

    Binary serialization for Frame[String,String,T] or Mat[T] with primitive T

    The layout of binary format is as follows:

    • The first 6 bytes are "SADDLE"
    • The next unsigned byte is the major version
    • The next unsigned byte is the minor version
    • The next 4 bytes form a little endian integer as HEADER_LENGTH
    • The next HEADER_LENGTH bytes form an UTF-8 string as the header.
    • The header is a valid JSON object with the following fields:
      • v: numeric positive integer is the version of the header structure
      • colix : a JSON array of strings, it is the column index of the frame
      • rowix : a JSON array of strings, it is the row index of the frame
      • numrows: numeric positive integer, number of rows
      • numcols: numeric positive integer, number of cols
      • Either one of rowix or numrows may be missing
      • Either one of colix or numcols may be missing
      • rowmajor : a boolean, indicating whether the data is stored in row-major or col-major order
      • datatype : string, either "double", "long", "int", "float", "byte"
    • The header is padded with spaces (0x20) such that HEADER_LENGTH+12 is divisible by 16. The count of spaces are included in HEADER_LENGTH.
    • The next width * numRows * numCols bytes form a little endian primitive array in row-major or col-major order. numRows and numCols are determined from the rowix/numrows and colix/numcols header fields. width is determined from the datatype field (8 for double and long, 4 for int and float, 1 for byte)
    Definition Classes
    saddle
  • package csv
    Definition Classes
    saddle
  • package groupby
    Definition Classes
    saddle
  • package index
    Definition Classes
    saddle
  • IndexAny
  • IndexDouble
  • IndexInt
  • IndexIntRange
  • IndexLong
  • IndexMaker
  • IndexMakerLowPriority
  • InnerJoin
  • JoinType
  • JoinerImpl
  • LeftJoin
  • Melter
  • MelterLowPriority
  • MelterLowerPriority
  • OuterJoin
  • ReIndexer
  • RightJoin
  • Slice
  • SliceAll
  • SliceDefault
  • SliceFrom
  • SliceTo
  • Splitter
  • Stacker
  • StackerLowPriority
  • package io
    Definition Classes
    saddle
  • package linalg
    Definition Classes
    saddle
  • package macros
    Definition Classes
    saddle
  • package mat
    Definition Classes
    saddle
  • package npy
    Definition Classes
    saddle
  • package ops

    Provides type aliases for a few basic operations

    Provides type aliases for a few basic operations

    Definition Classes
    saddle
  • package scalar
    Definition Classes
    saddle
  • package spire
    Definition Classes
    saddle
  • package util

    Additional utilities that need a home

    Additional utilities that need a home

    Definition Classes
    saddle
  • package vec

    Factory methods to generate Vec instances

    Factory methods to generate Vec instances

    Definition Classes
    saddle

package index

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. class IndexAny[T] extends Index[T]

    An implementation of org.saddle.Index generic in type T for which there is an Ordering[T] and a ST[T] available in the implicit context.

  2. class IndexDouble extends Index[Double]

    Index with double keys

  3. class IndexInt extends Index[Int]

    Index with integer keys

  4. class IndexIntRange extends Index[Int]

    An implementation of an Index[Int] which implicitly represents a bound of integers, which lazily generates its elements as an array when needed.

    An implementation of an Index[Int] which implicitly represents a bound of integers, which lazily generates its elements as an array when needed. This compact representation is the default when creating a Saddle object such as org.saddle.Series which requires an index and one is not supplied.

  5. class IndexLong extends Index[Long]

    Index with long keys

  6. trait IndexMaker[I, O] extends AnyRef

    An IndexMaker takes some input of type I and returns an Index whose elements are of type O.

    An IndexMaker takes some input of type I and returns an Index whose elements are of type O.

    The basic use case is to take a TupleN of Seq-like instances and return an Index whose entries are instances of TupleN corresponding to the elements of the original Seqs.

    I

    Type of input with which to make index

    O

    Type of contents of output index

  7. trait IndexMakerLowPriority extends AnyRef
  8. sealed trait JoinType extends AnyRef

    There are four basic joins which may be performed between two indexed Saddle objects such as org.saddle.Series or org.saddle.Frame.

    There are four basic joins which may be performed between two indexed Saddle objects such as org.saddle.Series or org.saddle.Frame.

    • InnerJoin
    • OuterJoin (also known as a full join)
    • LeftJoin
    • RightJoin

    These are defined analogously to SQL joins.

    For example, an output key will be generated in the following situations:

    • Inner: key exists in both input indexes
    • Outer: key exists in either or both input indexes
    • Left: key exists in left or both input indexes
    • Right: key exists in right or both input indexes
  9. class JoinerImpl[T] extends Joiner[T]

    Concrete implementation of Joiner instance which is specialized on basic types.

  10. trait Melter[A, B, C] extends AnyRef

    A Melter operates on a TupleN and a TupleM and produces a TupleN+M which is composed of the corresponding tuple elements.

  11. trait MelterLowPriority extends MelterLowerPriority

    Next lowest priority melter implicit instances; takes one arbitrary types and a TupleN and produces a TupleN+1

  12. trait MelterLowerPriority extends AnyRef

    Lowest priority melter implicit instance takes two arbitrary types and produces a Tuple2

  13. trait ReIndexer[T] extends AnyRef

    We often need to "reindex" one array/vec/series/frame so as to produce a new one.

    We often need to "reindex" one array/vec/series/frame so as to produce a new one.

    First, note that an array A of values of type T is actually a mapping defined as

                  f
    [0, A.length) => {T}

    That is, each integer index of the array yields a value of type T when it is de-referenced.

    ReIndexer has two fields, lTake and rTake, which are array-based maps defined for some integers M and N as

            g
    [0, N) => [-1, M)

    In other words, lTake and rTake are arrays of length N whose entries are integers between -1 and M-1. We call these "indexers".

    Given a reindexer, g, a re-indexing operation on array A yields a new array B of length N which represents the following mapping:

            B
    [0, N)  =>  {T}
    
    where B(i) == f(g(i)) if g(i) != -1
                == NA      if g(i) == -1

    For this to work, the maximum value M in the co-domain of g must be <= A.length. We also augment the mapping f to send -1 to the corresponding NA value of type T.

    For example, suppose we have Index(0,1,2,4) and Index(0,1,2,3). Performing a full outer join would yield the following ReIndexer:

    • lTake = {0, 1, 2, -1, 3},
    • rTake = {0, 1, 2, 3, -1},
    • index = Index(0, 1, 2, 3, 4).

    These indexers are then amenable to using with org.saddle.array.take to select elements out of an indexed data structure.

    A performance optimization is to make lTake and rTake of type Option[Array], where we make a value of None behave as if it were an array of [0, N). So, the "taking" code knows to take the original values. You will therefore see code that looks like:

    val v = Vec(...)
    val ixer = ReIndexer(...)
    ixer.lTake.map(x => v.take(x)) getOrElse v
  14. trait Slice[+T] extends AnyRef

    Slice provides a methodology so that when it is applied to an index, it produces an lower (inclusive) and upper (exclusive) integer offset at which to slice.

  15. class SliceAll extends Slice[Nothing]

    Represent a slice over the entire index

  16. class SliceDefault[T] extends Slice[T]

    Represent a slice from one key to another, inclusive.

    Represent a slice from one key to another, inclusive.

    T

    Type of Key

  17. class SliceFrom[T] extends Slice[T]

    Represent a slice from key to end of index

    Represent a slice from key to end of index

    T

    Type of Key

  18. class SliceTo[T] extends Slice[T]

    Represent a slice from zero to a key.

    Represent a slice from zero to a key.

    T

    Type of Key

  19. trait Splitter[I, OL, OR] extends AnyRef

    A Splitter operates on an input index whose elements have arity N, and yields the following pair of output indexes: the left has elements whose arity is N-1, where each element has the first N-1 constituents of the original tuple; and the right is an index whose elements were those in the Nth position of the original tuple.

    A Splitter operates on an input index whose elements have arity N, and yields the following pair of output indexes: the left has elements whose arity is N-1, where each element has the first N-1 constituents of the original tuple; and the right is an index whose elements were those in the Nth position of the original tuple.

    For example,

    Index[(Char, Int)](('a', 1), ('a', 2), ('b', 1), ('b', 2)).split

    yields

    (Index[Char]('a', 'a', 'b', 'b'), Index[Int](1, 2, 1, 2))
    I

    Input index whose elements have arity > 1

    OL

    Left output index whose elements have arity >= 1

    OR

    Right output index whose elements have arity 1

  20. trait Stacker[I, J, O] extends AnyRef

    A Stacker operates on two input Index instances and produces a new output Index whose entries are drawn from the Cartesian product of the elements of the original indexes, and whose ordering is likewise specified by the original orderings.

    A Stacker operates on two input Index instances and produces a new output Index whose entries are drawn from the Cartesian product of the elements of the original indexes, and whose ordering is likewise specified by the original orderings. For instance,

    Index[Int](1,2) stack Index[Char]('a','b')

    results in

    Index[(Int, Char)]((1,'a'), (1,'b'), (2,'a'), (2,'b'))

    whereas

    Index[(Char, Int)](('x',1), ('y',2)) stack Index[Char]('a','b')

    results in

    Index[(Char, Int, Char)](('x',1,'a'), ('x',1,'b'), ('y',2,'a'), ('y',2,'b'))
    I

    Type of the elements of the left index

    J

    Type of the elements of the right index

    O

    Type of the elements of the output index

  21. trait StackerLowPriority extends AnyRef

    Implicit instance of Stacker for two indexes of arbitrary type.

    Implicit instance of Stacker for two indexes of arbitrary type. The priority is lower than the Stacker instances in the Stacker companion object because we want to specialize the case when the left index is composed of Tuples.

Value Members

  1. object IndexIntRange
  2. object IndexMaker extends IndexMakerLowPriority

    Companion object which houses implicit instances of IndexMaker

  3. object InnerJoin extends JoinType
  4. object LeftJoin extends JoinType
  5. object Melter extends MelterLowPriority

    Normal priority melter implicit instances takes one a TupleN and a TupleM and produce a TupleN+M

  6. object OuterJoin extends JoinType
  7. object ReIndexer
  8. object RightJoin extends JoinType
  9. object Slice
  10. object SliceAll
  11. object SliceFrom
  12. object SliceTo
  13. object Splitter

    Companion object houses implicit instances of Splitter

  14. object Stacker extends StackerLowPriority

    Companion object which houses implicit Stacker instances.

Ungrouped