ArrayΒΆ
Class and companion object for managing one dimensional arrays on the CPU.
Note that this type shadows the unstaged Scala Array. In the case where an unstaged Array type is required, use the full scala.Array name.
Constructor
The following syntax is available for constructing Arrays from indexed functions:
(0::32){i => func(i) }
This returns an Array of size 32 with elements defined by func(i). More general Range forms can also be used, including strided (e.g. 0::2::8) and offset (e.g. 32::64). The iterator i will iterate over all values in the supplied range.
Static methods
object Array | |
---|---|
def **
|
|
Infix methods
class Array[T] | |
---|---|
def length: Index
Returns the size of this Array.
|
|
def apply(i: Index): T
Returns the element at index i.
|
|
def reduce(rfunc: (T,T) => T): T
Reduces the elements in this Array into a single element using associative function rfunc.
|
|
def fold(init: T)(rfunc: (T,T) => T): T
Reduces the elements in this Array and the given initial value into a single element
using associative function rfunc.
|
|
def filter(cond: T => MBoolean): Array[T]
Returns a new Array with all elements in this Array which satisfy the given predicate cond.
|
|
def mkString(delimeter: String)
Creates a string representation of this Array using the given delimeter.
|
|
def !=(that: Array[T]): MBoolean = this.zip(that){(x,y) => x =!
Returns true if this Array and that differ by at least one element, false otherwise.
|
|
def ==(that: Array[T]): MBoolean = this.zip(that){(x,y) => x ==
Returns true if this Array and that contain the same elements, false otherwise.
|