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
  • InsertionSort
  • MergeSort
  • PermuteInsertionSort
  • PermuteMergeSort
  • Sorter
  • 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

package array

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

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

Type Members

  1. trait Sorter[T] extends AnyRef

    Typeclass interface for sorting implementations

Value Members

  1. def argmax[T](arr: Array[T])(implicit arg0: ST[T], arg1: NUM[T]): Int

    Return the integer offset of the maximum element, or -1 for an empty array

  2. def argmin[T](arr: Array[T])(implicit arg0: ST[T], arg1: NUM[T]): Int

    Return the integer offset of the minimum element, or -1 for an empty array

  3. def argsort[T](vec: Vec[T])(implicit arg0: ST[T], arg1: ORD[T]): Array[Int]
  4. def argsort[T](arr: Array[T])(implicit arg0: ORD[T], st: ST[T]): Array[Int]

    Stable indirect sort resulting in permutation of numbers [0, n), whose application on an array results in a sorted array.

    Stable indirect sort resulting in permutation of numbers [0, n), whose application on an array results in a sorted array.

    arr

    Array to sort

  5. def copySlice[T](from: Int, until: Int, source: Array[T])(implicit arg0: ST[T]): Array[T]

    Copies a contiguous segment of the array into a new array.

    Copies a contiguous segment of the array into a new array.

    from

    start index, inclusive

    until

    end index, exclusive

    source

    source array to copy

  6. def empty[T](len: Int)(implicit arg0: ST[T]): Array[T]

    Create a new initialized empty array

  7. def fill[T](arr: Array[T], v: T): Unit

    Fill array with value

  8. def filter[T](f: (T) => Boolean)(arr: Array[T])(implicit arg0: ST[T]): Array[T]

    Filter an array based on a predicate function, wherever that predicate is true

  9. def flatten[T](arrs: Seq[Array[T]])(implicit arg0: CLM[T]): Array[T]

    Flatten a sequence of arrays into a single array

  10. def linspace(start: Double, stop: Double, num: Int = 50, endpoint: Boolean = true): Array[Double]

    Derived from numpy 1.7

    Derived from numpy 1.7

    Return evenly spaced numbers over a specified interval.

    Returns num evenly spaced samples, calculated over the interval [start, stop].

    If start < stop, then the order of elements are decreasing.

    The endpoint of the interval can optionally be excluded.

  11. def put[T](arr: Array[T], offsets: Array[Boolean], value: T): Array[T]

    Put a value into array arr at particular offsets provided by a boolean array where its locations are true, so as to produce a new array.

  12. def put[T](arr: Array[T], offsets: Array[Int], value: T): Array[T]

    Put a single value into array arr at particular offsets, so as to produce a new array.

  13. def putn[T](arr: Array[T], offsets: Array[Int], values: Array[T]): Array[T]

    Put n values into array arr at particular offsets, where the values come from another array, so as to produce a new array.

  14. def randDouble(sz: Int, min: Double, until: Double): Array[Double]

    Generate an array of random doubles on [min,until)

  15. def randDouble(sz: Int, min: Double, until: Double, rng: Generator): Array[Double]

    Generate an array of random doubles on [min,until)

  16. def randDouble(sz: Int, n: Double): Array[Double]

    Generate an array of random doubles on [0,n)

  17. def randDouble(sz: Int, n: Double, rng: Generator): Array[Double]

    Generate an array of random doubles on [0,n)

  18. def randDouble(sz: Int): Array[Double]

    Generate an array of random doubles on [0,1)

  19. def randDouble(sz: Int, rng: Generator): Array[Double]

    Generate an array of random doubles on [0,1)

  20. def randDoublePos(sz: Int): Array[Double]

    Generate an array of random positive doubles on (0, 1]

  21. def randDoublePos(sz: Int, rng: Generator): Array[Double]

    Generate an array of random positive doubles on (0, 1]

  22. def randInt(sz: Int, from: Int, to: Int): Array[Int]

    Generate an array of random integers in [from,to]

  23. def randInt(sz: Int, from: Int, to: Int, rng: Generator): Array[Int]

    Generate an array of random integers in [from,to]

  24. def randInt(sz: Int): Array[Int]

    Generate an array of random integers

  25. def randInt(sz: Int, rng: Generator): Array[Int]

    Generate an array of random integers

  26. def randIntPos(sz: Int): Array[Int]

    Generate an array of random positive integers

  27. def randIntPos(sz: Int, rng: Generator): Array[Int]

    Generate an array of random positive integers

  28. def randLong(sz: Int, from: Long, to: Long): Array[Long]

    Generate an array of a random long integers in [from,to]

  29. def randLong(sz: Int, from: Long, to: Long, rng: Generator): Array[Long]

    Generate an array of a random long integers in [from,to]

  30. def randLong(sz: Int): Array[Long]

    Generate an array of a random long integers

  31. def randLong(sz: Int, rng: Generator): Array[Long]

    Generate an array of a random long integers

  32. def randLongPos(sz: Int): Array[Long]

    Generate an array of random long positive integers

  33. def randLongPos(sz: Int, rng: Generator): Array[Long]

    Generate an array of random long positive integers

  34. def randNormal(sz: Int): Array[Double]

    Generate an array of random doubles which is normally distributed with a mean of zero and stdev of one.

  35. def randNormal(sz: Int, rng: Generator): Array[Double]

    Generate an array of random doubles which is normally distributed with a mean of zero and stdev of one.

  36. def randNormal2(sz: Int, mu: Double, sigma: Double): Array[Double]

    Generate an array of random doubles which is normally distributed with a mean of mu and stdev of sigma.

  37. def randNormal2(sz: Int, mu: Double, sigma: Double, rng: Generator): Array[Double]

    Generate an array of random doubles which is normally distributed with a mean of mu and stdev of sigma.

  38. def range(from: Int, until: Int, step: Int = 1): Array[Int]

    Create a new array consisting of a range of numbers from a lower bound up to, but not including, an upper bound, at a particular increment (default 1)

  39. def remove[T](arr: Array[T], locs: Array[Int])(implicit arg0: ST[T]): Array[T]

    Remove values from array arr at particular offsets so as to produce a new array.

  40. def reverse[T](arr: Array[T])(implicit arg0: ST[T]): Array[T]

    Reverse an array

  41. def send[T](arr: Array[T], offsets: Array[Int])(implicit arg0: ST[T]): Array[T]

    Sends values from an array to particular offsets so as to produce a new array.

    Sends values from an array to particular offsets so as to produce a new array. This does the inverse of 'take'; ie, each integer I at offset O in offsets works to "send" input[O] to output[I]. Eg, Array(2,0,1) permutes locations as follows:

    • 0 to 2
    • 1 to 0
    • 2 to 1

    For example,

    send(Array(5,6,7), Array(2,0,1)) == Array(6,7,5)
  42. def shuffle[T](arr: Array[T]): Array[T]

    Return a uniform random permutation of the array

  43. def shuffle[T](arr: Array[T], rng: Generator): Array[T]

    Return a uniform random permutation of the array

  44. def sort[T](arr: Array[T])(implicit arg0: ST[T], arg1: ORD[T]): Array[T]

    Stable sort of array argument (not destructive), using radix sort implementation wherever possible.

    Stable sort of array argument (not destructive), using radix sort implementation wherever possible.

    arr

    Array to sort

  45. def sum[T](arr: Array[T], offsets: Array[Int], missing: => T)(implicit arg0: ST[T], arg1: NUM[T]): T

    Compute the sum of the array at particular offets.

    Compute the sum of the array at particular offets. If any of the offets is -1, the pass-by-name value 'missing' is used instead.

    For example,

    sum(Array(1,2,3,4), Array(0,2,), 0)
  46. def take[T](arr: Array[T], offsets: Vec[Int], missing: => T)(implicit arg0: ST[T]): Array[T]

    Takes values from array arr at particular offsets so as to produce a new array.

    Takes values from array arr at particular offsets so as to produce a new array. Offset -1 is mapped to by-name parameter missing.

    Note that each integer I at offset O in offsets works to "take" input[I] to output[O]. Eg, Array(2,0,1) permutes locations as follows:

    • 2 to 0
    • 0 to 1
    • 1 to 2

    For example,

    take(Array(5,6,7), Array(2,0,1), -1) == Array(7,5,6)
  47. def take[T](arr: Array[T], offsets: Array[Int], missing: => T)(implicit arg0: ST[T]): Array[T]

    Takes values from array arr at particular offsets so as to produce a new array.

    Takes values from array arr at particular offsets so as to produce a new array. Offset -1 is mapped to by-name parameter missing.

    Note that each integer I at offset O in offsets works to "take" input[I] to output[O]. Eg, Array(2,0,1) permutes locations as follows:

    • 2 to 0
    • 0 to 1
    • 1 to 2

    For example,

    take(Array(5,6,7), Array(2,0,1), -1) == Array(7,5,6)
  48. def tile[T](arr: Array[T], n: Int)(implicit arg0: ST[T]): Array[T]

    Repeat elements of the array some number of times

  49. object InsertionSort

    An implementation of insertion sort.

    An implementation of insertion sort.

    Works well for small arrays but due to quadratic complexity is not generally optimal.

  50. object MergeSort

    In-place merge sort implementation.

    In-place merge sort implementation. This sort is stable but does mutate the given array. It is an in-place sort but it does allocate a temporary array of the same size as the input. It uses InsertionSort for sorting very small arrays.

  51. object PermuteInsertionSort

    An implementation of insertion sort.

    An implementation of insertion sort.

    Works well for small arrays but due to quadratic complexity is not generally optimal.

  52. object PermuteMergeSort

    In-place merge sort implementation.

    In-place merge sort implementation. This sort is stable but does mutate the given array. It is an in-place sort but it does allocate a temporary array of the same size as the input. It uses InsertionSort for sorting very small arrays.

  53. object Sorter

Inherited from AnyRef

Inherited from Any

Ungrouped