# Microsoft.Quantum.Arrays

This namespace contains functions for creating and manipulating arrays of data.

## Operations

DrawMany operation |
Repeats an operation for a given number of samples, collecting its outputs in an array. |

ForEach operation |
Given an array and an operation that is defined for the elements of the array, returns a new array that consists of the images of the original array under the operation. |

## Functions

All function |
Given an array and a predicate that is defined for the elements of the array, and checks if all elements of the array satisfy the predicate. |

Any function |
Given an array and a predicate that is defined for the elements of the array, checks if at least one element of the array satisfies the predicate. |

Chunks function |
Splits an array into multiple parts of equal length. |

ColumnAt function |
Extracts a column from a matrix. |

ColumnAtUnchecked function |
This function does not check for matrix shape |

ConstantArray function |
Creates an array of given length with all elements equal to given value. |

Count function |
Given an array and a predicate that is defined for the elements of the array, returns the number of elements an array that consists of those elements that satisfy the predicate. |

CumulativeFolded function |
Combines Mapped and Fold into a single function |

Diagonal function |
Returns an array of diagonal elements of a 2-dimensional array |

ElementAt function |
Returns the at the given index of an array. |

ElementAtDiagonal function | |

ElementsAt function |
Returns the array's elements at a given range of indices. |

EmptyArray function |
Returns the empty array of a given type. |

Enumerated function |
Given an array, returns a new array containing elements of the original array along with the indices of each element. |

EqualA function |
Given two arrays of the same type and a predicate that is defined for pairs of elements of the arrays, checks whether the arrays are equal. |

Exclude function |
Returns an array containing the elements of another array, excluding elements at a given list of indices. |

Excluding function |
Returns an array containing the elements of another array, excluding elements at a given list of indices. |

Filtered function |
Given an array and a predicate that is defined for the elements of the array, returns an array that consists of those elements that satisfy the predicate. |

FlatMapped function |
Given an array and a function that maps an array element to some output array, returns the concatenated output arrays for each array element. |

Flattened function |
Given an array of arrays, returns the concatenation of all arrays. |

Fold function |
Iterates a function |

Head function |
Returns the first element of the array. |

HeadAndRest function |
Returns a tuple of first and all remaining elements of the array. |

Identity function | |

IndexOf function |
Returns the first index of the first element in an array that satisfies a given predicate. If no such element exists, returns -1. |

IndexRange function |
Given an array, returns a range over the indices of that array, suitable for use in a for loop. |

Interleaved function |
Interleaves two arrays of (almost) same size. |

IsEmpty function |
Returns true if and only if an array is empty. |

IsPermutation function |
Outputs true if and only if a given array represents a permutation. |

IsSorted function |
Given an array, returns whether that array is sorted as defined by a given comparison function. |

IsValuePresent function | |

LookupFunction function |
Given an array, returns a function which returns elements of that array. |

Mapped function |
Given an array and a function that is defined for the elements of the array, returns a new array that consists of the images of the original array under the function. |

MappedByIndex function |
Given an array and a function that is defined for the indexed elements of the array, returns a new array that consists of the images of the original array under the function. |

MappedOverRange function |
Given a range and a function that takes an integer as input, returns a new array that consists of the images of the range values under the function. |

Merged function |
Given two sorted arrays, returns a single array containing the elements of both in sorted order. Used internally by merge sort. |

Most function |
Creates an array that is equal to an input array except that the last array element is dropped. |

MostAndTail function |
Returns a tuple of all but one and the last element of the array. |

Padded function |
Returns an array padded at with specified values up to a specified length. |

Partitioned function |
Splits an array into multiple parts. |

Prefix function | |

Prefixes function |
Given an array, returns all its prefixes. |

RectangularArrayFact function |
Represents a condition that a 2-dimensional array has a rectangular shape |

Rest function |
Creates an array that is equal to an input array except that the first array element is dropped. |

Reversed function |
Create an array that contains the same elements as an input array but in Reversed order. |

SequenceI function |
Get an array of integers in a given interval. |

SequenceL function |
Get an array of integers in a given interval. |

Sorted function |
Given an array, returns the elements of that array sorted by a given comparison function. |

SquareArrayFact function |
Represents a condition that a 2-dimensional array has a square shape |

Subarray function |
Takes an array and a list of locations and produces a new array formed from the elements of the original array that match the given locations. |

Swapped function |
Applies a swap of two elements in an array. |

Tail function |
Returns the last element of the array. |

Transposed function |
Returns the transpose of a matrix represented as an array of arrays. |

TupleArrayAsNestedArray function |
Turns a list of 2-tuples into a nested array. |

Unique function |
Returns a new array that has no equal adjacent elements. |

Unzipped function |
Given an array of 2-tuples, returns a tuple of two arrays, each containing the elements of the tuples of the input array. |

Where function |
Given a predicate and an array, returns the indices of that array where the predicate is true. |

Windows function |
Returns all consecutive subarrays of length |

Zip function |
Warning Zip has been deprecated. Please use Zipped function instead. Given two arrays, returns a new array of pairs such that each pair contains an element from each original array. |

Zip3 function |
Warning Zip3 has been deprecated. Please use Zipped3 function instead. Given three arrays, returns a new array of 3-tuples such that each 3-tuple contains an element from each original array. |

Zip4 function |
Warning Zip4 has been deprecated. Please use Zipped4 function instead. Given four arrays, returns a new array of 4-tuples such that each 4-tuple contains an element from each original array. |

Zipped function |
Given two arrays, returns a new array of pairs such that each pair contains an element from each original array. |

Zipped3 function |
Given three arrays, returns a new array of 3-tuples such that each 3-tuple contains an element from each original array. |

Zipped4 function |
Given four arrays, returns a new array of 4-tuples such that each 4-tuple contains an element from each original array. |

_SwapOrderToPermuteArray function |
Returns the order elements in an array need to be swapped to produce an ordered array. Assumes swaps occur in place. |