Concatenate two Vec instances together, where there exists some way to join the type of elements.
Concatenate two Vec instances together, where there exists some way to join the type of elements. For instance, Vec[Double] concat Vec[Int] will promote Int to Double as a result of the implicit existence of an instance of Promoter[Double, Int, Double]
type of other Vec elements
type of resulting Vec elements
Vec[B] to concat
Implicit evidence of Promoter[A, B, C]
Implicit evidence of ST[C]
Returns a Vec whose backing array has been copied
Returns a Vec whose backing array has been copied
Drop the elements of the Vec which are NA
Filtered left fold over the elements of the Vec, as in scala collections library
Filtered left scan over elements of the Vec, as in scala collections library
Maps a function over elements of the Vec and flattens the result.
Left fold over the elements of the Vec, as in scala collections library
Left fold that folds only while the test condition holds true.
Left fold that folds only while the test condition holds true. As soon as the condition function yields false, the fold returns.
Function whose signature is the same as the fold function, except that it evaluates to Boolean
Return true if there is an NA value in the Vec
The number of elements in the container F
Map a function over the elements of the Vec, as in scala collections library
Produce a Vec whose entries are the result of executing a function on a sliding window of the data.
Produce a Vec whose entries are the result of executing a function on a sliding window of the data.
Result type of function
Window size
Function Vec[A] => B to operate on sliding window
A ScalarTag in the type of the elements of the Vec
Left scan over the elements of the Vec, as in scala collections library
Creates a view into original Vec, but shifted so that n values at the beginning or end of the Vec are NA's.
Creates a view into original Vec, but shifted so that n values at the beginning or end of the Vec are NA's. Data is not copied.
Number of offsets to shift
Creates a view into original vector from an offset up to, but excluding, another offset.
Creates a view into original vector from an offset up to, but excluding, another offset. Data is not copied.
Beginning offset
One past ending offset
Increment within slice
Equivalent to slicing operation; e.
Equivalent to slicing operation; e.g.
val v = Vec(1,2,3) v.take(0,1) == v(0,1)
Location of elements to take
Additive inverse of Vec with numeric elements
The complement of the take operation; slice out elements NOT specified in list.
The complement of the take operation; slice out elements NOT specified in list.
Location of elements not to take
Zips Vec with another Vec and applies a function to the paired elements.
Zips Vec with another Vec and applies a function to the paired elements. If either of the pair is NA, the result is forced to NA.
Parameter of other Vec
Result of function
Vec[B]
Function (A, B) => C
Integer modulus of division
Integer modulus of division
type of the other operand
result type of operation
other operand instance (divisor)
implicit evidence for operation between this and other
Bit-wise AND
Bit-wise AND
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Logical AND
Logical AND
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Multiplication
Multiplication
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Exponentiation
Exponentiation
type of the other operand
result type of operation
other operand instance (exponent)
implicit evidence for operation between this and other
Addition
Addition
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Subtraction
Subtraction
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Division
Division
type of the other operand
result type of operation
other operand instance (divisor)
implicit evidence for operation between this and other
Less-than comparison operator
Less-than comparison operator
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Bit-shift left
Bit-shift left
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Less-than-or-equal-to comparison operator
Less-than-or-equal-to comparison operator
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Element-wise inequality operator
Element-wise inequality operator
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Element-wise equality operator
Element-wise equality operator
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Greater-than comparison operator
Greater-than comparison operator
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Greater-than-or-equal-to comparison operator
Greater-than-or-equal-to comparison operator
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Bit-shift right (arithmetic)
Bit-shift right (arithmetic)
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Bit-shift right (logical)
Bit-shift right (logical)
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Bit-wise EXCLUSIVE OR
Bit-wise EXCLUSIVE OR
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Slice a Vec at a bound of locations, e.
Slice a Vec at a bound of locations, e.g.
val v = Vec(1,2,3,4,5) v(1->3) == Vec(2,3,4)
evaluates to IRange
Slice a Vec at a sequence of locations, e.
Slice a Vec at a sequence of locations, e.g.
val v = Vec(1,2,3,4,5) v(Array(1,3)) == Vec(2,4)
locations at which to slice
Slice a Vec at a sequence of locations, e.
Slice a Vec at a sequence of locations, e.g.
val v = Vec(1,2,3,4,5) v(1,3) == Vec(2,4)
locations at which to slice
Access a boxed element of a Vec[A] at a single location
Access a boxed element of a Vec[A] at a single location
offset into Vec
Return copy of backing array
Dot (inner) product
Dot (inner) product
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Default equality does an iterative, element-wise equality check of all values.
Default equality does an iterative, element-wise equality check of all values.
NB: to avoid boxing, is overwritten in child classes
Return true if there exists some element of the Vec which satisfies the predicate function
Return true if there exists some element of the Vec which satisfies the predicate function
Predicate function from A => Boolean
Fills NA values in vector with result of a function which acts on the index of the particular NA value found
Fills NA values in vector with result of a function which acts on the index of the particular NA value found
A function from Int => A; yields value for NA value at ith position
Return Vec whose elements satisfy a predicate function
Return Vec whose elements satisfy a predicate function
Predicate function from A => Boolean
Return vec whose offets satisfy a predicate function
Return vec whose offets satisfy a predicate function
Predicate function from Int => Boolean
Return Vec of integer locations (offsets) which satisfy some predicate
Return Vec of integer locations (offsets) which satisfy some predicate
Predicate function from A => Boolean
Return first integer location which satisfies some predicate, or -1 if there is none
Return first integer location which satisfies some predicate, or -1 if there is none
Predicate function from A => Boolean
Access the first element of a Vec[A], or NA if length is zero
Execute a (side-effecting) operation on each (non-NA) element in vec which satisfies some predicate.
Execute a (side-effecting) operation on each (non-NA) element in vec which satisfies some predicate.
Function A => Boolean
Side-effecting function
Execute a (side-effecting) operation on each (non-NA) element in the vec
Execute a (side-effecting) operation on each (non-NA) element in the vec
operation to execute
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.
Return first n elements
Return first n elements
Number of elements to access
True if and only if number of elements is zero
Access the last element of a Vec[A], or NA if length is zero
Returns Vec whose locations are NA where the result of the provided function evaluates to true
Returns Vec whose locations are NA where the result of the provided function evaluates to true
A function taking an element and returning a Boolean
Returns Vec whose locations corresponding to true entries in the boolean input mask vector are set to NA
Returns Vec whose locations corresponding to true entries in the boolean input mask vector are set to NA
Mask vector of Vec[Boolean]
Set to true when the vec is shifted over the backing array
Set to true when the vec is shifted over the backing array
Outer product
Outer product
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Replaces all NA values for which there is a non-NA value at a lower offset with the corresponding highest-offset, non-NA value.
Replaces all NA values for which there is a non-NA value at a lower offset with the corresponding highest-offset, non-NA value. E.g,
Vec(1, 2, NA, 3, NA).pad == Vec(1, 2, 2, 3, 3) Vec(NA, 1, 2, NA).pad == Vec(NA, 1, 2, 2)
Replaces all NA values for which there is a non-NA value at a lower offset with the corresponding highest-offset, non-NA value; but looking back only at most N positions.
Replaces all NA values for which there is a non-NA value at a lower offset with the corresponding highest-offset, non-NA value; but looking back only at most N positions.
Vec(1, 2, NA, 3, NA).padAtMost(1) == Vec(1, 2, 2, 3, 3) Vec(NA, 1, 2, NA).padAtMost(1) == Vec(NA, 1, 2, 2) Vec(1, NA, NA, 3, NA).padAtMost(1) == Vec(1, 1, NA, 3, 3)
Pretty-printer for Vec, which simply outputs the result of stringify.
Pretty-printer for Vec, which simply outputs the result of stringify.
Number of elements to display
Access an unboxed element of a Vec[A] at a single location
Access an unboxed element of a Vec[A] at a single location
offset into Vec
Yield a Vec whose elements have been reversed from their original order
Creates a view into original vector from an offset up to, and including, another offset.
Creates a view into original vector from an offset up to, and including, another offset. Data is not copied.
Beginning offset
Ending offset
Increment within slice
Yield a Vec whose elements have been sorted (in ascending order)
Yield a Vec whose elements have been sorted (in ascending order)
evidence of Ordering[A]
Split Vec into two Vecs at position i
Split Vec into two Vecs at position i
Position at which to split Vec
Creates a string representation of Vec
Creates a string representation of Vec
Max number of elements to include
Return last n elements
Return last n elements
Number of elements to access
Converts Vec to an indexed sequence (default implementation is immutable.
Converts Vec to an indexed sequence (default implementation is immutable.Vector)
Return Vec whose elements are selected via a Vec of booleans (where that Vec holds the value true)
Return Vec whose elements are selected via a Vec of booleans (where that Vec holds the value true)
Predicate vector: Vec[Boolean]
Logical EXCLUSIVE OR
Logical EXCLUSIVE OR
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Bit-wise OR
Bit-wise OR
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Logical OR
Logical OR
type of the other operand
result type of operation
other operand instance
implicit evidence for operation between this and other
Vec
is an immutable container for 1D homogeneous data (a "vector"). It is backed by an array and indexed from 0 to length - 1.Several element access methods are provided.
The
apply()
method returns a slice of the original vector:The
at
method returns an instance of a Scalar, which behaves much like anOption
in that it can be either an instance of org.saddle.scalar.NA or a Value case class:The method
raw
accesses the underlying value directly.Vec
may be used in arithemetic expressions which operate on twoVec
s or on aVec
and a scalar value. A few examples:Note, Vec is implicitly convertible to an array for convenience; this could be abused to mutate the contents of the Vec. Try to avoid this!
Type of elements within the Vec