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
  • 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
  • ArrToVec
  • Buffer
  • FillBackward
  • FillForward
  • FillMethod
  • Frame
  • Index
  • Mat
  • Numeric
  • OptionToScalar
  • PctMethod
  • PrimitiveToScalar
  • RankTie
  • SeqToFrame
  • SeqToFrame2
  • SeqToIndex
  • SeqToMat
  • SeqToSeries
  • SeqToVec
  • Series
  • Vec
  • VecDoubleOps
  • doubleIsNumeric
  • floatIsNumeric
  • intIsNumeric
  • longIsNumeric
  • order

trait Index[T] extends AnyRef

Index provides a constant-time look-up of a value within array-backed storage, as well as operations to support joining and slicing.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Index
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def argSort: Array[Int]

    Returns offsets into index that would result in sorted index

  2. abstract def concat(other: Index[T]): Index[T]

    Concatenate two Index objects together

    Concatenate two Index objects together

    other

    Other index to concatenate

  3. abstract def intersect(other: Index[T]): ReIndexer[T]

    Produces a org.saddle.index.ReIndexer corresponding to the intersection of this Index with another.

    Produces a org.saddle.index.ReIndexer corresponding to the intersection of this Index with another. Both indexes must have set semantics - ie, have no duplicates.

    other

    The other index

  4. abstract def isContiguous: Boolean

    Returns true if the index is either unique, or any two or more duplicate keys occur in consecutive locations in the index.

  5. abstract def isMonotonic: Boolean

    Returns true if the ordering of the elements of the Index is non-decreasing.

  6. abstract def join(other: Index[T], how: JoinType = LeftJoin): ReIndexer[T]

    Allows for the following SQL-style joins between this index and another:

    Allows for the following SQL-style joins between this index and another:

    other

    Another index

    how

    join type, see org.saddle.index.JoinType

  7. abstract def length: Int

    Number of elements in the index

  8. abstract def locator: Locator[T]
    Attributes
    protected
  9. abstract def locatorAll: Option[LocatorAll[T]]
    Attributes
    protected
  10. abstract def lsearch(t: T): Int

    Find the first location whereby inserting a key would maintain a sorted index.

    Find the first location whereby inserting a key would maintain a sorted index. Index must already be sorted.

    t

    Key that would be inserted

  11. abstract def map[B](f: (T) => B)(implicit arg0: ST[B], arg1: ORD[B]): Index[B]

    Map over the elements in the Index, producing a new Index, similar to Map in the Scala collections.

    Map over the elements in the Index, producing a new Index, similar to Map in the Scala collections.

    B

    Type of resulting elements

    f

    Function to map with

  12. abstract def ord: ORD[T]
  13. abstract def raw(loc: Int): T

    Access an element directly within the index, without wrapping in a Scalar box.

    Access an element directly within the index, without wrapping in a Scalar box.

    loc

    Offset into the index

  14. abstract def reversed: Index[T]

    Returns the index in reversed order

  15. abstract def rsearch(t: T): Int

    Find the last location whereby inserting a key would maintain a sorted index.

    Find the last location whereby inserting a key would maintain a sorted index. Index must already be sorted.

    t

    Key that would be inserted

  16. abstract def scalarTag: ScalarTag[T]

    A org.saddle.scalar.ScalarTag representing the kind of Scalar found in this index.

  17. abstract def slice(from: Int, until: Int, stride: Int = 1): Index[T]

    Returns a slice of Index between two integers, including the from bound, and excluding the until bound.

    Returns a slice of Index between two integers, including the from bound, and excluding the until bound.

    from

    Int, lower bound

    until

    Int, one past upper bound

    stride

    Default is 1, the step with which to advance over bound

  18. abstract def take(locs: Array[Int]): Index[T]

    Take values of the index at certain locations, returning a new Index consisting of those values.

    Take values of the index at certain locations, returning a new Index consisting of those values.

    See also org.saddle.array.take

    locs

    Locations to take

  19. abstract def toVec: Vec[T]

    Convert Index to a org.saddle.Vec

  20. abstract def union(other: Index[T]): ReIndexer[T]

    Produces a org.saddle.index.ReIndexer corresponding to the union of this Index with another.

    Produces a org.saddle.index.ReIndexer corresponding to the union of this Index with another. Both indexes must have set semantics - ie, have no duplicates.

    other

    The other index

  21. abstract def without(locs: Array[Int]): Index[T]

    Complement of the take method; return a new Index whose values are those which do not occur at the specified locations.

    Complement of the take method; return a new Index whose values are those which do not occur at the specified locations.

    locs

    Locations to omit

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(keys: Array[T]): Array[Int]

    Given an array of keys, return the sequence of locations in the index at which those keys correspondingly occur, ignoring keys which do not exist.

    Given an array of keys, return the sequence of locations in the index at which those keys correspondingly occur, ignoring keys which do not exist.

    keys

    Sequence of keys to find

  5. def apply(keys: T*): Array[Int]

    Given a sequence of keys, return the sequence of locations in the index at which those keys correspondingly occur, ignoring keys which do not exist.

    Given a sequence of keys, return the sequence of locations in the index at which those keys correspondingly occur, ignoring keys which do not exist.

    keys

    Sequence of keys to find

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def at(locs: Int*): Index[T]

    Retrieve several elements from the index at provided offsets

    Retrieve several elements from the index at provided offsets

    locs

    A sequence of integer offsets

  8. def at(locs: Array[Int]): Index[T]

    Retrieve several elements from the index at provided offets

    Retrieve several elements from the index at provided offets

    locs

    An array of integer offsets

  9. def at(loc: Int): Scalar[T]

    Retrieve an element of the index at a particular offset

    Retrieve an element of the index at a particular offset

    loc

    Offset into index

  10. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  11. def contains(key: T): Boolean

    Returns true if the index contains at least one entry equal to the provided key

    Returns true if the index contains at least one entry equal to the provided key

    key

    Key to query

  12. def count(key: T): Int

    Return the number of times the key occurs in the index

    Return the number of times the key occurs in the index

    key

    The key to query

  13. def counts: Array[Int]

    Returns an array whose entries represent the number of times the corresponding entry in uniques occurs within the index.

  14. def distinct(implicit st: ST[T], ord: ORD[T]): Index[T]

    Return the index of distinct values.

    Return the index of distinct values. Keeps order of first occurences.

  15. def dropLevel[U](implicit ev: Splitter[T, U, _]): Index[U]

    For an index which contains Tuples, drop the right-most element of each tuple, resulting in a new index.

    For an index which contains Tuples, drop the right-most element of each tuple, resulting in a new index.

    U

    Type of elements of result index

    ev

    Implicit evidence of a Splitter instance that takes T (of arity N) to U (of arity N-1)

  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def equals(o: Any): Boolean

    Default equality does an iterative, element-wise equality check of all values.

    Default equality does an iterative, element-wise equality check of all values.

    Definition Classes
    Index → AnyRef → Any
  18. def exists(pred: (T) => Boolean): Boolean

    Returns true if there is an element which satisfies the predicate function,

    Returns true if there is an element which satisfies the predicate function,

    pred

    Function from T => Boolean

  19. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  20. def findOne(pred: (T) => Boolean): Int

    Returns the int location of the first element of the index to satisfy the predicate function, or -1 if no element satisfies the function.

    Returns the int location of the first element of the index to satisfy the predicate function, or -1 if no element satisfies the function.

    pred

    Function from T => Boolean

  21. def first: Scalar[T]

    Returns the first element of the Index, or NA if there is none

  22. def firsts(keys: Array[T]): Array[Int]

    Given a sequence of keys, return the sequence of first locations in the index at which those keys correspondingly occur, ignoring keys which do not exist.

    Given a sequence of keys, return the sequence of first locations in the index at which those keys correspondingly occur, ignoring keys which do not exist.

    keys

    Sequence of keys to find

  23. def get(key: T): Array[Int]

    Get location offsets within Index given a particular key

    Get location offsets within Index given a particular key

    key

    Key with which to search

  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  25. def getFirst(key: T): Int

    Get first integer offset of a key

    Get first integer offset of a key

    key

    Key to find in index

  26. def getIndexer(other: Index[T]): Option[Array[Int]]

    Generates offsets into current index given another index for the purposes of re-indexing.

    Generates offsets into current index given another index for the purposes of re-indexing. For more on reindexing, see org.saddle.index.ReIndexer. If the current and other indexes are equal, a value of None is returned.

    other

    The other index with which to generate offsets

  27. def getLast(key: T): Int

    Get last integer offset of a key

    Get last integer offset of a key

    key

    Key to find in index

  28. def hashCode(): Int

    Default hashcode is simple rolling prime multiplication of sums of hashcodes for all values.

    Default hashcode is simple rolling prime multiplication of sums of hashcodes for all values.

    Definition Classes
    Index → AnyRef → Any
  29. def head(n: Int): Index[T]

    Returns a slice comprised of at most the first n elements of the Index

    Returns a slice comprised of at most the first n elements of the Index

    n

    Number of elements to slice

  30. def isEmpty: Boolean
  31. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  32. def isUnique: Boolean

    Returns true if there are no duplicate keys in the Index

  33. def last: Scalar[T]

    Returns the last element of the Index, or NA if there is none

  34. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. def next(current: Scalar[T]): Scalar[T]

    Given a key, return the next value in the Index (in the natural, ie supplied, order).

    Given a key, return the next value in the Index (in the natural, ie supplied, order). The Index must at least be contiguous, if not unique. Returns current if it is the last.

    current

    Key value to find

  36. def nonEmpty: Boolean
  37. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  38. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  39. def prev(current: Scalar[T]): Scalar[T]

    Given a key, return the previous value in the Index (in the natural, ie supplied, order).

    Given a key, return the previous value in the Index (in the natural, ie supplied, order). The Index must at least be contiguous, if not unique. Returns current if it is the first.

    current

    Key value to find

  40. def print(len: Int = 10, stream: OutputStream = System.out): Unit

    Pretty-printer for Index, which simply outputs the result of stringify.

    Pretty-printer for Index, which simply outputs the result of stringify.

    len

    Number of elements to display

  41. def sliceBy(rng: Slice[T]): Index[T]

    Returns a slice of Index between two keys, including both the lower and upper keys.

    Returns a slice of Index between two keys, including both the lower and upper keys.

    rng

    An instance of

  42. def sliceBy(from: T, to: T, inclusive: Boolean = true): Index[T]

    Returns a slice of an index between two keys; if inclusive is false, then exclude the upper bound.

    Returns a slice of an index between two keys; if inclusive is false, then exclude the upper bound. Index must be sorted, as this method relies on lsearch and rsearch.

    from

    Key lower bound

    to

    Key upper bound

    inclusive

    If true (default), include upper bound in slice

  43. def sorted: Index[T]

    Returns the index in sorted (ascending) order

  44. def split[O1, O2](implicit ev: Splitter[T, O1, O2]): (Index[O1], Index[O2])

    Given this index contains tuples of arity N > 1, split will result in a pair of index instances; the left will have elements of arity N-1, and the right arity 1.

    Given this index contains tuples of arity N > 1, split will result in a pair of index instances; the left will have elements of arity N-1, and the right arity 1.

    O1

    Left index type (of arity N-1)

    O2

    Right index type (of arity 1)

    ev

    Implicit evidence of an instance of Splitter

  45. def stack[U, V](other: Index[U])(implicit ev: Stacker[T, U, V]): Index[V]

    Given this index whose elements have arity N and another index of arity 1, form a result index whose entries are tuples of arity N+1 reflecting the Cartesian product of the two, in the provided order.

    Given this index whose elements have arity N and another index of arity 1, form a result index whose entries are tuples of arity N+1 reflecting the Cartesian product of the two, in the provided order. See org.saddle.index.Stacker for more details.

    U

    The input type, of arity 1

    V

    The result type, of arity N+1

    other

    Another Index

    ev

    Implicit evidence of a Stacker

  46. def stringify(len: Int = 10): String

    Creates a string representation of Index

    Creates a string representation of Index

    len

    Max number of elements to include

  47. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  48. def tail(n: Int): Index[T]

    Returns a slice comprised of at most the last n elements of the Index

    Returns a slice comprised of at most the last n elements of the Index

    n

    Number of elements to slice

  49. def toSeq: IndexedSeq[T]

    Convert Index elements to an IndexedSeq.

  50. def toString(): String
    Definition Classes
    Index → AnyRef → Any
  51. def toUniqueIndex(implicit ord: ORD[T]): Index[(T, Int)]

    Returns a unique index where each element is paired up with a unique integer in [0,n) n being the multiplicity count of that element in the index

  52. def uniques(implicit ord: ORD[T], tag: ST[T]): Index[T]

    Returns an array of unique keys in the Index, in the order in which they originally appeared in the backing Vec.

    Returns an array of unique keys in the Index, in the order in which they originally appeared in the backing Vec.

    ord

    Implicit ORD for instances of type T

    tag

    Implicit ST for instances of type T

  53. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  54. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  55. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped