Creates an array whose elements are all initially the given value.
int
The length of the first dimension.
int
The length of the second dimension.
int
The length of the third dimension.
'T
The value of the array elements.
'T[,,]
The created array.
Array3D.create 2 2 3 1
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]'
let array = Array3D.init 2 3 3 (fun i j k -> 100*i + 10*j + k)
array[0,2,1]
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 to11
.
'T[,,]
The input array.
int
The index along the first dimension.
int
The index along the second dimension.
int
The index along the third dimension.
'T
The value at the given index.
let array = Array3D.init 2 3 3 (fun i j k -> 100*i + 10*j + k)
Array3D.get array 0 2 1
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 to21
.
Creates an array given the dimensions and a generator function to compute the elements.
int
The length of the first dimension.
int
The length of the second dimension.
int
The length of the third dimension.
int -> int -> int -> 'T
The function to create an initial value at each index into the array.
'T[,,]
The created array.
Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k)
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]]]
Applies the given function to each element of the array.
'T -> unit
The function to apply to each element of the array.
'T[,,]
The input array.
let inputs = Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k)
inputs |> Array3D.iter (fun v -> printfn $"value = {v}")
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 tounit
and prints
value = 0
value = 1
value = 2
value = 10
value = 11
value = 12
value = 100
value = 101
value = 102
value = 110
value = 111
value = 112
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.
int -> int -> int -> 'T -> unit
The function to apply to each element of the array.
'T[,,]
The input array.
let inputs = Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k)
inputs |> Array3D.iteri (fun i j k v -> printfn $"value at ({i},{j},{k}) = {v}")
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 tounit
and prints
value at (0,0,0) = 0
value at (0,0,1) = 1
value at (0,0,2) = 2
value at (0,1,0) = 10
value at (0,1,1) = 11
value at (0,1,2) = 12
value at (1,0,0) = 100
value at (1,0,1) = 101
value at (1,0,2) = 102
value at (1,1,0) = 110
value at (1,1,1) = 111
value at (1,1,2) = 112
in the console.
Returns the length of an array in the first dimension
'T[,,]
The input array.
int
The length of the array in the first dimension.
let array = Array3D.init 2 3 4 (fun i j k -> 100*i + 10*j + k)
array |> Array3D.length1
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 to2
.
Returns the length of an array in the second dimension.
'T[,,]
The input array.
int
The length of the array in the second dimension.
let array = Array3D.init 2 3 4 (fun i j k -> 100*i + 10*j + k)
array |> Array3D.length2
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 to3
.
Returns the length of an array in the third dimension.
'T[,,]
The input array.
int
The length of the array in the third dimension.
let array = Array3D.init 2 3 4 (fun i j k -> 100*i + 10*j + k)
array |> Array3D.length3
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 to4
.
Builds a new array whose elements are the results of applying the given function to each of the elements of the array.
'T -> 'U
The function to transform each element of the array.
'T[,,]
The input array.
'U[,,]
The array created from the transformed elements.
let inputs = Array3D.init 2 3 3 (fun i j k -> 100*i + 10*j + k)
inputs |> Array3D.map (fun v -> 2 * v)
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.
int -> int -> int -> 'T -> 'U
The function to transform the elements at each index in the array.
'T[,,]
The input array.
'U[,,]
The array created from the transformed elements.
let inputs = Array3D.zeroCreate 2 3 3
inputs |> Array3D.mapi (fun i j k v -> 100*i + 10*j + k)
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]]]
Sets the value of an element in an array. You can also use the syntax 'array.[index1,index2,index3] <- value'.
let array = Array3D.zeroCreate 2 3 3
array[0,2,1] < 4.0
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 to11
.
'T[,,]
The input array.
int
The index along the first dimension.
int
The index along the second dimension.
int
The index along the third dimension.
'T
The value to set at the given index.
let array = Array3D.zeroCreate 2 3 3
Array3D.set array 0 2 1 4.0
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 evaluationarray
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.
int
The length of the first dimension.
int
The length of the second dimension.
int
The length of the third dimension.
'T[,,]
The created array.
let array : float[,,] = Array3D.zeroCreate 2 3 3
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 evaluationarray
is a 2x3x3 array with contents all zero.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4