VOOZH about

URL: https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-array2dmodule.html

⇱ Array2D (FSharp.Core) | FSharp.Core


Array2D Module

Namespace: FSharp.Collections
Assembly: FSharp.Core.dll

Contains operations for working with 2-dimensional arrays.

See also F# Language Guide - Arrays.

F# and CLI multi-dimensional arrays are typically zero-based. However, CLI multi-dimensional arrays used in conjunction with external libraries (e.g. libraries associated with Visual Basic) be non-zero based, using a potentially different base for each dimension. The operations in this module will accept such arrays, and the basing on an input array will be propagated to a matching output array on the Array2D.map and Array2D.mapi operations. Non-zero-based arrays can also be created using Array2D.zeroCreateBased, Array2D.createBased and Array2D.initBased.

Functions and values

Function or value Description

Array2D.base1 array

Full Usage: Array2D.base1 array

Parameters:
    array : 'T[,] - The input array.

Returns: int The base-index of the first dimension of the array.
Type parameters: 'T

Array2D.base2 array

Full Usage: Array2D.base2 array

Parameters:
    array : 'T[,] - The input array.

Returns: int The base-index of the second dimension of the array.
Type parameters: 'T

Array2D.blit source sourceIndex1 sourceIndex2 target targetIndex1 targetIndex2 length1 length2

Full Usage: Array2D.blit source sourceIndex1 sourceIndex2 target targetIndex1 targetIndex2 length1 length2

Parameters:
    source : 'T[,] - The source array.
    sourceIndex1 : int - The first-dimension index to begin copying from in the source array.
    sourceIndex2 : int - The second-dimension index to begin copying from in the source array.
    target : 'T[,] - The target array.
    targetIndex1 : int - The first-dimension index to begin copying into in the target array.
    targetIndex2 : int - The second-dimension index to begin copying into in the target array.
    length1 : int - The number of elements to copy across the first dimension of the arrays.
    length2 : int - The number of elements to copy across the second dimension of the arrays.

Type parameters: 'T

Array2D.copy array

Full Usage: Array2D.copy array

Parameters:
    array : 'T[,] - The input array.

Returns: 'T[,] A copy of the input array.
Type parameters: 'T

Array2D.create length1 length2 value

Full Usage: Array2D.create length1 length2 value

Parameters:
    length1 : int - The length of the first dimension of the array.
    length2 : int - The length of the second dimension of the array.
    value : 'T - The value to populate the new array.

Returns: 'T[,] The created array.
Type parameters: 'T

Array2D.createBased base1 base2 length1 length2 initial

Full Usage: Array2D.createBased base1 base2 length1 length2 initial

Parameters:
    base1 : int - The base for the first dimension of the array.
    base2 : int - The base for the second dimension of the array.
    length1 : int - The length of the first dimension of the array.
    length2 : int - The length of the second dimension of the array.
    initial : 'T - The value to populate the new array.

Returns: 'T[,] The created array.
Type parameters: 'T

Array2D.get array index1 index2

Full Usage: Array2D.get array index1 index2

Parameters:
    array : 'T[,] - The input array.
    index1 : int - The index along the first dimension.
    index2 : int - The index along the second dimension.

Returns: 'T The value of the array at the given index.
Type parameters: 'T

Array2D.init length1 length2 initializer

Full Usage: Array2D.init length1 length2 initializer

Parameters:
    length1 : int - The length of the first dimension of the array.
    length2 : int - The length of the second dimension of the array.
    initializer : int -> int -> 'T - A function to produce elements of the array given the two indices.

Returns: 'T[,] The generated array.
Type parameters: 'T

Array2D.initBased base1 base2 length1 length2 initializer

Full Usage: Array2D.initBased base1 base2 length1 length2 initializer

Parameters:
    base1 : int - The base for the first dimension of the array.
    base2 : int - The base for the second dimension of the array.
    length1 : int - The length of the first dimension of the array.
    length2 : int - The length of the second dimension of the array.
    initializer : int -> int -> 'T - A function to produce elements of the array given the two indices.

Returns: 'T[,] The created array.
Type parameters: 'T

Array2D.iter action array

Full Usage: Array2D.iter action array

Parameters:
    action : 'T -> unit - A function to apply to each element of the array.
    array : 'T[,] - The input array.

Type parameters: 'T

Array2D.iteri action array

Full Usage: Array2D.iteri action array

Parameters:
    action : int -> int -> 'T -> unit - A function to apply to each element of the array with the indices available as an argument.
    array : 'T[,] - The input array.

Type parameters: 'T

Array2D.length1 array

Full Usage: Array2D.length1 array

Parameters:
    array : 'T[,] - The input array.

Returns: int The length of the array in the first dimension.
Type parameters: 'T

Array2D.length2 array

Full Usage: Array2D.length2 array

Parameters:
    array : 'T[,] - The input array.

Returns: int The length of the array in the second dimension.
Type parameters: 'T

Array2D.map mapping array

Full Usage: Array2D.map mapping array

Parameters:
    mapping : 'T -> 'U - A function that is applied to transform each item of the input array.
    array : 'T[,] - The input array.

Returns: 'U[,] An array whose elements have been transformed by the given mapping.
Type parameters: 'T, 'U

Array2D.mapi mapping array

Full Usage: Array2D.mapi mapping array

Parameters:
    mapping : int -> int -> 'T -> 'U - A function that is applied to transform each element of the array. The two integers provide the index of the element.
    array : 'T[,] - The input array.

Returns: 'U[,] An array whose elements have been transformed by the given mapping.
Type parameters: 'T, 'U

Array2D.rebase array

Full Usage: Array2D.rebase array

Parameters:
    array : 'T[,] - The input array.

Returns: 'T[,] The zero-based output array.
Type parameters: 'T

Array2D.set array index1 index2 value

Full Usage: Array2D.set array index1 index2 value

Parameters:
    array : 'T[,] - The input array.
    index1 : int - The index along the first dimension.
    index2 : int - The index along the second dimension.
    value : 'T - The value to set in the array.

Type parameters: 'T

Array2D.zeroCreate length1 length2

Full Usage: Array2D.zeroCreate length1 length2

Parameters:
    length1 : int - The length of the first dimension of the array.
    length2 : int - The length of the second dimension of the array.

Returns: 'T[,] The created array.
Type parameters: 'T

Array2D.zeroCreateBased base1 base2 length1 length2

Full Usage: Array2D.zeroCreateBased base1 base2 length1 length2

Parameters:
    base1 : int - The base for the first dimension of the array.
    base2 : int - The base for the second dimension of the array.
    length1 : int - The length of the first dimension of the array.
    length2 : int - The length of the second dimension of the array.

Returns: 'T[,] The created array.
Type parameters: 'T