IndexInt

org.saddle.index.IndexInt
class IndexInt(keys: Vec[Int], val ord: Order[Int]) extends Index[Int]

Index with integer keys

Attributes

Graph
Supertypes
trait Index[Int]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def argSort: Array[Int]

Returns offsets into index that would result in sorted index

Returns offsets into index that would result in sorted index

Attributes

def concat(x: Index[Int]): Index[Int]

Concatenate two Index objects together

Concatenate two Index objects together

Type parameters

B

Type of other index

C

Result of promoting types A, B

Value parameters

mc

Implicit evidence of ST[C]

oc

Implicit evidence of ORD[C]

other

Other index to concatenate

p

Implicit evidence of a Promoter which can send both T and B to C

Attributes

override 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.

Attributes

Definition Classes
Index -> Any
def intersect(other: Index[Int]): ReIndexer[Int]

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.

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.

Value parameters

other

The other index

Attributes

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.

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

Attributes

def isMonotonic: Boolean

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

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

Attributes

def join(other: Index[Int], how: JoinType): ReIndexer[Int]

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

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

Value parameters

how

join type, see org.saddle.index.JoinType

other

Another index

Attributes

def length: Int

Number of elements in the index

Number of elements in the index

Attributes

def lsearch(t: Int): Int

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

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

Value parameters

t

Key that would be inserted

Attributes

def map[B : Order](f: Int => 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.

Type parameters

B

Type of resulting elements

Value parameters

f

Function to map with

Attributes

def raw(idx: Int): Int

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.

Value parameters

loc

Offset into the index

Attributes

def reversed: Index[Int]

Returns the index in reversed order

Returns the index in reversed order

Attributes

def rsearch(t: Int): Int

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

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

Value parameters

t

Key that would be inserted

Attributes

def slice(from: Int, until: Int, stride: Int): Index[Int]

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.

Value parameters

from

Int, lower bound

stride

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

until

Int, one past upper bound

Attributes

def take(locs: Array[Int]): Index[Int]

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

Value parameters

locs

Locations to take

Attributes

def toArray: Array[Int]
def toVec: Vec[Int]

Convert Index to a org.saddle.Vec

Convert Index to a org.saddle.Vec

Attributes

def union(other: Index[Int]): ReIndexer[Int]

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.

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.

Value parameters

other

The other index

Attributes

def without(locs: Array[Int]): Index[Int]

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.

Value parameters

locs

Locations to omit

Attributes

Inherited methods

def apply(keys: Array[Int]): 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.

Value parameters

keys

Sequence of keys to find

Attributes

Inherited from:
Index
def apply(keys: Int*): 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.

Value parameters

keys

Sequence of keys to find

Attributes

Inherited from:
Index
def at(locs: Int*): Index[T]

Retrieve several elements from the index at provided offsets

Retrieve several elements from the index at provided offsets

Value parameters

locs

A sequence of integer offsets

Attributes

Inherited from:
Index
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

Value parameters

locs

An array of integer offsets

Attributes

Inherited from:
Index
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

Value parameters

loc

Offset into index

Attributes

Inherited from:
Index
def contains(key: Int): 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

Value parameters

key

Key to query

Attributes

Inherited from:
Index
def count(key: Int): Int

Return the number of times the key occurs in the index

Return the number of times the key occurs in the index

Value parameters

key

The key to query

Attributes

Inherited from:
Index
def counts: Array[Int]

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

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

Attributes

Inherited from:
Index
def distinct(implicit st: ScalarTag[Int], ord: Order[Int]): Index[T]

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

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

Attributes

Inherited from:
Index
def dropLevel[U](implicit ev: Splitter[Int, 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.

Type parameters

U

Type of elements of result index

Value parameters

ev

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

Attributes

Inherited from:
Index
def exists(pred: Int => 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,

Value parameters

pred

Function from T => Boolean

Attributes

Inherited from:
Index
def findOne(pred: Int => 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.

Value parameters

pred

Function from T => Boolean

Attributes

Inherited from:
Index
def first: Scalar[T]

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

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

Attributes

Inherited from:
Index
def firsts(keys: Array[Int]): 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.

Value parameters

keys

Sequence of keys to find

Attributes

Inherited from:
Index
def get(key: Int): Array[Int]

Get location offsets within Index given a particular key

Get location offsets within Index given a particular key

Value parameters

key

Key with which to search

Attributes

Inherited from:
Index
def getFirst(key: Int): Int

Get first integer offset of a key

Get first integer offset of a key

Value parameters

key

Key to find in index

Attributes

Inherited from:
Index
def getIndexer(other: Index[Int]): Option[Array[Int]]

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.

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.

Value parameters

other

The other index with which to generate offsets

Attributes

Inherited from:
Index
def getLast(key: Int): Int

Get last integer offset of a key

Get last integer offset of a key

Value parameters

key

Key to find in index

Attributes

Inherited from:
Index
override 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.

Attributes

Definition Classes
Index -> Any
Inherited from:
Index
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

Value parameters

n

Number of elements to slice

Attributes

Inherited from:
Index
def isEmpty: Boolean

Attributes

Inherited from:
Index
def isUnique: Boolean

Returns true if there are no duplicate keys in the Index

Returns true if there are no duplicate keys in the Index

Attributes

Inherited from:
Index
def last: Scalar[T]

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

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

Attributes

Inherited from:
Index
def next(current: Scalar[Int]): Scalar[T]

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.

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.

Value parameters

current

Key value to find

Attributes

Inherited from:
Index
def nonEmpty: Boolean

Attributes

Inherited from:
Index
def prev(current: Scalar[Int]): Scalar[T]

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.

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.

Value parameters

current

Key value to find

Attributes

Inherited from:
Index
def sliceBy(rng: Slice[Int]): 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.

Value parameters

rng

An instance of

Attributes

Inherited from:
Index
def sliceBy(from: Int, to: Int, inclusive: Boolean): Index[T]

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.

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.

Value parameters

from

Key lower bound

inclusive

If true (default), include upper bound in slice

to

Key upper bound

Attributes

Inherited from:
Index
def sorted: Index[T]

Returns the index in sorted (ascending) order

Returns the index in sorted (ascending) order

Attributes

Inherited from:
Index
def split[O1, O2](implicit ev: Splitter[Int, 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.

Type parameters

O1

Left index type (of arity N-1)

O2

Right index type (of arity 1)

Value parameters

ev

Implicit evidence of an instance of Splitter

Attributes

Inherited from:
Index
def stack[U, V](other: Index[U])(implicit ev: Stacker[Int, 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. See org.saddle.index.Stacker for more details.

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.

Type parameters

U

The input type, of arity 1

V

The result type, of arity N+1

Value parameters

ev

Implicit evidence of a Stacker

other

Another Index

Attributes

Inherited from:
Index
def stringify(len: Int): String

Creates a string representation of Index

Creates a string representation of Index

Value parameters

len

Max number of elements to include

Attributes

Inherited from:
Index
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

Value parameters

n

Number of elements to slice

Attributes

Inherited from:
Index
def toSeq: IndexedSeq[T]

Convert Index elements to an IndexedSeq.

Convert Index elements to an IndexedSeq.

Attributes

Inherited from:
Index
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Index -> Any
Inherited from:
Index
def toUniqueIndex(implicit ord: Order[Int]): 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

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

Attributes

Inherited from:
Index
def uniques(implicit ord: Order[Int], tag: ScalarTag[Int]): 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.

Value parameters

ord

Implicit ORD for instances of type T

tag

Implicit ST for instances of type T

Attributes

Inherited from:
Index

Concrete fields

val ord: Order[Int]
val scalarTag: ScalarTag[Int]

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

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

Attributes