Array3D Module
Contains operations for working with rank 3 arrays.
See also F# Language Guide - Arrays.
Functions and values
Function or value |
Description
|
Full Usage:
Array3D.create length1 length2 length3 initial
Parameters:
int
-
The length of the first dimension.
length2 : int
-
The length of the second dimension.
length3 : int
-
The length of the third dimension.
initial : 'T
-
The value of the array elements.
Returns: 'T[,,]
The created array.
|
Creates an array whose elements are all initially the given value.
Example
module Array3D
from Microsoft.FSharp.Collections
val create: length1: int -> length2: int -> length3: int -> initial: 'T -> 'T array3d
Evaluates to a 2x3 array with contents [[[1; 1; 1]; [1; 1; 1]]; [[1; 1; 1]; [1; 1; 1]]]
|
|
Fetches an element from a 3D array. You can also use the syntax 'array.[index1,index2,index3]' Indexer syntax is generally preferred, e.g.
Multiple items
val array: int array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
Evaluates to 11 .
Example
Multiple items
val array: int array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val get: array: 'T array3d -> index1: int -> index2: int -> index3: int -> 'T
Evaluates to 21 .
|
Full Usage:
Array3D.init length1 length2 length3 initializer
Parameters:
int
-
The length of the first dimension.
length2 : int
-
The length of the second dimension.
length3 : int
-
The length of the third dimension.
initializer : int -> int -> int -> 'T
-
The function to create an initial value at each index into the array.
Returns: 'T[,,]
The created array.
|
Creates an array given the dimensions and a generator function to compute the elements.
Example
module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
Evaluates to a 2x2x3 array with contents [[[0; 1; 2]; [10; 11; 12]]; [[100; 101; 102]; [110; 111; 112]]]
|
Full Usage:
Array3D.iter action array
Parameters:
'T -> unit
-
The function to apply to each element of the array.
array : 'T[,,]
-
The input array.
|
Applies the given function to each element of the array.
Example
val inputs: int array3d
module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val iter: action: ('T -> unit) -> array: 'T array3d -> unit
val v: int
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
Evaluates to unit and prints
in the console.
|
|
Applies the given function to each element of the array. The integer indices passed to the function indicates the index of element.
Example
val inputs: int array3d
module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val iteri: action: (int -> int -> int -> 'T -> unit) -> array: 'T array3d -> unit
val v: int
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
Evaluates to unit and prints
in the console.
|
Full Usage:
Array3D.length1 array
Parameters:
'T[,,]
-
The input array.
Returns: int
The length of the array in the first dimension.
|
Returns the length of an array in the first dimension
Example
Multiple items
val array: int array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val length1: array: 'T array3d -> int
Evaluates to 2 .
|
Full Usage:
Array3D.length2 array
Parameters:
'T[,,]
-
The input array.
Returns: int
The length of the array in the second dimension.
|
Returns the length of an array in the second dimension.
Example
Multiple items
val array: int array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val length2: array: 'T array3d -> int
Evaluates to 3 .
|
Full Usage:
Array3D.length3 array
Parameters:
'T[,,]
-
The input array.
Returns: int
The length of the array in the third dimension.
|
Returns the length of an array in the third dimension.
Example
Multiple items
val array: int array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val length3: array: 'T array3d -> int
Evaluates to 4 .
|
Full Usage:
Array3D.map mapping array
Parameters:
'T -> 'U
-
The function to transform each element of the array.
array : 'T[,,]
-
The input array.
Returns: 'U[,,]
The array created from the transformed elements.
|
Builds a new array whose elements are the results of applying the given function to each of the elements of the array. For non-zero-based arrays the basing on an input array will be propagated to the output array.
Example
val inputs: int array3d
module Array3D
from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> initializer: (int -> int -> int -> 'T) -> 'T array3d
val i: int
val j: int
val k: int
val map: mapping: ('T -> 'U) -> array: 'T array3d -> 'U array3d
val v: int
Evaluates to a 2x3x3 array with contents [[[0; 2; 4]; [20; 22; 24]]; [[200; 202; 204]; [220; 222; 224]]]
|
|
Builds a new array whose elements are the results of applying the given function to each of the elements of the array. The integer indices passed to the function indicates the element being transformed. For non-zero-based arrays the basing on an input array will be propagated to the output array.
Example
val inputs: obj array3d
module Array3D
from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> 'T array3d
val mapi: mapping: (int -> int -> int -> 'T -> 'U) -> array: 'T array3d -> 'U array3d
val i: int
val j: int
val k: int
val v: obj
Evaluates to a 2x3x3 array with contents [[[0; 2; 4]; [20; 22; 24]]; [[200; 202; 204]; [220; 222; 224]]]
|
Full Usage:
Array3D.set array index1 index2 index3 value
Parameters:
'T[,,]
-
The input array.
index1 : int
-
The index along the first dimension.
index2 : int
-
The index along the second dimension.
index3 : int
-
The index along the third dimension.
value : 'T
-
The value to set at the given index.
|
Sets the value of an element in an array. You can also use the syntax 'array.[index1,index2,index3] <- value'. Indexer syntax is generally preferred, e.g.
Multiple items
val array: float array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> 'T array3d
Evaluates to 11 .
Example
Multiple items
val array: float array3d -------------------- type 'T array = 'T array module Array3D
from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> 'T array3d
val set: array: 'T array3d -> index1: int -> index2: int -> index3: int -> value: 'T -> unit
After evaluation array is a 2x3x3 array with contents [[[0.0; 0.0; 0.0]; [0.0; 4.0; 0.0]]; [[0.0; 0.0; 0.0]; [0.0; 0.0; 0.0]]]
|
|
Creates an array where the entries are initially the "default" value.
Example
Multiple items
val array: float array3d -------------------- type 'T array = 'T array Multiple items
val float: value: 'T -> float (requires member op_Explicit) -------------------- type float = System.Double -------------------- type float<'Measure> = float module Array3D
from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> 'T array3d
After evaluation array is a 2x3x3 array with contents all zero.
|