package index
- Alphabetic
- Public
- Protected
Type Members
- 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.
- class IndexDouble extends Index[Double]
Index with double keys
- class IndexInt extends Index[Int]
Index with integer keys
- 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.
- class IndexLong extends Index[Long]
Index with long keys
- 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
- trait IndexMakerLowPriority extends AnyRef
- 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
- class JoinerImpl[T] extends Joiner[T]
Concrete implementation of Joiner instance which is specialized on basic types.
- 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.
- trait MelterLowPriority extends MelterLowerPriority
Next lowest priority melter implicit instances; takes one arbitrary types and a TupleN and produces a TupleN+1
- trait MelterLowerPriority extends AnyRef
Lowest priority melter implicit instance takes two arbitrary types and produces a Tuple2
- 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
- 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.
- class SliceAll extends Slice[Nothing]
Represent a slice over the entire index
- 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
- 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
- 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
- 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
- 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
- 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
- object IndexIntRange
- object IndexMaker extends IndexMakerLowPriority
Companion object which houses implicit instances of IndexMaker
- object InnerJoin extends JoinType
- object LeftJoin extends JoinType
- object Melter extends MelterLowPriority
Normal priority melter implicit instances takes one a TupleN and a TupleM and produce a TupleN+M
- object OuterJoin extends JoinType
- object ReIndexer
- object RightJoin extends JoinType
- object Slice
- object SliceAll
- object SliceFrom
- object SliceTo
- object Splitter
Companion object houses implicit instances of Splitter
- object Stacker extends StackerLowPriority
Companion object which houses implicit Stacker instances.