qsharp-lang 1.1.2-dev → 1.1.4-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/katas-content.generated.js +133 -122
- package/dist/language-service/language-service.d.ts +3 -1
- package/dist/language-service/language-service.js +3 -0
- package/dist/language-service/worker-proxy.js +1 -0
- package/docs/Microsoft.Quantum.Arrays/All.md +44 -0
- package/docs/Microsoft.Quantum.Arrays/Any.md +43 -0
- package/docs/Microsoft.Quantum.Arrays/Chunks.md +34 -0
- package/docs/Microsoft.Quantum.Arrays/CircularlyShifted.md +46 -0
- package/docs/Microsoft.Quantum.Arrays/ColumnAt.md +47 -0
- package/docs/Microsoft.Quantum.Arrays/Count.md +44 -0
- package/docs/Microsoft.Quantum.Arrays/Diagonal.md +43 -0
- package/docs/Microsoft.Quantum.Arrays/DrawMany.md +44 -0
- package/docs/Microsoft.Quantum.Arrays/Enumerated.md +45 -0
- package/docs/Microsoft.Quantum.Arrays/Excluding.md +47 -0
- package/docs/Microsoft.Quantum.Arrays/Filtered.md +44 -0
- package/docs/Microsoft.Quantum.Arrays/FlatMapped.md +46 -0
- package/docs/Microsoft.Quantum.Arrays/Flattened.md +38 -0
- package/docs/Microsoft.Quantum.Arrays/Fold.md +47 -0
- package/docs/Microsoft.Quantum.Arrays/ForEach.md +43 -0
- package/docs/Microsoft.Quantum.Arrays/Head.md +32 -0
- package/docs/Microsoft.Quantum.Arrays/HeadAndRest.md +32 -0
- package/docs/Microsoft.Quantum.Arrays/IndexOf.md +40 -0
- package/docs/Microsoft.Quantum.Arrays/IndexRange.md +41 -0
- package/docs/Microsoft.Quantum.Arrays/Interleaved.md +49 -0
- package/docs/Microsoft.Quantum.Arrays/IsEmpty.md +28 -0
- package/docs/Microsoft.Quantum.Arrays/IsRectangularArray.md +42 -0
- package/docs/Microsoft.Quantum.Arrays/IsSorted.md +43 -0
- package/docs/Microsoft.Quantum.Arrays/IsSquareArray.md +42 -0
- package/docs/Microsoft.Quantum.Arrays/Mapped.md +43 -0
- package/docs/Microsoft.Quantum.Arrays/MappedByIndex.md +54 -0
- package/docs/Microsoft.Quantum.Arrays/MappedOverRange.md +48 -0
- package/docs/Microsoft.Quantum.Arrays/Most.md +34 -0
- package/docs/Microsoft.Quantum.Arrays/MostAndTail.md +32 -0
- package/docs/Microsoft.Quantum.Arrays/Padded.md +50 -0
- package/docs/Microsoft.Quantum.Arrays/Partitioned.md +44 -0
- package/docs/Microsoft.Quantum.Arrays/Rest.md +34 -0
- package/docs/Microsoft.Quantum.Arrays/Reversed.md +34 -0
- package/docs/Microsoft.Quantum.Arrays/SequenceI.md +41 -0
- package/docs/Microsoft.Quantum.Arrays/SequenceL.md +41 -0
- package/docs/Microsoft.Quantum.Arrays/Sorted.md +52 -0
- package/docs/Microsoft.Quantum.Arrays/Subarray.md +51 -0
- package/docs/Microsoft.Quantum.Arrays/Swapped.md +40 -0
- package/docs/Microsoft.Quantum.Arrays/Tail.md +32 -0
- package/docs/Microsoft.Quantum.Arrays/Transposed.md +47 -0
- package/docs/Microsoft.Quantum.Arrays/Unzipped.md +46 -0
- package/docs/Microsoft.Quantum.Arrays/Where.md +36 -0
- package/docs/Microsoft.Quantum.Arrays/Windows.md +47 -0
- package/docs/Microsoft.Quantum.Arrays/Zipped.md +50 -0
- package/docs/Microsoft.Quantum.Canon/ApplyCNOTChain.md +35 -0
- package/docs/Microsoft.Quantum.Canon/ApplyControlledOnBitString.md +42 -0
- package/docs/Microsoft.Quantum.Canon/ApplyControlledOnInt.md +41 -0
- package/docs/Microsoft.Quantum.Canon/ApplyP.md +39 -0
- package/docs/Microsoft.Quantum.Canon/ApplyPauli.md +41 -0
- package/docs/Microsoft.Quantum.Canon/ApplyPauliFromBitString.md +47 -0
- package/docs/Microsoft.Quantum.Canon/ApplyPauliFromInt.md +45 -0
- package/docs/Microsoft.Quantum.Canon/ApplyQFT.md +34 -0
- package/docs/Microsoft.Quantum.Canon/ApplyToEach.md +38 -0
- package/docs/Microsoft.Quantum.Canon/ApplyToEachA.md +43 -0
- package/docs/Microsoft.Quantum.Canon/ApplyToEachC.md +43 -0
- package/docs/Microsoft.Quantum.Canon/ApplyToEachCA.md +43 -0
- package/docs/Microsoft.Quantum.Canon/ApplyXorInPlace.md +31 -0
- package/docs/Microsoft.Quantum.Canon/ApplyXorInPlaceL.md +31 -0
- package/docs/Microsoft.Quantum.Canon/CX.md +50 -0
- package/docs/Microsoft.Quantum.Canon/CY.md +44 -0
- package/docs/Microsoft.Quantum.Canon/CZ.md +44 -0
- package/docs/Microsoft.Quantum.Canon/Fst.md +20 -0
- package/docs/Microsoft.Quantum.Canon/Snd.md +20 -0
- package/docs/Microsoft.Quantum.Canon/SwapReverseRegister.md +25 -0
- package/docs/Microsoft.Quantum.Convert/BigIntAsBoolArray.md +36 -0
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsBigInt.md +35 -0
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsInt.md +25 -0
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsResultArray.md +30 -0
- package/docs/Microsoft.Quantum.Convert/BoolAsResult.md +30 -0
- package/docs/Microsoft.Quantum.Convert/ComplexAsComplexPolar.md +30 -0
- package/docs/Microsoft.Quantum.Convert/ComplexPolarAsComplex.md +30 -0
- package/docs/Microsoft.Quantum.Convert/IntAsBigInt.md +21 -0
- package/docs/Microsoft.Quantum.Convert/IntAsBoolArray.md +36 -0
- package/docs/Microsoft.Quantum.Convert/IntAsDouble.md +21 -0
- package/docs/Microsoft.Quantum.Convert/ResultArrayAsBoolArray.md +30 -0
- package/docs/Microsoft.Quantum.Convert/ResultArrayAsInt.md +34 -0
- package/docs/Microsoft.Quantum.Convert/ResultAsBool.md +30 -0
- package/docs/Microsoft.Quantum.Core/IsRangeEmpty.md +32 -0
- package/docs/Microsoft.Quantum.Core/Length.md +28 -0
- package/docs/Microsoft.Quantum.Core/RangeEnd.md +38 -0
- package/docs/Microsoft.Quantum.Core/RangeReverse.md +32 -0
- package/docs/Microsoft.Quantum.Core/RangeStart.md +36 -0
- package/docs/Microsoft.Quantum.Core/RangeStep.md +33 -0
- package/docs/Microsoft.Quantum.Core/Repeated.md +36 -0
- package/docs/Microsoft.Quantum.Diagnostics/CheckAllZero.md +18 -0
- package/docs/Microsoft.Quantum.Diagnostics/CheckOperationsAreEqual.md +47 -0
- package/docs/Microsoft.Quantum.Diagnostics/CheckZero.md +18 -0
- package/docs/Microsoft.Quantum.Diagnostics/DumpMachine.md +18 -0
- package/docs/Microsoft.Quantum.Diagnostics/Fact.md +20 -0
- package/docs/Microsoft.Quantum.Intrinsic/CCNOT.md +35 -0
- package/docs/Microsoft.Quantum.Intrinsic/CNOT.md +47 -0
- package/docs/Microsoft.Quantum.Intrinsic/Exp.md +40 -0
- package/docs/Microsoft.Quantum.Intrinsic/H.md +34 -0
- package/docs/Microsoft.Quantum.Intrinsic/I.md +25 -0
- package/docs/Microsoft.Quantum.Intrinsic/M.md +46 -0
- package/docs/Microsoft.Quantum.Intrinsic/Measure.md +56 -0
- package/docs/Microsoft.Quantum.Intrinsic/Message.md +30 -0
- package/docs/Microsoft.Quantum.Intrinsic/R.md +42 -0
- package/docs/Microsoft.Quantum.Intrinsic/R1.md +41 -0
- package/docs/Microsoft.Quantum.Intrinsic/R1Frac.md +57 -0
- package/docs/Microsoft.Quantum.Intrinsic/RFrac.md +58 -0
- package/docs/Microsoft.Quantum.Intrinsic/Reset.md +27 -0
- package/docs/Microsoft.Quantum.Intrinsic/ResetAll.md +27 -0
- package/docs/Microsoft.Quantum.Intrinsic/Rx.md +44 -0
- package/docs/Microsoft.Quantum.Intrinsic/Rxx.md +42 -0
- package/docs/Microsoft.Quantum.Intrinsic/Ry.md +44 -0
- package/docs/Microsoft.Quantum.Intrinsic/Ryy.md +42 -0
- package/docs/Microsoft.Quantum.Intrinsic/Rz.md +44 -0
- package/docs/Microsoft.Quantum.Intrinsic/Rzz.md +42 -0
- package/docs/Microsoft.Quantum.Intrinsic/S.md +36 -0
- package/docs/Microsoft.Quantum.Intrinsic/SWAP.md +49 -0
- package/docs/Microsoft.Quantum.Intrinsic/T.md +36 -0
- package/docs/Microsoft.Quantum.Intrinsic/X.md +36 -0
- package/docs/Microsoft.Quantum.Intrinsic/Y.md +36 -0
- package/docs/Microsoft.Quantum.Intrinsic/Z.md +36 -0
- package/docs/Microsoft.Quantum.Logical/Xor.md +38 -0
- package/docs/Microsoft.Quantum.Math/AbsComplex.md +30 -0
- package/docs/Microsoft.Quantum.Math/AbsComplexPolar.md +30 -0
- package/docs/Microsoft.Quantum.Math/AbsD.md +21 -0
- package/docs/Microsoft.Quantum.Math/AbsI.md +21 -0
- package/docs/Microsoft.Quantum.Math/AbsL.md +20 -0
- package/docs/Microsoft.Quantum.Math/AbsSquaredComplex.md +30 -0
- package/docs/Microsoft.Quantum.Math/AbsSquaredComplexPolar.md +30 -0
- package/docs/Microsoft.Quantum.Math/ApproximateFactorial.md +40 -0
- package/docs/Microsoft.Quantum.Math/ArcCos.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArcCosh.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArcSin.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArcSinh.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArcTan.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArcTan2.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArcTanh.md +21 -0
- package/docs/Microsoft.Quantum.Math/ArgComplex.md +30 -0
- package/docs/Microsoft.Quantum.Math/ArgComplexPolar.md +28 -0
- package/docs/Microsoft.Quantum.Math/Binom.md +34 -0
- package/docs/Microsoft.Quantum.Math/BitSizeI.md +23 -0
- package/docs/Microsoft.Quantum.Math/BitSizeL.md +23 -0
- package/docs/Microsoft.Quantum.Math/Ceiling.md +23 -0
- package/docs/Microsoft.Quantum.Math/Complex.md +31 -0
- package/docs/Microsoft.Quantum.Math/ComplexPolar.md +29 -0
- package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentI.md +25 -0
- package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentL.md +25 -0
- package/docs/Microsoft.Quantum.Math/Cos.md +21 -0
- package/docs/Microsoft.Quantum.Math/Cosh.md +21 -0
- package/docs/Microsoft.Quantum.Math/DivRemI.md +21 -0
- package/docs/Microsoft.Quantum.Math/DivRemL.md +21 -0
- package/docs/Microsoft.Quantum.Math/DividedByC.md +30 -0
- package/docs/Microsoft.Quantum.Math/DividedByCP.md +30 -0
- package/docs/Microsoft.Quantum.Math/E.md +28 -0
- package/docs/Microsoft.Quantum.Math/ExpModI.md +23 -0
- package/docs/Microsoft.Quantum.Math/ExpModL.md +23 -0
- package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorI.md +23 -0
- package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorL.md +23 -0
- package/docs/Microsoft.Quantum.Math/FactorialI.md +38 -0
- package/docs/Microsoft.Quantum.Math/FactorialL.md +32 -0
- package/docs/Microsoft.Quantum.Math/Floor.md +23 -0
- package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorI.md +23 -0
- package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorL.md +23 -0
- package/docs/Microsoft.Quantum.Math/HammingWeightI.md +21 -0
- package/docs/Microsoft.Quantum.Math/InverseModI.md +25 -0
- package/docs/Microsoft.Quantum.Math/InverseModL.md +25 -0
- package/docs/Microsoft.Quantum.Math/IsCoprimeI.md +34 -0
- package/docs/Microsoft.Quantum.Math/IsCoprimeL.md +34 -0
- package/docs/Microsoft.Quantum.Math/IsInfinite.md +49 -0
- package/docs/Microsoft.Quantum.Math/IsNaN.md +30 -0
- package/docs/Microsoft.Quantum.Math/LargestFixedPoint.md +31 -0
- package/docs/Microsoft.Quantum.Math/Lg.md +21 -0
- package/docs/Microsoft.Quantum.Math/Log.md +21 -0
- package/docs/Microsoft.Quantum.Math/Log10.md +21 -0
- package/docs/Microsoft.Quantum.Math/LogFactorialD.md +35 -0
- package/docs/Microsoft.Quantum.Math/LogGammaD.md +39 -0
- package/docs/Microsoft.Quantum.Math/LogOf2.md +24 -0
- package/docs/Microsoft.Quantum.Math/Max.md +28 -0
- package/docs/Microsoft.Quantum.Math/MaxD.md +21 -0
- package/docs/Microsoft.Quantum.Math/MaxI.md +21 -0
- package/docs/Microsoft.Quantum.Math/MaxL.md +21 -0
- package/docs/Microsoft.Quantum.Math/Min.md +28 -0
- package/docs/Microsoft.Quantum.Math/MinD.md +21 -0
- package/docs/Microsoft.Quantum.Math/MinI.md +21 -0
- package/docs/Microsoft.Quantum.Math/MinL.md +21 -0
- package/docs/Microsoft.Quantum.Math/MinusC.md +30 -0
- package/docs/Microsoft.Quantum.Math/MinusCP.md +30 -0
- package/docs/Microsoft.Quantum.Math/ModulusI.md +23 -0
- package/docs/Microsoft.Quantum.Math/ModulusL.md +23 -0
- package/docs/Microsoft.Quantum.Math/NegationC.md +28 -0
- package/docs/Microsoft.Quantum.Math/NegationCP.md +28 -0
- package/docs/Microsoft.Quantum.Math/PI.md +28 -0
- package/docs/Microsoft.Quantum.Math/PNorm.md +34 -0
- package/docs/Microsoft.Quantum.Math/PNormalized.md +39 -0
- package/docs/Microsoft.Quantum.Math/PlusC.md +30 -0
- package/docs/Microsoft.Quantum.Math/PlusCP.md +30 -0
- package/docs/Microsoft.Quantum.Math/PowC.md +32 -0
- package/docs/Microsoft.Quantum.Math/PowCP.md +32 -0
- package/docs/Microsoft.Quantum.Math/RealMod.md +38 -0
- package/docs/Microsoft.Quantum.Math/Round.md +23 -0
- package/docs/Microsoft.Quantum.Math/SignD.md +21 -0
- package/docs/Microsoft.Quantum.Math/SignI.md +21 -0
- package/docs/Microsoft.Quantum.Math/SignL.md +21 -0
- package/docs/Microsoft.Quantum.Math/Sin.md +21 -0
- package/docs/Microsoft.Quantum.Math/Sinh.md +21 -0
- package/docs/Microsoft.Quantum.Math/SmallestFixedPoint.md +30 -0
- package/docs/Microsoft.Quantum.Math/Sqrt.md +21 -0
- package/docs/Microsoft.Quantum.Math/SquaredNorm.md +32 -0
- package/docs/Microsoft.Quantum.Math/Tan.md +21 -0
- package/docs/Microsoft.Quantum.Math/Tanh.md +21 -0
- package/docs/Microsoft.Quantum.Math/TimesC.md +30 -0
- package/docs/Microsoft.Quantum.Math/TimesCP.md +30 -0
- package/docs/Microsoft.Quantum.Math/TrailingZeroCountI.md +23 -0
- package/docs/Microsoft.Quantum.Math/TrailingZeroCountL.md +23 -0
- package/docs/Microsoft.Quantum.Math/Truncate.md +23 -0
- package/docs/Microsoft.Quantum.Measurement/MResetEachZ.md +28 -0
- package/docs/Microsoft.Quantum.Measurement/MResetX.md +37 -0
- package/docs/Microsoft.Quantum.Measurement/MResetY.md +37 -0
- package/docs/Microsoft.Quantum.Measurement/MResetZ.md +37 -0
- package/docs/Microsoft.Quantum.Measurement/MeasureAllZ.md +36 -0
- package/docs/Microsoft.Quantum.Measurement/MeasureEachZ.md +30 -0
- package/docs/Microsoft.Quantum.Measurement/MeasureInteger.md +36 -0
- package/docs/Microsoft.Quantum.Random/DrawRandomDouble.md +40 -0
- package/docs/Microsoft.Quantum.Random/DrawRandomInt.md +40 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/AccountForEstimates.md +35 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/AuxQubitCount.md +23 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/BeginEstimateCaching.md +39 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/BeginRepeatEstimates.md +36 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/CczCount.md +23 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/EndEstimateCaching.md +25 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/EndRepeatEstimates.md +22 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/MeasurementCount.md +23 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/PSSPCLayout.md +25 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/RepeatEstimates.md +32 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/RotationCount.md +23 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/RotationDepth.md +23 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/SingleVariant.md +23 -0
- package/docs/Microsoft.Quantum.ResourceEstimation/TCount.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/AddLE.md +29 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualL.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualLE.md +25 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterL.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterLE.md +25 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualL.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualLE.md +25 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessL.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessLE.md +25 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualL.md +23 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualLE.md +25 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/FourierTDIncByLE.md +32 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByI.md +27 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByIUsingIncByLE.md +27 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByL.md +27 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLE.md +27 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLEUsingAddLE.md +36 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLUsingIncByLE.md +27 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/LookAheadDKRSAddLE.md +36 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/MAJ.md +34 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ReflectAboutInteger.md +37 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGAddLE.md +34 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGIncByLE.md +34 -0
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryTTKIncByLE.md +35 -0
- package/docs/Microsoft.Quantum.Unstable.StatePreparation/ApproximatelyPreparePureStateCP.md +68 -0
- package/docs/Microsoft.Quantum.Unstable.StatePreparation/PreparePureStateD.md +65 -0
- package/docs/Microsoft.Quantum.Unstable.TableLookup/Select.md +53 -0
- package/docs/toc.yml +305 -0
- package/lib/node/qsc_wasm.cjs +40 -13
- package/lib/node/qsc_wasm.d.cts +15 -0
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm.d.ts +17 -0
- package/lib/web/qsc_wasm.js +38 -11
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +4 -2
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Partitioned
|
|
3
|
+
title: Partitioned function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Partitioned
|
|
9
|
+
qsharp.summary: Splits an array into multiple parts.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Partitioned function
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
function Partitioned<'T>(partitionSizes : Int[], array : 'T[]) : 'T[][]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Splits an array into multiple parts.
|
|
22
|
+
|
|
23
|
+
## Input
|
|
24
|
+
### partitionSizes
|
|
25
|
+
Number of elements in each split part of array.
|
|
26
|
+
### array
|
|
27
|
+
Input array to be split.
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
Multiple arrays where the first array is the first `partitionSizes[0]` of `array`
|
|
31
|
+
and the second array are the next `partitionSizes[1]` of `array` etc. The last array
|
|
32
|
+
will contain all remaining elements. If the array is split exactly, the
|
|
33
|
+
last array will be the empty array, indicating there are no remaining elements.
|
|
34
|
+
In other words, `Tail(Partitioned(...))` will always return the remaining
|
|
35
|
+
elements, while `Most(Partitioned(...))` will always return the complete
|
|
36
|
+
partitions of the array.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
```qsharp
|
|
40
|
+
// The following returns [[2, 3], [5], [7]];
|
|
41
|
+
let split = Partitioned([2, 1], [2, 3, 5, 7]);
|
|
42
|
+
// The following returns [[2, 3], [5, 7], []];
|
|
43
|
+
let split = Partitioned([2, 2], [2, 3, 5, 7]);
|
|
44
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Rest
|
|
3
|
+
title: Rest function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Rest
|
|
9
|
+
qsharp.summary: Creates an array that is equal to an input array except that the first array
|
|
10
|
+
element is dropped.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Rest function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Rest<'T>(array : 'T[]) : 'T[]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Creates an array that is equal to an input array except that the first array
|
|
23
|
+
element is dropped.
|
|
24
|
+
|
|
25
|
+
## Type Parameters
|
|
26
|
+
### 'T
|
|
27
|
+
The type of the array elements.
|
|
28
|
+
|
|
29
|
+
## Input
|
|
30
|
+
### array
|
|
31
|
+
An array whose second to last elements are to form the output array.
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
An array containing the elements `array[1..Length(array) - 1]`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Reversed
|
|
3
|
+
title: Reversed function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Reversed
|
|
9
|
+
qsharp.summary: Create an array that contains the same elements as an input array but in reversed
|
|
10
|
+
order.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Reversed function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Reversed<'T>(array : 'T[]) : 'T[]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Create an array that contains the same elements as an input array but in reversed
|
|
23
|
+
order.
|
|
24
|
+
|
|
25
|
+
## Type Parameters
|
|
26
|
+
### 'T
|
|
27
|
+
The type of the array elements.
|
|
28
|
+
|
|
29
|
+
## Input
|
|
30
|
+
### array
|
|
31
|
+
An array whose elements are to be copied in reversed order.
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
An array containing the elements `array[Length(array) - 1]` .. `array[0]`.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.SequenceI
|
|
3
|
+
title: SequenceI function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: SequenceI
|
|
9
|
+
qsharp.summary: Get an array of integers in a given interval.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# SequenceI function
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
function SequenceI(from : Int, to : Int) : Int[]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Get an array of integers in a given interval.
|
|
22
|
+
|
|
23
|
+
## Input
|
|
24
|
+
### from
|
|
25
|
+
An inclusive start index of the interval.
|
|
26
|
+
### to
|
|
27
|
+
An inclusive end index of the interval that is not smaller than `from`.
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
An array containing the sequence of numbers `from`, `from + 1`, ...,
|
|
31
|
+
`to`.
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
```qsharp
|
|
35
|
+
let arr1 = SequenceI(0, 3); // [0, 1, 2, 3]
|
|
36
|
+
let arr2 = SequenceI(23, 29); // [23, 24, 25, 26, 27, 28, 29]
|
|
37
|
+
let arr3 = SequenceI(-5, -2); // [-5, -4, -3, -2]
|
|
38
|
+
|
|
39
|
+
let numbers = SequenceI(0, _); // function to create sequence from 0 to `to`
|
|
40
|
+
let naturals = SequenceI(1, _); // function to create sequence from 1 to `to`
|
|
41
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.SequenceL
|
|
3
|
+
title: SequenceL function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: SequenceL
|
|
9
|
+
qsharp.summary: Get an array of integers in a given interval.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# SequenceL function
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
function SequenceL(from : BigInt, to : BigInt) : BigInt[]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Get an array of integers in a given interval.
|
|
22
|
+
|
|
23
|
+
## Input
|
|
24
|
+
### from
|
|
25
|
+
An inclusive start index of the interval.
|
|
26
|
+
### to
|
|
27
|
+
An inclusive end index of the interval that is not smaller than `from`.
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
An array containing the sequence of numbers `from`, `from + 1`, ...,
|
|
31
|
+
`to`.
|
|
32
|
+
|
|
33
|
+
## Remarks
|
|
34
|
+
The difference between `from` and `to` must fit into an `Int` value.
|
|
35
|
+
|
|
36
|
+
## Example
|
|
37
|
+
```qsharp
|
|
38
|
+
let arr1 = SequenceL(0L, 3L); // [0L, 1L, 2L, 3L]
|
|
39
|
+
let arr2 = SequenceL(23L, 29L); // [23L, 24L, 25L, 26L, 27L, 28L, 29L]
|
|
40
|
+
let arr3 = SequenceL(-5L, -2L); // [-5L, -4L, -3L, -2L]
|
|
41
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Sorted
|
|
3
|
+
title: Sorted function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Sorted
|
|
9
|
+
qsharp.summary: Given an array, returns the elements of that array sorted by a given
|
|
10
|
+
comparison function.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Sorted function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Sorted<'T>(comparison : (('T, 'T) -> Bool), array : 'T[]) : 'T[]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Given an array, returns the elements of that array sorted by a given
|
|
23
|
+
comparison function.
|
|
24
|
+
|
|
25
|
+
## Type Parameters
|
|
26
|
+
### 'T
|
|
27
|
+
The type of each element of `array`.
|
|
28
|
+
|
|
29
|
+
## Input
|
|
30
|
+
### comparison
|
|
31
|
+
A function that compares two elements such that `a` is considered to
|
|
32
|
+
be less than or equal to `b` if `comparison(a, b)` is `true`.
|
|
33
|
+
### array
|
|
34
|
+
The array to be sorted.
|
|
35
|
+
|
|
36
|
+
## Output
|
|
37
|
+
An array containing the same elements as `array`, such that for all
|
|
38
|
+
elements `a` occurring earlier than elements `b`, `comparison(a, b)`
|
|
39
|
+
is `true`.
|
|
40
|
+
|
|
41
|
+
## Example
|
|
42
|
+
The following snippet sorts an array of integers to occur in ascending
|
|
43
|
+
order:
|
|
44
|
+
```qsharp
|
|
45
|
+
let sortedArray = Sorted(LessThanOrEqualI, [3, 17, 11, -201, -11]);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Remarks
|
|
49
|
+
The function `comparison` is assumed to be transitive, such that
|
|
50
|
+
if `comparison(a, b)` and `comparison(b, c)`, then `comparison(a, c)`
|
|
51
|
+
is assumed. If this property does not hold, then the output of this
|
|
52
|
+
function may be incorrect.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Subarray
|
|
3
|
+
title: Subarray function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Subarray
|
|
9
|
+
qsharp.summary: Takes an array and a list of locations and
|
|
10
|
+
produces a new array formed from the elements of the original
|
|
11
|
+
array that match the given locations.
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Subarray function
|
|
15
|
+
|
|
16
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
17
|
+
|
|
18
|
+
```qsharp
|
|
19
|
+
function Subarray<'T>(locations : Int[], array : 'T[]) : 'T[]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Summary
|
|
23
|
+
Takes an array and a list of locations and
|
|
24
|
+
produces a new array formed from the elements of the original
|
|
25
|
+
array that match the given locations.
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
If `locations` contains repeated elements, the corresponding elements
|
|
29
|
+
of `array` will likewise be repeated.
|
|
30
|
+
|
|
31
|
+
## Type Parameters
|
|
32
|
+
### 'T
|
|
33
|
+
The type of `array` elements.
|
|
34
|
+
|
|
35
|
+
## Input
|
|
36
|
+
### locations
|
|
37
|
+
A list of locations in the input array that is used to define the subarray.
|
|
38
|
+
### array
|
|
39
|
+
An array from which a subarray will be generated.
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
An array `out` of elements whose locations correspond to the subarray,
|
|
43
|
+
such that `out[index] == array[locations[index]]`.
|
|
44
|
+
|
|
45
|
+
## Example
|
|
46
|
+
|
|
47
|
+
```qsharp
|
|
48
|
+
let array = [1, 2, 3, 4];
|
|
49
|
+
let permutation = Subarray([3, 0, 2, 1], array); // [4, 1, 3, 2]
|
|
50
|
+
let duplicates = Subarray([1, 2, 2], array); // [2, 3, 3]
|
|
51
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Swapped
|
|
3
|
+
title: Swapped function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Swapped
|
|
9
|
+
qsharp.summary: Applies a swap of two elements in an array.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Swapped function
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
function Swapped<'T>(firstIndex : Int, secondIndex : Int, array : 'T[]) : 'T[]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Applies a swap of two elements in an array.
|
|
22
|
+
|
|
23
|
+
## Input
|
|
24
|
+
### firstIndex
|
|
25
|
+
Index of the first element to be swapped.
|
|
26
|
+
|
|
27
|
+
### secondIndex
|
|
28
|
+
Index of the second element to be swapped.
|
|
29
|
+
|
|
30
|
+
### array
|
|
31
|
+
Array with elements to be swapped.
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
The array with the in place swap applied.
|
|
35
|
+
|
|
36
|
+
## Example
|
|
37
|
+
```qsharp
|
|
38
|
+
// The following returns [0, 3, 2, 1, 4]
|
|
39
|
+
Swapped(1, 3, [0, 1, 2, 3, 4]);
|
|
40
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Tail
|
|
3
|
+
title: Tail function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Tail
|
|
9
|
+
qsharp.summary: Returns the last element of the array.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Tail function
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
function Tail<'A>(array : 'A[]) : 'A
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Returns the last element of the array.
|
|
22
|
+
|
|
23
|
+
## Type Parameters
|
|
24
|
+
### 'A
|
|
25
|
+
The type of the array elements.
|
|
26
|
+
|
|
27
|
+
## Input
|
|
28
|
+
### array
|
|
29
|
+
Array of which the last element is taken. Array must have at least 1 element.
|
|
30
|
+
|
|
31
|
+
## Output
|
|
32
|
+
The last element of the array.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Transposed
|
|
3
|
+
title: Transposed function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Transposed
|
|
9
|
+
qsharp.summary: Returns the transpose of a matrix represented as an array
|
|
10
|
+
of arrays.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Transposed function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Transposed<'T>(matrix : 'T[][]) : 'T[][]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Returns the transpose of a matrix represented as an array
|
|
23
|
+
of arrays.
|
|
24
|
+
|
|
25
|
+
## Description
|
|
26
|
+
Input as an r x c matrix with r rows and c columns. The matrix
|
|
27
|
+
is row-based, i.e., `matrix[i][j]` accesses the element at row `i` and column `j`.
|
|
28
|
+
|
|
29
|
+
This function returns the c x r matrix that is the transpose of the
|
|
30
|
+
input matrix.
|
|
31
|
+
|
|
32
|
+
## Type Parameters
|
|
33
|
+
### 'T
|
|
34
|
+
The type of each element of `matrix`.
|
|
35
|
+
|
|
36
|
+
## Input
|
|
37
|
+
### matrix
|
|
38
|
+
Row-based r x c matrix.
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
Transposed c x r matrix.
|
|
42
|
+
|
|
43
|
+
## Example
|
|
44
|
+
```qsharp
|
|
45
|
+
// same as [[1, 4], [2, 5], [3, 6]]
|
|
46
|
+
let transposed = Transposed([[1, 2, 3], [4, 5, 6]]);
|
|
47
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Unzipped
|
|
3
|
+
title: Unzipped function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Unzipped
|
|
9
|
+
qsharp.summary: Given an array of 2-tuples, returns a tuple of two arrays, each containing
|
|
10
|
+
the elements of the tuples of the input array.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Unzipped function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Unzipped<'T, 'U>(array : ('T, 'U)[]) : ('T[], 'U[])
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Given an array of 2-tuples, returns a tuple of two arrays, each containing
|
|
23
|
+
the elements of the tuples of the input array.
|
|
24
|
+
|
|
25
|
+
## Type Parameters
|
|
26
|
+
### 'T
|
|
27
|
+
The type of the first element in each tuple.
|
|
28
|
+
### 'U
|
|
29
|
+
The type of the second element in each tuple.
|
|
30
|
+
|
|
31
|
+
## Input
|
|
32
|
+
### array
|
|
33
|
+
An array containing 2-tuples.
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
Two arrays, the first one containing all first elements of the input
|
|
37
|
+
tuples, the second one containing all second elements of the input tuples.
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
```qsharp
|
|
41
|
+
// split is same as ([5, 4, 3, 2, 1], [true, false, true, true, false])
|
|
42
|
+
let split = Unzipped([(5, true), (4, false), (3, true), (2, true), (1, false)]);
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## See Also
|
|
46
|
+
- Microsoft.Quantum.Arrays.Zipped
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Where
|
|
3
|
+
title: Where function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Where
|
|
9
|
+
qsharp.summary: Given a predicate and an array, returns the indices of that
|
|
10
|
+
array where the predicate is true.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Where function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Where<'T>(predicate : ('T -> Bool), array : 'T[]) : Int[]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Given a predicate and an array, returns the indices of that
|
|
23
|
+
array where the predicate is true.
|
|
24
|
+
|
|
25
|
+
## Type Parameters
|
|
26
|
+
### 'T
|
|
27
|
+
The type of `array` elements.
|
|
28
|
+
|
|
29
|
+
## Input
|
|
30
|
+
### predicate
|
|
31
|
+
A function from `'T` to Boolean that is used to filter elements.
|
|
32
|
+
### array
|
|
33
|
+
An array of elements over `'T`.
|
|
34
|
+
|
|
35
|
+
## Output
|
|
36
|
+
An array of indices where `predicate` is true.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Windows
|
|
3
|
+
title: Windows function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Windows
|
|
9
|
+
qsharp.summary: Returns all consecutive subarrays of length `size`.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Windows function
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
function Windows<'T>(size : Int, array : 'T[]) : 'T[][]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Returns all consecutive subarrays of length `size`.
|
|
22
|
+
|
|
23
|
+
## Description
|
|
24
|
+
This function returns all `n - size + 1` subarrays of
|
|
25
|
+
length `size` in order, where `n` is the length of `array`.
|
|
26
|
+
The first subarrays are `array[0..size - 1], array[1..size], array[2..size + 1]`
|
|
27
|
+
until the last subarray `array[n - size..n - 1]`.
|
|
28
|
+
|
|
29
|
+
## Type Parameters
|
|
30
|
+
### 'T
|
|
31
|
+
The type of `array` elements.
|
|
32
|
+
|
|
33
|
+
## Input
|
|
34
|
+
### size
|
|
35
|
+
Length of the subarrays.
|
|
36
|
+
|
|
37
|
+
### array
|
|
38
|
+
An array of elements.
|
|
39
|
+
|
|
40
|
+
## Example
|
|
41
|
+
```qsharp
|
|
42
|
+
// same as [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
|
|
43
|
+
let windows = Windows(3, [1, 2, 3, 4, 5]);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Remarks
|
|
47
|
+
The size of the window must be a positive integer no greater than the size of the array
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Arrays.Zipped
|
|
3
|
+
title: Zipped function
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: function
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Arrays
|
|
8
|
+
qsharp.name: Zipped
|
|
9
|
+
qsharp.summary: Given two arrays, returns a new array of pairs such that each pair
|
|
10
|
+
contains an element from each original array.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Zipped function
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Arrays](xref:Microsoft.Quantum.Arrays)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
function Zipped<'T, 'U>(left : 'T[], right : 'U[]) : ('T, 'U)[]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Given two arrays, returns a new array of pairs such that each pair
|
|
23
|
+
contains an element from each original array.
|
|
24
|
+
|
|
25
|
+
## Type Parameters
|
|
26
|
+
### 'T
|
|
27
|
+
The type of the left array elements.
|
|
28
|
+
### 'U
|
|
29
|
+
The type of the right array elements.
|
|
30
|
+
|
|
31
|
+
## Input
|
|
32
|
+
### left
|
|
33
|
+
An array containing values for the first element of each tuple.
|
|
34
|
+
### right
|
|
35
|
+
An array containing values for the second element of each tuple.
|
|
36
|
+
|
|
37
|
+
## Output
|
|
38
|
+
An array containing pairs of the form `(left[index], right[index])` for
|
|
39
|
+
each `index`. If the two arrays are not of equal length, the output will
|
|
40
|
+
be as long as the shorter of the inputs.
|
|
41
|
+
|
|
42
|
+
## Example
|
|
43
|
+
```qsharp
|
|
44
|
+
let left = [1, 3, 71];
|
|
45
|
+
let right = [false, true];
|
|
46
|
+
let pairs = Zipped(left, right); // [(1, false), (3, true)]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## See Also
|
|
50
|
+
- Microsoft.Quantum.Arrays.Unzipped
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Canon.ApplyCNOTChain
|
|
3
|
+
title: ApplyCNOTChain operation
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: opeartion
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Canon
|
|
8
|
+
qsharp.name: ApplyCNOTChain
|
|
9
|
+
qsharp.summary: Computes the parity of a register of qubits in-place.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# ApplyCNOTChain operation
|
|
13
|
+
|
|
14
|
+
Namespace: [Microsoft.Quantum.Canon](xref:Microsoft.Quantum.Canon)
|
|
15
|
+
|
|
16
|
+
```qsharp
|
|
17
|
+
operation ApplyCNOTChain(qubits : Qubit[]) : Unit is Adj + Ctl
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Summary
|
|
21
|
+
Computes the parity of a register of qubits in-place.
|
|
22
|
+
|
|
23
|
+
## Input
|
|
24
|
+
### qubits
|
|
25
|
+
Array of qubits whose parity is to be computed and stored.
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
This operation transforms the state of its input as
|
|
29
|
+
$$
|
|
30
|
+
\begin{align}
|
|
31
|
+
\ket{q_0} \ket{q_1} \cdots \ket{q_{n - 1}} & \mapsto
|
|
32
|
+
\ket{q_0} \ket{q_0 \oplus q_1} \ket{q_0 \oplus q_1 \oplus q_2} \cdots
|
|
33
|
+
\ket{q_0 \oplus \cdots \oplus q_{n - 1}}.
|
|
34
|
+
\end{align}
|
|
35
|
+
$$
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
uid: Microsoft.Quantum.Canon.ApplyControlledOnBitString
|
|
3
|
+
title: ApplyControlledOnBitString operation
|
|
4
|
+
ms.date: 02/16/2024 12:00:00 AM
|
|
5
|
+
ms.topic: managed-reference
|
|
6
|
+
qsharp.kind: opeartion
|
|
7
|
+
qsharp.namespace: Microsoft.Quantum.Canon
|
|
8
|
+
qsharp.name: ApplyControlledOnBitString
|
|
9
|
+
qsharp.summary: Applies a unitary operation on the target,
|
|
10
|
+
controlled on a state specified by a given bit mask.
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# ApplyControlledOnBitString operation
|
|
14
|
+
|
|
15
|
+
Namespace: [Microsoft.Quantum.Canon](xref:Microsoft.Quantum.Canon)
|
|
16
|
+
|
|
17
|
+
```qsharp
|
|
18
|
+
operation ApplyControlledOnBitString<'T>(bits : Bool[], oracle : ('T => Unit is Adj + Ctl), controlRegister : Qubit[], target : 'T) : Unit is Adj + Ctl
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summary
|
|
22
|
+
Applies a unitary operation on the target,
|
|
23
|
+
controlled on a state specified by a given bit mask.
|
|
24
|
+
|
|
25
|
+
## Input
|
|
26
|
+
### bits
|
|
27
|
+
The bit string to control the given unitary operation on.
|
|
28
|
+
### oracle
|
|
29
|
+
The unitary operation to be applied on the target.
|
|
30
|
+
### target
|
|
31
|
+
The target to be passed to `oracle` as an input.
|
|
32
|
+
### controlRegister
|
|
33
|
+
A quantum register that controls application of `oracle`.
|
|
34
|
+
|
|
35
|
+
## Remarks
|
|
36
|
+
The pattern given by `bits` may be shorter than `controlRegister`,
|
|
37
|
+
in which case additional control qubits are ignored (that is, neither
|
|
38
|
+
controlled on $\ket{0}$ nor $\ket{1}$).
|
|
39
|
+
If `bits` is longer than `controlRegister`, an error is raised.
|
|
40
|
+
|
|
41
|
+
For example, `bits = [0,1,0,0,1]` means that `oracle` is applied if and only if `controlRegister`
|
|
42
|
+
is in the state $\ket{0}\ket{1}\ket{0}\ket{0}\ket{1}$.
|