TypedArrayOps

narr.TypedArrayOps
See theTypedArrayOps companion object
final class TypedArrayOps[AT <: NativeTypedArray](xs: AT)(using aTag: ClassTag[ArrayElementType[AT]])

Attributes

Companion:
object
Source:
TypedArrayOps.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Concise view

Type members

Types

type A = ArrayElementType[AT]

Attributes

Source:
TypedArrayOps.scala
type RT = AT & NArray[A] & NArr[A]

Attributes

Source:
TypedArrayOps.scala

Value members

Concrete methods

inline def ++[B >: A : ClassTag](xs: IterableOnce[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def ++[B >: A : ClassTag](xs: NArray[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def ++:[B >: A : ClassTag](prefix: IterableOnce[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def ++:[B >: A : ClassTag](prefix: NArray[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def +:[B >: A : ClassTag](x: B): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def :+[B >: A : ClassTag](x: B): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def :++[B >: A : ClassTag](suffix: IterableOnce[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def :++[B >: A : ClassTag](suffix: NArray[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def appended[B >: A : ClassTag](x: B): NArray[B]

A copy of this NArray with an element appended.

A copy of this NArray with an element appended.

Attributes

Source:
TypedArrayOps.scala
inline def appendedAll[B >: A : ClassTag](suffix: IterableOnce[B]): NArray[B]

A copy of this NArray with all elements of a collection appended.

A copy of this NArray with all elements of a collection appended.

Attributes

Source:
TypedArrayOps.scala
inline def appendedAll[B >: A : ClassTag](suffix: NArray[B]): NArray[B]

A copy of this NArray with all elements of an NArray appended.

A copy of this NArray with all elements of an NArray appended.

Attributes

Source:
TypedArrayOps.scala
inline def collect[B : ClassTag](pf: PartialFunction[A, B]): NArray[B]

Builds a new NArray by applying a partial function to all elements of this NArray on which the function is inline defined.

Builds a new NArray by applying a partial function to all elements of this NArray on which the function is inline defined.

Attributes

B

the element type of the returned NArray.

pf

the partial function which filters and maps the NArray.

Returns:

a new NArray resulting from applying the given partial function pf to each element on which it is inline defined and collecting the results. The order of the elements is preserved.

Source:
TypedArrayOps.scala
inline def collectFirst[B](f: PartialFunction[A, B]): Option[B]

Finds the first element of the NArray for which the given partial function is inline defined, and applies the partial function to it.

Finds the first element of the NArray for which the given partial function is inline defined, and applies the partial function to it.

Attributes

Source:
TypedArrayOps.scala
inline def combinations(n: Int): Iterator[NArray[A]]

Iterates over combinations. A combination of length n is a subsequence of the ori nal NArray, with the elements taken in order. Thus, NArray("x", "y") and NArray("y", "y") are both length-2 combinations of NArray("x", "y", "y"), but NArray("y", x") is not. If there is more than one way to generate the same subsequence, only ne will be eturned.

Iterates over combinations. A combination of length n is a subsequence of the ori nal NArray, with the elements taken in order. Thus, NArray("x", "y") and NArray("y", "y") are both length-2 combinations of NArray("x", "y", "y"), but NArray("y", x") is not. If there is more than one way to generate the same subsequence, only ne will be eturned.

For example, NArray("x", "y", "y", "y") has three different ways to generate Ar y("x", "y") depending on whether the first, second, or third "y" is select . However, since all are identical, only one will be chosen. Which of th three will be taken an implementation detai that is t inline defined.

Attributes

Returns:

An Iterator which traverses the possible n-element mbinatio of this NArray.

Example:
NArray("a", "b", "b", "b", "c").combinations(2) ==  erat   r(NArray(a, b), NArray(a, c) NA ay(b,  , NArray(b, c))
Source:
TypedArrayOps.scala
inline def concat[B >: A : ClassTag](suffix: IterableOnce[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def concat[B >: A : ClassTag](suffix: NArray[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def contains(elem: A): Boolean

Tests whether this NArray contains a given value as an element.

Tests whether this NArray contains a given value as an element.

Attributes

elem

the element to test.

Returns:

true if this NArray has an element that is equal (as determined by ==) to elem, false otherwise.

Source:
TypedArrayOps.scala
inline def copyToArray[B >: A](xs: Array[B]): Int

Copy elements of this NArray to NArray. Fills the given Array xs starting at index 0. Copying will stop once either all the elements of this NArray have bee copied, or e end of the NArray is reached.

Copy elements of this NArray to NArray. Fills the given Array xs starting at index 0. Copying will stop once either all the elements of this NArray have bee copied, or e end of the NArray is reached.

Attributes

B

the type of the elements of the NArray.

xs

the NArray o fill.

Source:
TypedArrayOps.scala
inline def copyToArray[B >: A](xs: Array[B], start: Int): Int

Copy ments of this NArray to a th er NArray. Fills the given NArray xs starting at index start . Copying will stop once either all the elements of this NArray have een copied, or the end of the NArray is reached.

Copy ments of this NArray to a th er NArray. Fills the given NArray xs starting at index start . Copying will stop once either all the elements of this NArray have een copied, or the end of the NArray is reached.

Attributes

B

the type of the elements of the NArray.

xs

the array to fill.

  • @param start the starting index within the destina on NArray.
Source:
TypedArrayOps.scala
inline def copyToArray[B >: A](xs: Array[B], start: Int, len: Int): Int

Copy elements of this NArray to ano er NArray. Fi s given NArray xs startin g at index start with at most len values. Copying will stop once ith ll the elements of this NArray have een cop d, or the end of the NArray is reached, or len elements have been opied.

Copy elements of this NArray to ano er NArray. Fi s given NArray xs startin g at index start with at most len values. Copying will stop once ith ll the elements of this NArray have een cop d, or the end of the NArray is reached, or len elements have been opied.

Attributes

B

the type of the elements of the NArray.

len

the maxima l number of elemen to copy.

xs

the a ay to ll.

  • @param start the starting index within the destina on arr .
Source:
TypedArrayOps.scala
inline def count(p: A => Boolean): Int

Counts the number of elements in this NArray which satisfy a predicate

Counts the number of elements in this NArray which satisfy a predicate

Attributes

Source:
TypedArrayOps.scala
inline def diff[B >: A](that: Seq[B]): NArray[A]

Computes the multiset differenc Array and another seq nce.

Computes the multiset differenc Array and another seq nce.

Attributes

that

the sequence of element to remove

Returns:

a new NArray w l elements of this NArray except some of occurrences of elements that also appear in that. If an element value x appears ''n'' times in that, then the st ''n'' occurrences of x will not form part of the result, but any following occurrences will.

Source:
TypedArrayOps.scala
inline def distinct: NArray[A]

Selects all the elements of this NArray ignoring the duplicates.

Selects all the elements of this NArray ignoring the duplicates.

Attributes

Returns:

a new NArray consisting of all the elements of this NArray without duplicates.

Source:
TypedArrayOps.scala
inline def distinctBy[B](f: A => B): NArray[A]

Selects all the elements of this NArray ignoring the duplicates as determined by == after applying the transforming function f.

Selects all the elements of this NArray ignoring the duplicates as determined by == after applying the transforming function f.

Attributes

B

the type of the elements after being transformed by f

f

The transforming function whose result is used to determine the uniqueness of each element

Returns:

a new NArray consisting of all the elements of this NArray without duplicates.

Source:
TypedArrayOps.scala
inline def drop(n: Int): RT

The rest of the NArray without its n first elements.

The rest of the NArray without its n first elements.

Attributes

Source:
TypedArrayOps.scala
inline def dropRight(n: Int): RT

The rest of the NArray without its n last elements.

The rest of the NArray without its n last elements.

Attributes

Source:
TypedArrayOps.scala
inline def dropWhile(p: A => Boolean): RT

Drops longest prefix of elements that satisfy a predicate.

Drops longest prefix of elements that satisfy a predicate.

Attributes

p

The predicate used to test ele nts.

Returns:

the longest suffix of this NArray whose first element does not satisfy the predicate p.

Source:
TypedArrayOps.scala
inline def endsWith[B >: A](that: NArray[B]): Boolean

Tests whether i s NArray ends with the gi n rray.

Tests whether i s NArray ends with the gi n rray.

Attributes

that

the a ay to t t

Returns:

true if this NArray h that as a suffix, false otherwise.

Source:
TypedArrayOps.scala
inline def endsWith[B >: A](that: Iterable[B]): Boolean

Tests whether this NArray ends with he giv seq e.

Tests whether this NArray ends with he giv seq e.

Attributes

that

the sequence to test

Returns:

true if this NArray has that as a suffix, false otherwise.

Source:
TypedArrayOps.scala
inline def exists(p: A => Boolean): Boolean

Tests a predicate holds for at least one element of this NArray.

Tests a predicate holds for at least one element of this NArray.

Attributes

p

the predicate used to test elements.

Returns:

true if the given predicate p is satisfied by at least one element of this NArray, otherwise false

Source:
TypedArrayOps.scala
inline def filter(p: A => Boolean): NArray[A]

Selects all elements this NA ay which satisfy a predicate.

Selects all elements this NA ay which satisfy a predicate.

Attributes

p

the predicate used to test elements.

Returns:

a new NArray consisting of all elements of this NArray that satisfy the given predicate p.

Source:
TypedArrayOps.scala
inline def filterNot(p: A => Boolean): NArray[A]

Selects all elements of thi NArray w do not satisfy a predicate.

Selects all elements of thi NArray w do not satisfy a predicate.

Attributes

Returns:

a new NArray consisting of all elements of this NArray that do not satisfy the given predicate p.

Source:
TypedArrayOps.scala
inline def find(p: A => Boolean): Option[A]

Finds the irst el the NArray satisfying a predicate, if any.

Finds the irst el the NArray satisfying a predicate, if any.

Attributes

p

the predicate used to test elements.

Returns:

an option value containing the first element in the NArray that satisfies p, or None if none exists.

Source:
TypedArrayOps.scala
inline def flatMap[B : ClassTag](f: A => IterableOnce[B]): NArray[B]

Builds a new NArray by applying a function to all elements of this NArray and using the elements of the resulting collections.

Builds a new NArray by applying a function to all elements of this NArray and using the elements of the resulting collections.

Attributes

B

the element type of the returned NArray.

f

the function to apply to each element.

Returns:

a new NArray resulting from applying the given collection-valued function f to each element of this NArray and concatenating the results.

Source:
TypedArrayOps.scala
inline def flatMap[BS, B](f: A => BS)(implicit asIterable: BS => Iterable[B], m: ClassTag[B]): NArray[B]

Attributes

Source:
TypedArrayOps.scala
inline def flatten[B](implicit asIterable: A => Iterable[B], m: ClassTag[B]): NArray[B]

Flattens a two-dimensional NArray by concatenating all its rows into a single NArray.

Flattens a two-dimensional NArray by concatenating all its rows into a single NArray.

Attributes

B

Type of row elements.

asIterable

A function that converts elements of this NArray to rows - Iterables of type B.

Returns:

An NArray obtained by concatenating rows of this NArray.

Source:
TypedArrayOps.scala
inline def fold[A1 >: A](z: A1)(op: (A1, A1) => A1): A1

Folds the elements of this N pecified associative binary operator.

Folds the elements of this N pecified associative binary operator.

Attributes

A1

a type parameter for the binary operat f A.

op

a binary operator that must be associative.

z

a neutral element r the fol ation; may be added to the result an ry number of times, and must not change the result (e.g., Nil for list concatenation, 0 for addition, or 1 for multiplication).

Returns:

the result of applying he fold or op between all the elements, or z if his NArra empty.

Source:
TypedArrayOps.scala
inline def foldLeft[B](z: B)(op: (B, A) => B): B

Applies a binary op ator to t value and all elements of this NArray, going ft to right.

Applies a binary op ator to t value and all elements of this NArray, going ft to right.

Attributes

B

the result type of the binary operator.

op

the rator.

z

the start value.

Returns:

the result of inserting op between consecutive this NArray, going left to right with the start value z on the left:

           op(...op(z, x_1), x_2, ..., x_n)
   where `x,,1,,, ..., x,,n,,` are the elements of this NArray. * Returns `z` if this NArray is mpty.
Source:
TypedArrayOps.scala
inline def foldRight[B](z: B)(op: (A, B) => B): B

Applies a binary operator to all ele nts of is NArray and a start value, going right to left.

Applies a binary operator to all ele nts of is NArray and a start value, going right to left.

Attributes

B

the result type of the binary operator.

op

the binary operator.

z

the start value.

Returns:

the result of inserting op between consecutive elements of this NArray, going right to left with the start value z on the right:

           op(x_1, op(x_2, ... op(x_n, z)...))
    where `x,,1,,, ..., x,,n,,` are the ele nts of thi ray.
    Returns `z` if this NArray is empty.
Source:
TypedArrayOps.scala
inline def forall(p: A => Boolean): Boolean

Tests whether a predicate holds for all elements of this NArray.

Tests whether a predicate holds for all elements of this NArray.

Attributes

p

the predicate used to test elements.

Returns:

true if this NArray is empty or the given predicate p holds for all elements of this NArray, otherwise false.

Source:
TypedArrayOps.scala
inline def foreach[U](f: A => U): Unit

Apply f to each element for its side effects. Note: [U] parameter needed to help scalac's type inference.

Apply f to each element for its side effects. Note: [U] parameter needed to help scalac's type inference.

Attributes

Source:
TypedArrayOps.scala
inline def groupBy[K](f: A => K): Map[K, NArray[A]]

Partitions this NArray into a map of NArrays according to some discriminator function.

Partitions this NArray into a map of NArrays according to some discriminator function.

Attributes

K

the type of keys returned by the discriminator function.

f

the discriminator function.

Returns:

A map from keys to NArrays such that the following invariant holds:

               (xs groupBy f)(k) = xs filter (x => f(x) == k)
   That is, every key `k` is bound to an NArray of those elements `x`
   for which `f(x)` equals `k`.
Source:
TypedArrayOps.scala
inline def groupMap[K, B : ClassTag](key: A => K)(f: A => B): Map[K, NArray[B]]

Partitions this NArray into a map of NArrays according to a discriminator function key. Each element in a group is transformed into a value of type B using the value function.

Partitions this NArray into a map of NArrays according to a discriminator function key. Each element in a group is transformed into a value of type B using the value function.

It is equivalent to groupBy(key).mapValues(_.map(f)), but more efficient.

 case class User(name: String, age: Int)

 inline def namesByAge(users: NArray[User]): Map[Int, NArray[String]] =
   users.groupMap(_.age)(_.name)

Attributes

B

the type of values returned by the transformation function

K

the type of keys returned by the discriminator function

f

the element transformation function

key

the dicriminator function

Source:
TypedArrayOps.scala
inline def grouped(size: Int): Iterator[NArray[A]]

Partitions elements in fixed size NArrays.

Partitions elements in fixed size NArrays.

Attributes

size

the number of elements per roup

Returns:

An iterator producing NArrays of size size, except the* last will be less than size size if the elements don't divide evenly.

See also:
Source:
TypedArrayOps.scala
inline def head: A

Selects the first element of this array.

Selects the first element of this array.

Attributes

Returns:

the first element of this array.

Throws:
NoSuchElementException

if the array is empty.

Source:
TypedArrayOps.scala
inline def headOption: Option[A]

Optionally selects the first element.

Optionally selects the first element.

Attributes

Returns:

the first element of this NArray if it is nonempty, None if it is empty.

Source:
TypedArrayOps.scala
inline def indexOf(elem: A, from: Int): Int

Finds i x of rst occurrence of some value in this rray a r or some start index.*

Finds i x of rst occurrence of some value in this rray a r or some start index.*

@ ram elem the element value to search for.

Attributes

from

the start index

Returns:

the index >= from of the first element of this NArray that is equal (as determined by ==) to elem, or -1, if none exists.

Source:
TypedArrayOps.scala
inline def indexWhere(f: A => Boolean, from: Int): Int

Finds index of the first element satisfying some predicate after or at some start index.

Finds index of the first element satisfying some predicate after or at some start index.

Attributes

from

the start index

p

the predicate used to test elements.

Returns:

the index >= from of the first element of this array that satisfies the predicate p, or -1, if none exists.

Source:
TypedArrayOps.scala
inline def indices(): Range

Produces the range of all indices of this sequence.

Produces the range of all indices of this sequence.

Attributes

Returns:

a Range value from 0 to one less than the length of this array.

Source:
TypedArrayOps.scala
inline def init: RT

The initial part of the NArray without its last element.

The initial part of the NArray without its last element.

Attributes

Source:
TypedArrayOps.scala
inline def inits: Iterator[NArray[A]]

Iterates over the inits of this NArray. The first value will be this NArray and the one will be an empty NArray, with the intervening values the results of successive applications of init.

Iterates over the inits of this NArray. The first value will be this NArray and the one will be an empty NArray, with the intervening values the results of successive applications of init.

Attributes

Returns:

an iterator over all the inits of this NArray

Source:
TypedArrayOps.scala
inline def intersect[B >: A](that: Seq[B]): NArray[A]

Computes the multiset intersection ray and another seq nce.

Computes the multiset intersection ray and another seq nce.

Attributes

that

the sequence of elements to inte ect with.

Returns:

a new NArray which contains all elements of this NArray which also appear in that. If an element value x appears ''n'' times in that, then the first ''n'' occurr c es of x will be retai d in the result, but any following occ rences will be omitted.

Source:
TypedArrayOps.scala
inline def isEmpty: Boolean

Tests whether the NArray is empty.

Tests whether the NArray is empty.

Attributes

Returns:

true if the NArray contains no elements, false otherwise.

Source:
TypedArrayOps.scala
inline def iterator: Iterator[A]

Attributes

Returns:

an iterator for this AT

Source:
TypedArrayOps.scala
inline def knownSize: Int

The size of this NArray.

The size of this NArray.

Attributes

Returns:

the number of elements in this NArray.

Source:
TypedArrayOps.scala
inline def last: A

Selects the last element.

Selects the last element.

Attributes

Returns:

The last element of this array.

Throws:
NoSuchElementException

If the array is empty.

Source:
TypedArrayOps.scala
inline def lastIndexOf(elem: A, end: Int): Int

Finds index of last occurrence o some v e i is NArray before or t a giv end index.

Finds index of last occurrence o some v e i is NArray before or t a giv end index.

Attributes

elem

the element value to search for.

end

th .

Returns:

the index <= end of the last element of this NArray that is equal (as determined by ==) to elem, or -1, if none exists.

Source:
TypedArrayOps.scala
inline def lastIndexWhere(p: A => Boolean, end: Int): Int

Finds index of last ele nt sati ying some predicate before or at given end index.

Finds index of last ele nt sati ying some predicate before or at given end index.

Attributes

p

the predicate us elements.

Returns:

the index <= end of the last element of this NArray that satisfies the predicate p, or -1, if none exists.

Source:
TypedArrayOps.scala
inline def lastOption: Option[A]

Optionally selects the last element.

Optionally selects the last element.

Attributes

Returns:

the last element of this NArray$ if it is nonempty, None if it is empty.

Source:
TypedArrayOps.scala
inline def length: Int

The length of the array

The length of the array

Attributes

Source:
TypedArrayOps.scala
inline def lengthCompare(len: Int): Int

Compares the length of this NArray to a test value.

Compares the length of this NArray to a test value.

Attributes

Source:
TypedArrayOps.scala
inline def lengthIs: Int

Method mirroring SeqOps.lengthIs for consistency, except it returns an Int because length is known and comparison is constant-time.

Method mirroring SeqOps.lengthIs for consistency, except it returns an Int because length is known and comparison is constant-time.

These operations are equivalent to `lengthCompare(Int)`, and allow the following more readable usages:

this.lengthIs < len     // this.lengthCompare(len) < 0
this.lengthIs <= len    // this.lengthCompare(len) <= 0
this.lengthIs == len    // this.lengthCompare(len) == 0
this.lengthIs != len    // this.lengthCompare(len) != 0
this.lengthIs >= len    // this.lengthCompare(len) >= 0
this.lengthIs > len     // this.lengthCompare(len) > 0

Attributes

Source:
TypedArrayOps.scala
inline def map[B](f: A => B)(implicit ct: ClassTag[B]): NArray[B]

Builds a new NArray by applying a functio s of this NArray.

Builds a new NArray by applying a functio s of this NArray.

Attributes

B

the element type of the returned NArray.

f

the function to apply to each element.

Returns:

a new NArray resulting from applying the given function f to each element of this NArray and collecting the results.

Source:
TypedArrayOps.scala
inline def mapInPlace(f: A => A): NArray[A]

Attributes

Source:
TypedArrayOps.scala
inline def nonEmpty: Boolean

Tests whether the NArray is not empty.

Tests whether the NArray is not empty.

Attributes

Returns:

true if the NArray contains at least one element, false otherwise.

Source:
TypedArrayOps.scala
inline def padTo[B >: A : ClassTag](len: Int, elem: B): NArray[B]

A copy of this NArray with an element value appended until a given target length is reached.

A copy of this NArray with an element value appended until a given target length is reached.

Attributes

B

the element type of the returned NArray.

elem

the padding value

len

the target length

Returns:

a new NArray consisting of all elements of this NArray followed by the minimal number of occurrences of elem so that the resulting collection has a length of at least len.

Source:
TypedArrayOps.scala
inline def partition(p: A => Boolean): (NArray[A], NArray[A])

A pair of, first, all elements that satisfy predicate p and, second, all elements that do not.

A pair of, first, all elements that satisfy predicate p and, second, all elements that do not.

Attributes

Source:
TypedArrayOps.scala
inline def partitionMap[A1, A2](f: A => Either[A1, A2]): (NArray[A1], NArray[A2])

Applies a function f to each element of the NArray and returns a pair of Arrays: the first one made of those values returned by f that were wrapped in Left, and the second one made of those wrapped in scala.util.R ht.

Applies a function f to each element of the NArray and returns a pair of Arrays: the first one made of those values returned by f that were wrapped in Left, and the second one made of those wrapped in scala.util.R ht.

Example:

  val xs = NArray(1, "one", 2, "two", 3, "three") partitionMap {
   case i: Int => Left(i)
   case s: String => Right(s)
  }
  // xs == (NArray(1, 2, 3),
  //        NArray(one, wo, three))

Attributes

A1

the element type of the irst resul ng collection

A2

the element type of the cond res ng collection

f

the 'split function' mapping the elements of this NArray an util.Either

Returns:

a pair of NArrays: the first one made of those values returned by f that were wrapped in scala.util.Left, and the second one made of those wrapped in scala.util.Right.

Source:
TypedArrayOps.scala
inline def patch[B >: A : ClassTag](from: Int, other: IterableOnce[B], replaced: Int): NArray[B]

Returns a copy of this NArray with patched values. Patching at negative indices is the same as patching starting at 0. Patching at indices at or larger than the length of the original NArray appends the patch to the end. If more values are replaced than actually exist, the excess is ignored.

Returns a copy of this NArray with patched values. Patching at negative indices is the same as patching starting at 0. Patching at indices at or larger than the length of the original NArray appends the patch to the end. If more values are replaced than actually exist, the excess is ignored.

Attributes

from

The start index from which to patch

other

The patch values

replaced

The number of values in the original NArray that are replaced by the patch.

Source:
TypedArrayOps.scala
inline def prepended[B >: A : ClassTag](x: B): NArray[B]

A copy of this NArray with an element prepended.

A copy of this NArray with an element prepended.

Attributes

Source:
TypedArrayOps.scala
inline def prependedAll[B >: A : ClassTag](prefix: IterableOnce[B]): NArray[B]

A copy of this NArray with all elements of a collection prepended.

A copy of this NArray with all elements of a collection prepended.

Attributes

Source:
TypedArrayOps.scala
inline def prependedAll[B >: A : ClassTag](prefix: NArray[B]): NArray[B]

A copy of this NArray with all elements of an NArray prepended.

A copy of this NArray with all elements of an NArray prepended.

Attributes

Source:
TypedArrayOps.scala

Returns a new NArray with the elements in reversed order.

Returns a new NArray with the elements in reversed order.

Attributes

Source:
TypedArrayOps.scala

An iterator yielding elements in reversed order.

An iterator yielding elements in reversed order.

Note: xs.reverseIterator is the same as xs.reverse.it ator b implemented more efficiently.

Attributes

Returns:

an iterator yielding the elements of this NArray in reversed order

Source:
TypedArrayOps.scala
inline def scan[B >: A : ClassTag](z: B)(op: (B, B) => B): NArray[B]

Computes scan of the elements of the NArray.

Computes scan of the elements of the NArray.

  • Note: Th element z may be applied more than once.

Attributes

B

element type of the resulting NArray

op

the associative operator for the scan

z

neutral element for the operator op

Returns:

a new NArray containing the prefix an of the elements in this NArray

Source:
TypedArrayOps.scala
inline def scanLeft[B : ClassTag](z: B)(op: (B, A) => B): NArray[B]

P duces a N y containing cumulative results of applying e binary operator going left to right.

P duces a N y containing cumulative results of applying e binary operator going left to right.

Attributes

B

the result type of the binary operator.* @eturn NAray with intermediate values. Example:

  NArray(1, 2, 3, 4).scanLeft(0)(_ + _) = NArray(0, 1, 3, 6, 10)
op

the binary operator.

z

the start value.

Source:
TypedArrayOps.scala
inline def scanRight[B : ClassTag](z: B)(op: (A, B) => B): NArray[B]

Produces an NArray containing cumulative resu s of ap ying the binary operator going right o left.

Produces an NArray containing cumulative resu s of ap ying the binary operator going right o left.

Attributes

B

the result type of the bnry operato.

op

the binary operator.

z

the start value.

Returns:

NArray with intermediate values. Example:

  NArray(4, 3, 2, 1).scanRight(0)(_ + _) == NArray(10, 6, 3, 1, 0) * 
Source:
TypedArrayOps.scala
inline def size: Int

The size of this NArray.

The size of this NArray.

Attributes

Returns:

the number of elements in this NArray.

Source:
TypedArrayOps.scala
inline def sizeCompare(otherSize: Int): Int

Compares the size of this NArray to a test value.

Compares the size of this NArray to a test value.

Attributes

otherSize

the test value that gets compared with the size.

Returns:

A value x where

      x <  0       if this.size <  otherSize
      x == 0       if this.size == otherSize
      x >  0       if this.size >  otherSize
Source:
TypedArrayOps.scala
inline def sizeIs: Int

Method mirroring SeqOps.sizeIs for consistency, except it returns an Int because size is known and comparison is constant-time.

Method mirroring SeqOps.sizeIs for consistency, except it returns an Int because size is known and comparison is constant-time.

These operations are equivalent to `sizeCompare(Int)`, and allow the following more readable usages:

this.sizeIs < size     // this.sizeCompare(size) < 0
this.sizeIs <= size    // this.sizeCompare(size) <= 0
this.sizeIs == size    // this.sizeCompare(size) == 0
this.sizeIs != size    // this.sizeCompare(size) != 0
this.sizeIs >= size    // this.sizeCompare(size) >= 0
this.sizeIs > size     // this.sizeCompare(size) > 0

Attributes

Source:
TypedArrayOps.scala
inline def slice(from: Int, until: Int): RT

Selects an interval of elements. The returned NArray is made up of all elements x which satisfy the invariant:

Selects an interval of elements. The returned NArray is made up of all elements x which satisfy the invariant:

 from <= indexOf(x) < until

** @param from the lowest index to include from th NArray.

Attributes

Returns:

an NArray containing the elements greater than or equal to index from extending up to (but not including) index until of this NArray.

Source:
TypedArrayOps.scala
inline def sliding(size: Int, step: Int): Iterator[NArray[A]]

Groups elements in fixed size blocks by passing a "slid g window" over them (as opposed to partitioning them, as is d e in g uped.)

Groups elements in fixed size blocks by passing a "slid g window" over them (as opposed to partitioning them, as is d e in g uped.)

Attributes

size

the number of eleme s per group

step

the distance between the first elements of succ sive groups

Returns:

An iterator producing NArrays of size size , except the last element (which may be the only ele be truncated if there are fewer than size elements rem ning to be grouped.

See also:

scala.collection.Iterator, method sliding

Source:
TypedArrayOps.scala
inline def sortBy[B](f: A => B)(implicit ord: Ordering[B]): NArray[A]

Sor this NArray according to the Ordering which results from transforming an implicitly given Ordering ith a n formation function.

Sor this NArray according to the Ordering which results from transforming an implicitly given Ordering ith a n formation function.

Attributes

B

the target type of the transformation f, nd the pe where the ordering ord is inline defined.

f

the transform ion fu ion mapping elements to some her dom n B.

ord

the ordering assumed on domain B.

Returns:

an NArray consisting of the elements of this NArray* sorted according to the ordering where x < y if ord.lt(f(x), f(y)).

See also:
Source:
TypedArrayOps.scala
inline def sortWith(lt: (A, A) => Boolean): NArray[A]

Sorts t s NArray according to a comparison function.

Sorts t s NArray according to a comparison function.

The sort is stable. hat is, elements that are equal (as determined by lt) appear in the same or r in t s ted sequence as in the original.

Attributes

lt

the comparison function which tests whether its first argument precedes ts seco gument in the desired ordering.

Returns:

an NArray consisting of the elements of this NArray sorted according to the comparison function lt.

Source:
TypedArrayOps.scala
inline def sorted[B >: A](implicit ord: Ordering[B]): NArray[A]

Sorts this NArray according to an Ordering.

Sorts this NArray according to an Ordering.

The sort is stable. T t is, elements that are equal (as determined by lt) appear in the same orde in the sorted sequence as in the iginal.

Attributes

ord

the ing to be used to compare elements.

Returns:

an ting of the elements of this NArray sorted according to the ordering ord.

See also:
Source:
TypedArrayOps.scala
inline def span(p: A => Boolean): (NArray[A], NArray[A])

Splits this NArray into a prefix/suffix pair according to a pre cate.

Splits this NArray into a prefix/suffix pair according to a pre cate.

Note: c span p is equivalent to (but more eff ient than) (c takeWhile p, c dropWhile p), provided the evalu ion of the predicate p does not cause any side-e ects.

Attributes

p

the te predic e

Returns:

a pair consisting of the longest prefix of this e elements all satisfy p, and the rest of this NArray.

Source:
TypedArrayOps.scala
inline def splitAt(n: Int): (NArray[A], NArray[A])

Splits this NArray into two at a given position. Note: c splitAt n is equivalent to (c take n, c dr n).

Splits this NArray into two at a given position. Note: c splitAt n is equivalent to (c take n, c dr n).

Attributes

n

the position at whi to spl .

Returns:

a pair of NArrays consisting of the first n elements of this NArray, and the other elements.

Source:
TypedArrayOps.scala
inline def startsWith[B >: A](that: NArray[B]): Boolean

Tests whether this NArray starts with the given NArray.

Tests whether this NArray starts with the given NArray.

Attributes

Source:
TypedArrayOps.scala
inline def startsWith[B >: A](that: NArray[B], offset: Int): Boolean

Tests whether this NArray contains the given NArray at a given index.

Tests whether this NArray contains the given NArray at a given index.

Attributes

offset

the index where the NArray is searched.

that

the NArray test

Returns:

true if the NArray that is contained in this NArray at index offset, otherwise false.

Source:
TypedArrayOps.scala
inline def startsWith[B >: A](that: IterableOnce[B], offset: Int): Boolean

Tests whether this NArray contains the given sequence at giv ndex.

Tests whether this NArray contains the given sequence at giv ndex.

Attributes

offset

the index where the seque is searched.

that

the sequen to test

Returns:

true if the sequence that is cont ned in his ay at index offset, otherwise false.

Source:
TypedArrayOps.scala
inline def tail: RT

The rest of the NArray without its first element.

The rest of the NArray without its first element.

Attributes

Source:
TypedArrayOps.scala
inline def tails: Iterator[NArray[A]]

Iterates over the tails of this NArray. The first value will be this NArray and the one will be an empty NArray, with the intervening values the results of successive applications of tail.

Iterates over the tails of this NArray. The first value will be this NArray and the one will be an empty NArray, with the intervening values the results of successive applications of tail.

Attributes

Returns:

an iterator over all the tails of this NArray

Source:
TypedArrayOps.scala
inline def take(n: Int): RT

An NArray containing the first n elements of this NArray.

An NArray containing the first n elements of this NArray.

Attributes

Source:
TypedArrayOps.scala
inline def takeRight(n: Int): RT

An NArray containing the last n elements of this NArray.

An NArray containing the last n elements of this NArray.

Attributes

Source:
TypedArrayOps.scala
inline def takeWhile(p: A => Boolean): RT

Takes longest prefix of elements that satisfy a predicate.

Takes longest prefix of elements that satisfy a predicate.

Attributes

p

The predicate used to test ele nts.

Returns:

the longest prefix of this NArray whose elements all satisfy the predicate p.

Source:
TypedArrayOps.scala
def toArray[B >: A : ClassTag]: Array[B]

Create a copy of this NArray with the specified element

Create a copy of this NArray with the specified element

e.

Attributes

Source:
TypedArrayOps.scala

Attributes

Source:
TypedArrayOps.scala
inline def toSeq: Seq[A]

Attributes

Source:
TypedArrayOps.scala
inline def transpose[B](using asNArray: A => NArray[B]): NArray[NArray[B]]

Transposes a two dimensional NArray.

Transposes a two dimensional NArray.

Attributes

B

Type of row elements.

asNArray

A function that converts elements of this NArray to rows - NArrays of type B.

Returns:

An NArray obtained by replacing elements of this NArrays with rows the represent.

Source:
TypedArrayOps.scala
inline def unzip[A1, A2](implicit asPair: A => (A1, A2), ct1: ClassTag[A1], ct2: ClassTag[A2]): (NArray[A1], NArray[A2])

Converts an NArray of pairs into an NArray of first elements and an NArray of second elements.

Converts an NArray of pairs into an NArray of first elements and an NArray of second elements.

Attributes

A1

the type of the first half of the element pairs

A2

the type of the second half of the element pairs

asPair

an implicit conversion which asserts that the element type of this NArray is a pair.

ct1

a class tag for A1 type parameter that is required to create an instance of NArray[A1]

ct2

a class tag for A2 type parameter that is required to create an instance of NArray[A2]

Returns:

a pair of NArrays, containing, respectively, the first and second half of each element pair of this NArray.

Source:
TypedArrayOps.scala
inline def unzip3[A1, A2, A3](implicit asTriple: A => (A1, A2, A3), ct1: ClassTag[A1], ct2: ClassTag[A2], ct3: ClassTag[A3]): (NArray[A1], NArray[A2], NArray[A3])

Converts an NArray of triples into three NArrays, one containing the elements from each position of the triple.

Converts an NArray of triples into three NArrays, one containing the elements from each position of the triple.

Attributes

A1

the type of the first of three elements in the triple

A2

the type of the second of three elements in the triple

A3

the type of the third of three elements in the triple

asTriple

an implicit conversion which asserts that the element type of this NArray is a triple.

ct1

a class tag for T1 type parameter that is required to create an instance of NArray[T1]

ct2

a class tag for T2 type parameter that is required to create an instance of NArray[T2]

ct3

a class tag for T3 type parameter that is required to create an instance of NArray[T3]

Returns:

a triple of NArrays, containing, respectively, the first, second, and third elements from each element triple of this NArray.

Source:
TypedArrayOps.scala
inline def updated[B >: A : ClassTag](index: Int, elem: B): NArray[B]

A c y of this NArray with one single r laced ement. *

A c y of this NArray with one single r laced ement. *

Attributes

elem

the replac g element

index

the position of the placem t

Returns:

a new NArray which is a copy of this NArray with the element at position index replaced y elem.

Throws:
IndexOutOfBoundsException

if index does not satisfy 0 <= index < length.

Source:
TypedArrayOps.scala
inline def zip[B](that: IterableOnce[B]): Array[(A, B)]

Returns an NArray formed from this NArray and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.

Returns an NArray formed from this NArray and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.

Attributes

B

the type of the second half of the returned pairs

that

The iterable providing the second half of each result pair

Returns:

a new NArray containing pairs consisting of corresponding elements of this NArray and that. The length of the returned NArray is the minimum of the lengths of this NArray and that.

Source:
TypedArrayOps.scala
inline def zipAll[A1 >: A, B](that: Iterable[B], thisElem: A1, thatElem: B): Array[(A1, B)]

Returns an NArray formed from this NArray and another iterable collection by combining corresponding elements in pairs. If one of the two collections is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the longer.

Returns an NArray formed from this NArray and another iterable collection by combining corresponding elements in pairs. If one of the two collections is shorter than the other, placeholder elements are used to extend the shorter collection to the length of the longer.

Attributes

that

the iterable providing the second half of each result pair

thatElem

the element to be used to fill up the result if that is shorter than this NArray.

thisElem

the element to be used to fill up the result if this NArray is shorter than that.

Returns:

a new NArray containing pairs consisting of corresponding elements of this NArray and that. The length of the returned NArray is the maximum of the lengths of this NArray and that. If this NArray is shorter than that, thisElem values are used to pad the result. If that is shorter than this NArray, thatElem values are used to pad the result.

Source:
TypedArrayOps.scala
inline def zipWithIndex: Array[(A, Int)]

Zips this NArray with its indices.

Zips this NArray with its indices.

Attributes

Returns:

A new NArray containing pairs consisting of all elements of this NArray paired with their index. Indices start at 0.

Source:
TypedArrayOps.scala