org.saddle.index

Members list

Type members

Classlikes

class IndexAny[T](keys: Vec[T])(implicit evidence$1: ScalarTag[T], evidence$2: Order[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.

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.

Attributes

Supertypes
trait Index[T]
class Object
trait Matchable
class Any
class IndexDouble(keys: Vec[Double], val ord: Order[Double]) extends Index[Double]

Index with double keys

Index with double keys

Attributes

Supertypes
trait Index[Double]
class Object
trait Matchable
class Any
class IndexInt(keys: Vec[Int], val ord: Order[Int]) extends Index[Int]

Index with integer keys

Index with integer keys

Attributes

Supertypes
trait Index[Int]
class Object
trait Matchable
class Any
class IndexIntRange(val length: Int, val from: Int, val ord: Order[Int]) 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. 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.

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.

Attributes

Companion
object
Supertypes
trait Index[Int]
class Object
trait Matchable
class Any
object IndexIntRange

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
class IndexLong(keys: Vec[Long], val ord: Order[Long]) extends Index[Long]

Index with long keys

Index with long keys

Attributes

Supertypes
trait Index[Long]
class Object
trait Matchable
class Any
trait IndexMaker[I, O]

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 Tuple,,N,, of Seq-like instances and return an Index whose entries are instances of Tuple,,N,, corresponding to the elements of the original Seqs.

Type parameters

I

Type of input with which to make index

O

Type of contents of output index

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Companion object which houses implicit instances of IndexMaker

Companion object which houses implicit instances of IndexMaker

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
IndexMaker.type

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object IndexMaker.type
object InnerJoin extends JoinType

Attributes

Supertypes
trait JoinType
class Object
trait Matchable
class Any
Self type
InnerJoin.type
sealed trait JoinType

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object InnerJoin.type
object LeftJoin.type
object OuterJoin.type
object RightJoin.type
class JoinerImpl[T]

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

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

Attributes

Supertypes
class Object
trait Matchable
class Any
object LeftJoin extends JoinType

Attributes

Supertypes
trait JoinType
class Object
trait Matchable
class Any
Self type
LeftJoin.type
trait Melter[A, B, C]

A Melter operates on a Tuple,,N,, and a Tuple,,M,, and produces a Tuple,,N+M,, which is composed of the corresponding tuple elements.

A Melter operates on a Tuple,,N,, and a Tuple,,M,, and produces a Tuple,,N+M,, which is composed of the corresponding tuple elements.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Melter extends MelterLowPriority

Normal priority melter implicit instances takes one a Tuple,,N,, and a Tuple,,M,, and produce a Tuple,,N+M,,

Normal priority melter implicit instances takes one a Tuple,,N,, and a Tuple,,M,, and produce a Tuple,,N+M,,

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Melter.type

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

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Melter.type

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

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

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Melter.type
object OuterJoin extends JoinType

Attributes

Supertypes
trait JoinType
class Object
trait Matchable
class Any
Self type
OuterJoin.type
trait ReIndexer[T]

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ReIndexer

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
ReIndexer.type
object RightJoin extends JoinType

Attributes

Supertypes
trait JoinType
class Object
trait Matchable
class Any
Self type
RightJoin.type
trait Slice[+T]

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.

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.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class SliceAll
class SliceDefault[T]
class SliceFrom[T]
class SliceTo[T]
object Slice

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Slice.type
class SliceAll extends Slice[Nothing]

Represent a slice over the entire index

Represent a slice over the entire index

Attributes

Companion
object
Supertypes
trait Slice[Nothing]
class Object
trait Matchable
class Any
object SliceAll

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
SliceAll.type
class SliceDefault[T](k1: T, k2: T) extends Slice[T]

Represent a slice from one key to another, inclusive.

Represent a slice from one key to another, inclusive.

Type parameters

T

Type of Key

Value parameters

k1

First key

k2

Second key

Attributes

Supertypes
trait Slice[T]
class Object
trait Matchable
class Any
class SliceFrom[T](k: T) extends Slice[T]

Represent a slice from key to end of index

Represent a slice from key to end of index

Type parameters

T

Type of Key

Value parameters

k

Key to slice from

Attributes

Companion
object
Supertypes
trait Slice[T]
class Object
trait Matchable
class Any
object SliceFrom

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
SliceFrom.type
class SliceTo[T](k: T) extends Slice[T]

Represent a slice from zero to a key.

Represent a slice from zero to a key.

Type parameters

T

Type of Key

Value parameters

k

Key to slice to

Attributes

Companion
object
Supertypes
trait Slice[T]
class Object
trait Matchable
class Any
object SliceTo

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
SliceTo.type
trait Splitter[I, OL, OR]

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))

Type parameters

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Splitter

Companion object houses implicit instances of Splitter

Companion object houses implicit instances of Splitter

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Splitter.type
trait Stacker[I, J, O]

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,

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'))

Type parameters

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

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Stacker extends StackerLowPriority

Companion object which houses implicit Stacker instances.

Companion object which houses implicit Stacker instances.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Stacker.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.

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.

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Stacker.type