# Microsoft.Quantum.Arrays namespace

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

## Operations

Name | Summary |
---|---|

ApplyToEachWindow | Applies an operation windowing over an input register. |

ApplyToEachWindowA | Applies an operation windowing over an input register. The modifier `A` indicates that the single-qubit operation is adjointable. |

ApplyToEachWindowC | Applies an operation windowing over an input register. The modifier `C` indicates that the single-qubit operation is controllable. |

ApplyToEachWindowCA | Applies an operation windowing over an input register. The modifier `CA` indicates that the single-qubit operation is controllable and adjointable. |

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

ForEach | 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

Name | Summary |
---|---|

All | 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 | 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 | Splits an array into multiple parts of equal length. |

ColumnAt | Extracts a column from a matrix. |

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

Count | 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 | Combines Mapped and Fold into a single function |

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

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

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

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

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

EqualA | 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 | Returns an array containing the elements of another array, excluding elements at a given list of indices. |

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

Filtered | 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 | 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 | Given an array of arrays, returns the concatenation of all arrays. |

Fold | Iterates a function `f` through an array `array` , returning `f(...f(f(initialState, array[0]), array[1]), ...)` . |

Head | Returns the first element of the array. |

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

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

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

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

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

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

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

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

Mapped | 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 | 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 | 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. |

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

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

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

Partitioned | Splits an array into multiple parts. |

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

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

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

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

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

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

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

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

Subarray | 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 | Applies a swap of two elements in an array. |

Tail | Returns the last element of the array. |

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

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

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

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

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

Windows | Returns all consecutive subarrays of length `size` . |

Zip | > [!WARNING] |

Zip3 | > [!WARNING] |

Zip4 | > [!WARNING] |

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

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

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

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

## Feedback

Submit and view feedback for