Array4D (FSharp.Core)
Creates an array whose elements are all initially the given value
Creates an array whose elements are all initially the given value
-
length1
:
int -
The length of the first dimension.
-
length2
:
int -
The length of the second dimension.
-
length3
:
int -
The length of the third dimension.
-
length4
:
int -
The length of the fourth dimension.
-
initial
:
'T -
The initial value for each element of the array.
-
Returns:
'T[,,,] -
The created array.
Array4D.create 2 2 2 2 1
module Array4D from Microsoft.FSharp.Collections
val create: length1: int -> length2: int -> length3: int -> length4: int -> initial: 'T -> 'T array4d
Evaluates to a 2x2x2x2 array with all entries1
Fetches an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]'
Fetches an element from a 4D array. You can also use the syntax 'array.[index1,index2,index3,index4]'
let array: float[,,,] = Array4D.zeroCreate 2 3 4 5
array[0,2,1,3]
Multiple items
val array: float array4d
--------------------
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 Array4D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> length4: int -> 'T array4d
-
array
:
'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.
-
index4
:
int -
The index along the fourth dimension.
-
Returns:
'T -
The value at the given index.
let array = Array4D.zeroCreate 2 3 4 5
Array4D.get array 0 2 1 3
Multiple items
val array: obj array4d
--------------------
type 'T array = 'T array
module Array4D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> length4: int -> 'T array4d
val get: array: 'T array4d -> index1: int -> index2: int -> index3: int -> index4: int -> 'T
Creates an array given the dimensions and a generator function to compute the elements.
Creates an array given the dimensions and a generator function to compute the elements.
-
length1
:
int -
The length of the first dimension.
-
length2
:
int -
The length of the second dimension.
-
length3
:
int -
The length of the third dimension.
-
length4
:
int -
The length of the fourth dimension.
-
initializer
:
int -> int -> int -> int -> 'T -
The function to create an initial value at each index in the array.
-
Returns:
'T[,,,] -
The created array.
Array4D.init 2 2 2 2 (fun i j k l -> i*1000+j*100+k*10+l)
module Array4D from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> length4: int -> initializer: (int -> int -> int -> int -> 'T) -> 'T array4d
val i: int
val j: int
val k: int
val l: int
Evaluates to a 2x2x2x2 array with contents[[[[0; 1]; [10; 11]]; [[100; 101]; [110; 111]]];[[[1000; 1]; [1010; 1011]]; [[1100; 1101]; [1110; 1111]]]]
Returns the length of an array in the first dimension
Returns the length of an array in the first dimension
-
array
:
'T[,,,] -
The input array.
-
Returns:
int -
The length of the array in the first dimension.
let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
array |> Array4D.length1
type 'T array = 'T array
module Array4D from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> length4: int -> initializer: (int -> int -> int -> int -> 'T) -> 'T array4d
val i: int
val j: int
val k: int
val length1: array: 'T array4d -> int
Evaluates to2.
Returns the length of an array in the second dimension.
Returns the length of an array in the second dimension.
-
array
:
'T[,,,] -
The input array.
-
Returns:
int -
The length of the array in the second dimension.
let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
array |> Array4D.length2
type 'T array = 'T array
module Array4D from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> length4: int -> initializer: (int -> int -> int -> int -> 'T) -> 'T array4d
val i: int
val j: int
val k: int
val length2: array: 'T array4d -> int
Evaluates to3.
Returns the length of an array in the third dimension.
Returns the length of an array in the third dimension.
-
array
:
'T[,,,] -
The input array.
-
Returns:
int -
The length of the array in the third dimension.
let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
array |> Array4D.length3
type 'T array = 'T array
module Array4D from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> length4: int -> initializer: (int -> int -> int -> int -> 'T) -> 'T array4d
val i: int
val j: int
val k: int
val length3: array: 'T array4d -> int
Evaluates to4.
Returns the length of an array in the fourth dimension.
Returns the length of an array in the fourth dimension.
-
array
:
'T[,,,] -
The input array.
-
Returns:
int -
The length of the array in the fourth dimension.
let array = Array4D.init 2 3 4 5 (fun i j k -> 100*i + 10*j + k)
array |> Array4D.length4
type 'T array = 'T array
module Array4D from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> length3: int -> length4: int -> initializer: (int -> int -> int -> int -> 'T) -> 'T array4d
val i: int
val j: int
val k: int
val length4: array: 'T array4d -> int
Evaluates to5.
Sets the value of an element in an array. You can also
use the syntax 'array.[index1,index2,index3,index4] <- value'.
Sets the value of an element in an array. You can also use the syntax 'array.[index1,index2,index3,index4] <- value'.
let array: float[,,,] = Array4D.zeroCreate 2 3 4 5
array[0,2,1,3] <- 5.0
Multiple items
val array: float array4d
--------------------
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 Array4D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> length4: int -> 'T array4d
-
array
:
'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.
-
index4
:
int -
The index along the fourth dimension.
-
value
:
'T -
The value to set.
let array = Array4D.zeroCreate 2 3 4 5
Array4D.2et array 0 2 1 3 5.0
Multiple items
val array: obj array4d
--------------------
type 'T array = 'T array
module Array4D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> length4: int -> 'T array4d
Creates an array where the entries are initially the "default" value.
Creates an array where the entries are initially the "default" value.
-
length1
:
int -
The length of the first dimension.
-
length2
:
int -
The length of the second dimension.
-
length3
:
int -
The length of the third dimension.
-
length4
:
int -
The length of the fourth dimension.
-
Returns:
'T[,,,] -
The created array.
let array : float[,,,] = Array4D.zeroCreate 2 3 3 5
Multiple items
val array: float array4d
--------------------
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 Array4D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> length3: int -> length4: int -> 'T array4d
After evaluationarray is a 2x3x3x5 array with contents all zero.