qsharp-lang 1.3.1 → 1.3.3-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/browser.d.ts +4 -6
- package/dist/browser.js +1 -1
- package/dist/compiler/compiler.d.ts +4 -1
- package/dist/compiler/compiler.js +4 -0
- package/dist/debug-service/debug-service.d.ts +7 -4
- package/dist/debug-service/debug-service.js +20 -16
- package/dist/katas-content.generated.js +555 -3
- package/dist/samples.generated.js +15 -15
- package/docs/Microsoft.Quantum.Arrays/All.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Any.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Chunks.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/CircularlyShifted.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/ColumnAt.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Count.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Diagonal.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/DrawMany.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Enumerated.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Excluding.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Filtered.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/FlatMapped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Flattened.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Fold.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/ForEach.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Head.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/HeadAndRest.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IndexOf.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IndexRange.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Interleaved.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsEmpty.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsRectangularArray.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsSorted.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/IsSquareArray.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Mapped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/MappedByIndex.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/MappedOverRange.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Most.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/MostAndTail.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Padded.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Partitioned.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Rest.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Reversed.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/SequenceI.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/SequenceL.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Sorted.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Subarray.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Swapped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Tail.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Transposed.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Unzipped.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Where.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Windows.md +1 -1
- package/docs/Microsoft.Quantum.Arrays/Zipped.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyCNOTChain.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyControlledOnBitString.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyControlledOnInt.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyP.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyPauli.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyPauliFromBitString.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyPauliFromInt.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyQFT.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEach.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEachA.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEachC.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyToEachCA.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyXorInPlace.md +1 -1
- package/docs/Microsoft.Quantum.Canon/ApplyXorInPlaceL.md +1 -1
- package/docs/Microsoft.Quantum.Canon/CX.md +1 -1
- package/docs/Microsoft.Quantum.Canon/CY.md +1 -1
- package/docs/Microsoft.Quantum.Canon/CZ.md +1 -1
- package/docs/Microsoft.Quantum.Canon/Fst.md +1 -1
- package/docs/Microsoft.Quantum.Canon/Snd.md +1 -1
- package/docs/Microsoft.Quantum.Canon/SwapReverseRegister.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BigIntAsBoolArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsBigInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolArrayAsResultArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/BoolAsResult.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ComplexAsComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ComplexPolarAsComplex.md +1 -1
- package/docs/Microsoft.Quantum.Convert/IntAsBigInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/IntAsBoolArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/IntAsDouble.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ResultArrayAsBoolArray.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ResultArrayAsInt.md +1 -1
- package/docs/Microsoft.Quantum.Convert/ResultAsBool.md +1 -1
- package/docs/Microsoft.Quantum.Core/IsRangeEmpty.md +1 -1
- package/docs/Microsoft.Quantum.Core/Length.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeEnd.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeReverse.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeStart.md +1 -1
- package/docs/Microsoft.Quantum.Core/RangeStep.md +1 -1
- package/docs/Microsoft.Quantum.Core/Repeated.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/CheckAllZero.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/CheckOperationsAreEqual.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/CheckZero.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/DumpMachine.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/DumpRegister.md +1 -1
- package/docs/Microsoft.Quantum.Diagnostics/Fact.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CCNOT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/CNOT.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Exp.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/H.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/I.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/M.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Measure.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Message.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/R.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/R1.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/R1Frac.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/RFrac.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Reset.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/ResetAll.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rx.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rxx.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Ry.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Ryy.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rz.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Rzz.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/S.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/SWAP.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/T.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/X.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Y.md +1 -1
- package/docs/Microsoft.Quantum.Intrinsic/Z.md +1 -1
- package/docs/Microsoft.Quantum.Logical/Xor.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsComplex.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsD.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsI.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsL.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsSquaredComplex.md +1 -1
- package/docs/Microsoft.Quantum.Math/AbsSquaredComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/ApproximateFactorial.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcCos.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcCosh.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcSin.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcSinh.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcTan.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcTan2.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArcTanh.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArgComplex.md +1 -1
- package/docs/Microsoft.Quantum.Math/ArgComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/Binom.md +1 -1
- package/docs/Microsoft.Quantum.Math/BitSizeI.md +1 -1
- package/docs/Microsoft.Quantum.Math/BitSizeL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Ceiling.md +1 -1
- package/docs/Microsoft.Quantum.Math/Complex.md +1 -1
- package/docs/Microsoft.Quantum.Math/ComplexPolar.md +1 -1
- package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Cos.md +1 -1
- package/docs/Microsoft.Quantum.Math/Cosh.md +1 -1
- package/docs/Microsoft.Quantum.Math/DivRemI.md +1 -1
- package/docs/Microsoft.Quantum.Math/DivRemL.md +1 -1
- package/docs/Microsoft.Quantum.Math/DividedByC.md +1 -1
- package/docs/Microsoft.Quantum.Math/DividedByCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/E.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExpModI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExpModL.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorL.md +1 -1
- package/docs/Microsoft.Quantum.Math/FactorialI.md +1 -1
- package/docs/Microsoft.Quantum.Math/FactorialL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Floor.md +1 -1
- package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorI.md +1 -1
- package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorL.md +1 -1
- package/docs/Microsoft.Quantum.Math/HammingWeightI.md +1 -1
- package/docs/Microsoft.Quantum.Math/InverseModI.md +1 -1
- package/docs/Microsoft.Quantum.Math/InverseModL.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsCoprimeI.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsCoprimeL.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsInfinite.md +1 -1
- package/docs/Microsoft.Quantum.Math/IsNaN.md +1 -1
- package/docs/Microsoft.Quantum.Math/LargestFixedPoint.md +1 -1
- package/docs/Microsoft.Quantum.Math/Lg.md +1 -1
- package/docs/Microsoft.Quantum.Math/Log.md +1 -1
- package/docs/Microsoft.Quantum.Math/Log10.md +1 -1
- package/docs/Microsoft.Quantum.Math/LogFactorialD.md +1 -1
- package/docs/Microsoft.Quantum.Math/LogGammaD.md +1 -1
- package/docs/Microsoft.Quantum.Math/LogOf2.md +1 -1
- package/docs/Microsoft.Quantum.Math/Max.md +1 -1
- package/docs/Microsoft.Quantum.Math/MaxD.md +1 -1
- package/docs/Microsoft.Quantum.Math/MaxI.md +1 -1
- package/docs/Microsoft.Quantum.Math/MaxL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Min.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinD.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinI.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinL.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinusC.md +1 -1
- package/docs/Microsoft.Quantum.Math/MinusCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/ModulusI.md +1 -1
- package/docs/Microsoft.Quantum.Math/ModulusL.md +1 -1
- package/docs/Microsoft.Quantum.Math/NegationC.md +1 -1
- package/docs/Microsoft.Quantum.Math/NegationCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/PI.md +1 -1
- package/docs/Microsoft.Quantum.Math/PNorm.md +1 -1
- package/docs/Microsoft.Quantum.Math/PNormalized.md +1 -1
- package/docs/Microsoft.Quantum.Math/PlusC.md +1 -1
- package/docs/Microsoft.Quantum.Math/PlusCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/PowC.md +1 -1
- package/docs/Microsoft.Quantum.Math/PowCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/RealMod.md +1 -1
- package/docs/Microsoft.Quantum.Math/Round.md +1 -1
- package/docs/Microsoft.Quantum.Math/SignD.md +1 -1
- package/docs/Microsoft.Quantum.Math/SignI.md +1 -1
- package/docs/Microsoft.Quantum.Math/SignL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Sin.md +1 -1
- package/docs/Microsoft.Quantum.Math/Sinh.md +1 -1
- package/docs/Microsoft.Quantum.Math/SmallestFixedPoint.md +1 -1
- package/docs/Microsoft.Quantum.Math/Sqrt.md +1 -1
- package/docs/Microsoft.Quantum.Math/SquaredNorm.md +1 -1
- package/docs/Microsoft.Quantum.Math/Tan.md +1 -1
- package/docs/Microsoft.Quantum.Math/Tanh.md +1 -1
- package/docs/Microsoft.Quantum.Math/TimesC.md +1 -1
- package/docs/Microsoft.Quantum.Math/TimesCP.md +1 -1
- package/docs/Microsoft.Quantum.Math/TrailingZeroCountI.md +1 -1
- package/docs/Microsoft.Quantum.Math/TrailingZeroCountL.md +1 -1
- package/docs/Microsoft.Quantum.Math/Truncate.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetEachZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetX.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetY.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MResetZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MeasureAllZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MeasureEachZ.md +1 -1
- package/docs/Microsoft.Quantum.Measurement/MeasureInteger.md +1 -1
- package/docs/Microsoft.Quantum.Random/DrawRandomDouble.md +1 -1
- package/docs/Microsoft.Quantum.Random/DrawRandomInt.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/AccountForEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/AuxQubitCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/BeginEstimateCaching.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/BeginRepeatEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/CczCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/EndEstimateCaching.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/EndRepeatEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/MeasurementCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/PSSPCLayout.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/RepeatEstimates.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/RotationCount.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/RotationDepth.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/SingleVariant.md +1 -1
- package/docs/Microsoft.Quantum.ResourceEstimation/TCount.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/AddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/FourierTDIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByI.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByIUsingIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByL.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLEUsingAddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLUsingIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/LookAheadDKRSAddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/MAJ.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/ReflectAboutInteger.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGAddLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryTTKIncByLE.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.StatePreparation/ApproximatelyPreparePureStateCP.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.StatePreparation/PreparePureStateD.md +1 -1
- package/docs/Microsoft.Quantum.Unstable.TableLookup/Select.md +1 -1
- package/lib/node/qsc_wasm.cjs +59 -4
- package/lib/node/qsc_wasm.d.cts +22 -2
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm.d.ts +24 -2
- package/lib/web/qsc_wasm.js +58 -4
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/ux/circuit.tsx +98 -0
- package/ux/index.ts +2 -0
- package/ux/qsharp-circuit.css +194 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Unstable.StatePreparation.PreparePureStateD
|
|
3
3
|
title: PreparePureStateD operation
|
|
4
|
-
ms.date: 03/
|
|
4
|
+
ms.date: 03/27/2024 12:00:00 AM
|
|
5
5
|
ms.topic: managed-reference
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.namespace: Microsoft.Quantum.Unstable.StatePreparation
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
uid: Qdk.Microsoft.Quantum.Unstable.TableLookup.Select
|
|
3
3
|
title: Select operation
|
|
4
|
-
ms.date: 03/
|
|
4
|
+
ms.date: 03/27/2024 12:00:00 AM
|
|
5
5
|
ms.topic: managed-reference
|
|
6
6
|
qsharp.kind: operation
|
|
7
7
|
qsharp.namespace: Microsoft.Quantum.Unstable.TableLookup
|
package/lib/node/qsc_wasm.cjs
CHANGED
|
@@ -396,6 +396,35 @@ module.exports.get_estimates = function(sources, params, language_features) {
|
|
|
396
396
|
}
|
|
397
397
|
};
|
|
398
398
|
|
|
399
|
+
/**
|
|
400
|
+
* @param {(Array<any>)[]} sources
|
|
401
|
+
* @param {string} targetProfile
|
|
402
|
+
* @param {IOperationInfo | undefined} operation
|
|
403
|
+
* @param {(string)[]} language_features
|
|
404
|
+
* @returns {any}
|
|
405
|
+
*/
|
|
406
|
+
module.exports.get_circuit = function(sources, targetProfile, operation, language_features) {
|
|
407
|
+
try {
|
|
408
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
409
|
+
const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
|
|
410
|
+
const len0 = WASM_VECTOR_LEN;
|
|
411
|
+
const ptr1 = passStringToWasm0(targetProfile, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
412
|
+
const len1 = WASM_VECTOR_LEN;
|
|
413
|
+
const ptr2 = passArrayJsValueToWasm0(language_features, wasm.__wbindgen_export_0);
|
|
414
|
+
const len2 = WASM_VECTOR_LEN;
|
|
415
|
+
wasm.get_circuit(retptr, ptr0, len0, ptr1, len1, isLikeNone(operation) ? 0 : addHeapObject(operation), ptr2, len2);
|
|
416
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
417
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
418
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
419
|
+
if (r2) {
|
|
420
|
+
throw takeObject(r1);
|
|
421
|
+
}
|
|
422
|
+
return takeObject(r0);
|
|
423
|
+
} finally {
|
|
424
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
|
|
399
428
|
/**
|
|
400
429
|
* @param {string} name
|
|
401
430
|
* @returns {string | undefined}
|
|
@@ -516,7 +545,7 @@ function handleError(f, args) {
|
|
|
516
545
|
wasm.__wbindgen_export_5(addHeapObject(e));
|
|
517
546
|
}
|
|
518
547
|
}
|
|
519
|
-
function
|
|
548
|
+
function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
|
|
520
549
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
521
550
|
}
|
|
522
551
|
|
|
@@ -588,6 +617,24 @@ class DebugService {
|
|
|
588
617
|
return takeObject(ret);
|
|
589
618
|
}
|
|
590
619
|
/**
|
|
620
|
+
* @returns {any}
|
|
621
|
+
*/
|
|
622
|
+
get_circuit() {
|
|
623
|
+
try {
|
|
624
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
625
|
+
wasm.debugservice_get_circuit(retptr, this.__wbg_ptr);
|
|
626
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
627
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
628
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
629
|
+
if (r2) {
|
|
630
|
+
throw takeObject(r1);
|
|
631
|
+
}
|
|
632
|
+
return takeObject(r0);
|
|
633
|
+
} finally {
|
|
634
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
591
638
|
* @returns {IStackFrameList}
|
|
592
639
|
*/
|
|
593
640
|
get_stack_frames() {
|
|
@@ -1110,6 +1157,14 @@ module.exports.__wbindgen_as_number = function(arg0) {
|
|
|
1110
1157
|
return ret;
|
|
1111
1158
|
};
|
|
1112
1159
|
|
|
1160
|
+
module.exports.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
|
|
1161
|
+
const ret = String(getObject(arg1));
|
|
1162
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1163
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1164
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
1165
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1113
1168
|
module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
|
|
1114
1169
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
1115
1170
|
return addHeapObject(ret);
|
|
@@ -1294,7 +1349,7 @@ module.exports.__wbg_new_81740750da40724f = function(arg0, arg1) {
|
|
|
1294
1349
|
const a = state0.a;
|
|
1295
1350
|
state0.a = 0;
|
|
1296
1351
|
try {
|
|
1297
|
-
return
|
|
1352
|
+
return __wbg_adapter_174(a, state0.b, arg0, arg1);
|
|
1298
1353
|
} finally {
|
|
1299
1354
|
state0.a = a;
|
|
1300
1355
|
}
|
|
@@ -1405,8 +1460,8 @@ module.exports.__wbindgen_memory = function() {
|
|
|
1405
1460
|
return addHeapObject(ret);
|
|
1406
1461
|
};
|
|
1407
1462
|
|
|
1408
|
-
module.exports.
|
|
1409
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1463
|
+
module.exports.__wbindgen_closure_wrapper701 = function(arg0, arg1, arg2) {
|
|
1464
|
+
const ret = makeMutClosure(arg0, arg1, 294, __wbg_adapter_54);
|
|
1410
1465
|
return addHeapObject(ret);
|
|
1411
1466
|
};
|
|
1412
1467
|
|
package/lib/node/qsc_wasm.d.cts
CHANGED
|
@@ -27,6 +27,14 @@ export function get_qir(sources: (Array<any>)[], language_features: (string)[]):
|
|
|
27
27
|
*/
|
|
28
28
|
export function get_estimates(sources: (Array<any>)[], params: string, language_features: (string)[]): string;
|
|
29
29
|
/**
|
|
30
|
+
* @param {(Array<any>)[]} sources
|
|
31
|
+
* @param {string} targetProfile
|
|
32
|
+
* @param {IOperationInfo | undefined} operation
|
|
33
|
+
* @param {(string)[]} language_features
|
|
34
|
+
* @returns {any}
|
|
35
|
+
*/
|
|
36
|
+
export function get_circuit(sources: (Array<any>)[], targetProfile: string, operation: IOperationInfo | undefined, language_features: (string)[]): any;
|
|
37
|
+
/**
|
|
30
38
|
* @param {string} name
|
|
31
39
|
* @returns {string | undefined}
|
|
32
40
|
*/
|
|
@@ -179,10 +187,18 @@ export interface IParameterInformation {
|
|
|
179
187
|
documentation: string;
|
|
180
188
|
}
|
|
181
189
|
|
|
182
|
-
export
|
|
190
|
+
export type ICodeLens = {
|
|
183
191
|
range: IRange;
|
|
184
192
|
command: "histogram" | "estimate" | "debug" | "run";
|
|
185
|
-
|
|
193
|
+
} | {
|
|
194
|
+
range: IRange;
|
|
195
|
+
command: "circuit";
|
|
196
|
+
args?: IOperationInfo
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface IOperationInfo {
|
|
200
|
+
operation: string;
|
|
201
|
+
totalNumQubits: number;
|
|
186
202
|
}
|
|
187
203
|
|
|
188
204
|
export interface IWorkspaceEdit {
|
|
@@ -239,6 +255,10 @@ export class DebugService {
|
|
|
239
255
|
*/
|
|
240
256
|
capture_quantum_state(): IQuantumStateList;
|
|
241
257
|
/**
|
|
258
|
+
* @returns {any}
|
|
259
|
+
*/
|
|
260
|
+
get_circuit(): any;
|
|
261
|
+
/**
|
|
242
262
|
* @returns {IStackFrameList}
|
|
243
263
|
*/
|
|
244
264
|
get_stack_frames(): IStackFrameList;
|
|
Binary file
|
package/lib/web/qsc_wasm.d.ts
CHANGED
|
@@ -27,6 +27,14 @@ export function get_qir(sources: (Array<any>)[], language_features: (string)[]):
|
|
|
27
27
|
*/
|
|
28
28
|
export function get_estimates(sources: (Array<any>)[], params: string, language_features: (string)[]): string;
|
|
29
29
|
/**
|
|
30
|
+
* @param {(Array<any>)[]} sources
|
|
31
|
+
* @param {string} targetProfile
|
|
32
|
+
* @param {IOperationInfo | undefined} operation
|
|
33
|
+
* @param {(string)[]} language_features
|
|
34
|
+
* @returns {any}
|
|
35
|
+
*/
|
|
36
|
+
export function get_circuit(sources: (Array<any>)[], targetProfile: string, operation: IOperationInfo | undefined, language_features: (string)[]): any;
|
|
37
|
+
/**
|
|
30
38
|
* @param {string} name
|
|
31
39
|
* @returns {string | undefined}
|
|
32
40
|
*/
|
|
@@ -179,10 +187,18 @@ export interface IParameterInformation {
|
|
|
179
187
|
documentation: string;
|
|
180
188
|
}
|
|
181
189
|
|
|
182
|
-
export
|
|
190
|
+
export type ICodeLens = {
|
|
183
191
|
range: IRange;
|
|
184
192
|
command: "histogram" | "estimate" | "debug" | "run";
|
|
185
|
-
|
|
193
|
+
} | {
|
|
194
|
+
range: IRange;
|
|
195
|
+
command: "circuit";
|
|
196
|
+
args?: IOperationInfo
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export interface IOperationInfo {
|
|
200
|
+
operation: string;
|
|
201
|
+
totalNumQubits: number;
|
|
186
202
|
}
|
|
187
203
|
|
|
188
204
|
export interface IWorkspaceEdit {
|
|
@@ -239,6 +255,10 @@ export class DebugService {
|
|
|
239
255
|
*/
|
|
240
256
|
capture_quantum_state(): IQuantumStateList;
|
|
241
257
|
/**
|
|
258
|
+
* @returns {any}
|
|
259
|
+
*/
|
|
260
|
+
get_circuit(): any;
|
|
261
|
+
/**
|
|
242
262
|
* @returns {IStackFrameList}
|
|
243
263
|
*/
|
|
244
264
|
get_stack_frames(): IStackFrameList;
|
|
@@ -400,6 +420,7 @@ export interface InitOutput {
|
|
|
400
420
|
readonly debugservice_new: () => number;
|
|
401
421
|
readonly debugservice_load_source: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
402
422
|
readonly debugservice_capture_quantum_state: (a: number) => number;
|
|
423
|
+
readonly debugservice_get_circuit: (a: number, b: number) => void;
|
|
403
424
|
readonly debugservice_get_stack_frames: (a: number) => number;
|
|
404
425
|
readonly debugservice_eval_next: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
405
426
|
readonly debugservice_eval_continue: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
@@ -433,6 +454,7 @@ export interface InitOutput {
|
|
|
433
454
|
readonly git_hash: (a: number) => void;
|
|
434
455
|
readonly get_qir: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
435
456
|
readonly get_estimates: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
457
|
+
readonly get_circuit: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
436
458
|
readonly get_library_source_content: (a: number, b: number, c: number) => void;
|
|
437
459
|
readonly get_hir: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
438
460
|
readonly run: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
package/lib/web/qsc_wasm.js
CHANGED
|
@@ -393,6 +393,35 @@ export function get_estimates(sources, params, language_features) {
|
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
/**
|
|
397
|
+
* @param {(Array<any>)[]} sources
|
|
398
|
+
* @param {string} targetProfile
|
|
399
|
+
* @param {IOperationInfo | undefined} operation
|
|
400
|
+
* @param {(string)[]} language_features
|
|
401
|
+
* @returns {any}
|
|
402
|
+
*/
|
|
403
|
+
export function get_circuit(sources, targetProfile, operation, language_features) {
|
|
404
|
+
try {
|
|
405
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
406
|
+
const ptr0 = passArrayJsValueToWasm0(sources, wasm.__wbindgen_export_0);
|
|
407
|
+
const len0 = WASM_VECTOR_LEN;
|
|
408
|
+
const ptr1 = passStringToWasm0(targetProfile, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
409
|
+
const len1 = WASM_VECTOR_LEN;
|
|
410
|
+
const ptr2 = passArrayJsValueToWasm0(language_features, wasm.__wbindgen_export_0);
|
|
411
|
+
const len2 = WASM_VECTOR_LEN;
|
|
412
|
+
wasm.get_circuit(retptr, ptr0, len0, ptr1, len1, isLikeNone(operation) ? 0 : addHeapObject(operation), ptr2, len2);
|
|
413
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
414
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
415
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
416
|
+
if (r2) {
|
|
417
|
+
throw takeObject(r1);
|
|
418
|
+
}
|
|
419
|
+
return takeObject(r0);
|
|
420
|
+
} finally {
|
|
421
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
396
425
|
/**
|
|
397
426
|
* @param {string} name
|
|
398
427
|
* @returns {string | undefined}
|
|
@@ -513,7 +542,7 @@ function handleError(f, args) {
|
|
|
513
542
|
wasm.__wbindgen_export_5(addHeapObject(e));
|
|
514
543
|
}
|
|
515
544
|
}
|
|
516
|
-
function
|
|
545
|
+
function __wbg_adapter_174(arg0, arg1, arg2, arg3) {
|
|
517
546
|
wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
518
547
|
}
|
|
519
548
|
|
|
@@ -585,6 +614,24 @@ export class DebugService {
|
|
|
585
614
|
return takeObject(ret);
|
|
586
615
|
}
|
|
587
616
|
/**
|
|
617
|
+
* @returns {any}
|
|
618
|
+
*/
|
|
619
|
+
get_circuit() {
|
|
620
|
+
try {
|
|
621
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
622
|
+
wasm.debugservice_get_circuit(retptr, this.__wbg_ptr);
|
|
623
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
624
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
625
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
626
|
+
if (r2) {
|
|
627
|
+
throw takeObject(r1);
|
|
628
|
+
}
|
|
629
|
+
return takeObject(r0);
|
|
630
|
+
} finally {
|
|
631
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
588
635
|
* @returns {IStackFrameList}
|
|
589
636
|
*/
|
|
590
637
|
get_stack_frames() {
|
|
@@ -1112,6 +1159,13 @@ function __wbg_get_imports() {
|
|
|
1112
1159
|
const ret = +getObject(arg0);
|
|
1113
1160
|
return ret;
|
|
1114
1161
|
};
|
|
1162
|
+
imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
|
|
1163
|
+
const ret = String(getObject(arg1));
|
|
1164
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
1165
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1166
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
1167
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
1168
|
+
};
|
|
1115
1169
|
imports.wbg.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
|
|
1116
1170
|
const ret = getObject(arg0)[getObject(arg1)];
|
|
1117
1171
|
return addHeapObject(ret);
|
|
@@ -1262,7 +1316,7 @@ function __wbg_get_imports() {
|
|
|
1262
1316
|
const a = state0.a;
|
|
1263
1317
|
state0.a = 0;
|
|
1264
1318
|
try {
|
|
1265
|
-
return
|
|
1319
|
+
return __wbg_adapter_174(a, state0.b, arg0, arg1);
|
|
1266
1320
|
} finally {
|
|
1267
1321
|
state0.a = a;
|
|
1268
1322
|
}
|
|
@@ -1354,8 +1408,8 @@ function __wbg_get_imports() {
|
|
|
1354
1408
|
const ret = wasm.memory;
|
|
1355
1409
|
return addHeapObject(ret);
|
|
1356
1410
|
};
|
|
1357
|
-
imports.wbg.
|
|
1358
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
1411
|
+
imports.wbg.__wbindgen_closure_wrapper701 = function(arg0, arg1, arg2) {
|
|
1412
|
+
const ret = makeMutClosure(arg0, arg1, 294, __wbg_adapter_54);
|
|
1359
1413
|
return addHeapObject(ret);
|
|
1360
1414
|
};
|
|
1361
1415
|
|
package/lib/web/qsc_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/ux/circuit.tsx
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
import * as qviz from "@microsoft/quantum-viz.js/lib";
|
|
5
|
+
import { useEffect, useRef } from "preact/hooks";
|
|
6
|
+
|
|
7
|
+
// For perf reasons we set a limit on how many gates/qubits
|
|
8
|
+
// we attempt to render. This is still a lot higher than a human would
|
|
9
|
+
// reasonably want to look at, but it takes about a second to
|
|
10
|
+
// render a circuit this big on a mid-grade laptop so we allow it.
|
|
11
|
+
const MAX_OPERATIONS = 10000;
|
|
12
|
+
const MAX_QUBITS = 1000;
|
|
13
|
+
|
|
14
|
+
/* This component is shared by the Python widget and the VS Code panel */
|
|
15
|
+
export function Circuit(props: { circuit: qviz.Circuit }) {
|
|
16
|
+
const errorDiv =
|
|
17
|
+
props.circuit.qubits.length === 0 ? (
|
|
18
|
+
<div>
|
|
19
|
+
<p>No circuit to display. No qubits have been allocated.</p>
|
|
20
|
+
<p>
|
|
21
|
+
<em>
|
|
22
|
+
Tip: you can generate a circuit diagram for any operation that takes
|
|
23
|
+
qubits or arrays of qubits as input.
|
|
24
|
+
</em>
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
) : props.circuit.operations.length > MAX_OPERATIONS ? (
|
|
28
|
+
<div>
|
|
29
|
+
<p>
|
|
30
|
+
This circuit has too many gates to display. It has{" "}
|
|
31
|
+
{props.circuit.operations.length} gates, but the maximum supported is{" "}
|
|
32
|
+
{MAX_OPERATIONS}.
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
35
|
+
) : props.circuit.qubits.length > MAX_QUBITS ? (
|
|
36
|
+
<div>
|
|
37
|
+
<p>
|
|
38
|
+
This circuit has too many qubits to display. It has{" "}
|
|
39
|
+
{props.circuit.qubits.length} qubits, but the maximum supported is{" "}
|
|
40
|
+
{MAX_QUBITS}.
|
|
41
|
+
</p>
|
|
42
|
+
</div>
|
|
43
|
+
) : undefined;
|
|
44
|
+
|
|
45
|
+
if (errorDiv) {
|
|
46
|
+
return <div class=".qs-circuit-error">{errorDiv}</div>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const circuitDiv = useRef<HTMLDivElement>(null);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
qviz.draw(props.circuit, circuitDiv.current!);
|
|
53
|
+
|
|
54
|
+
// quantum-viz hardcodes the styles in the SVG.
|
|
55
|
+
// Remove the style elements -- we'll define the styles in our own CSS.
|
|
56
|
+
const styleElements = circuitDiv.current?.querySelectorAll("style");
|
|
57
|
+
styleElements?.forEach((tag) => tag.remove());
|
|
58
|
+
}, [props.circuit]);
|
|
59
|
+
|
|
60
|
+
return <div class="qs-circuit" ref={circuitDiv}></div>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* This component is exclusive to the VS Code panel */
|
|
64
|
+
export function CircuitPanel(props: {
|
|
65
|
+
title: string;
|
|
66
|
+
subtitle: string;
|
|
67
|
+
circuit?: qviz.Circuit;
|
|
68
|
+
errorHtml?: string;
|
|
69
|
+
}) {
|
|
70
|
+
return (
|
|
71
|
+
<div class="qs-circuit-panel">
|
|
72
|
+
<div>
|
|
73
|
+
<h1>{props.title}</h1>
|
|
74
|
+
</div>
|
|
75
|
+
{props.circuit ? <Circuit circuit={props.circuit}></Circuit> : null}
|
|
76
|
+
<div class="qs-circuit-error">
|
|
77
|
+
{props.errorHtml ? (
|
|
78
|
+
<div>
|
|
79
|
+
<p>
|
|
80
|
+
A circuit could not be generated for this program. See the
|
|
81
|
+
error(s) below.
|
|
82
|
+
<br />
|
|
83
|
+
</p>
|
|
84
|
+
<div dangerouslySetInnerHTML={{ __html: props.errorHtml }}></div>
|
|
85
|
+
</div>
|
|
86
|
+
) : null}
|
|
87
|
+
</div>
|
|
88
|
+
<p>{props.subtitle /* target profile */}</p>
|
|
89
|
+
<p>
|
|
90
|
+
<a href="https://github.com/microsoft/qsharp/wiki/Circuit-Diagrams-from-Q%23-Code">
|
|
91
|
+
Learn more
|
|
92
|
+
</a>
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export type CircuitData = qviz.Circuit;
|
package/ux/index.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// By importing the CSS here, esbuild will by default bundle it up and copy it
|
|
5
5
|
// to a CSS file adjacent to the JS bundle and with the same name.
|
|
6
6
|
import "./qsharp-ux.css";
|
|
7
|
+
import "./qsharp-circuit.css";
|
|
7
8
|
|
|
8
9
|
export { CreateSingleEstimateResult, type ReData } from "./data.js";
|
|
9
10
|
export { Histogram } from "./histogram.js";
|
|
@@ -12,3 +13,4 @@ export { SpaceChart } from "./spaceChart.js";
|
|
|
12
13
|
export { ScatterChart } from "./scatterChart.js";
|
|
13
14
|
export { EstimatesOverview } from "./estimatesOverview.js";
|
|
14
15
|
export { EstimatesPanel } from "./estimatesPanel.js";
|
|
16
|
+
export { Circuit, CircuitPanel, type CircuitData } from "./circuit.js";
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/* Copyright (c) Microsoft Corporation.
|
|
2
|
+
Licensed under the MIT License. */
|
|
3
|
+
|
|
4
|
+
/* Circuit panel */
|
|
5
|
+
.qs-circuit-panel p {
|
|
6
|
+
padding: 10px 0px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Error div in circuit panel */
|
|
10
|
+
.qs-circuit-error {
|
|
11
|
+
padding: 10px 0px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.qs-circuit-error p {
|
|
15
|
+
padding: 10px 0px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/*
|
|
19
|
+
Styles for Q# circuits.
|
|
20
|
+
Copied and modified from the default CSS generated by
|
|
21
|
+
https://github.com/microsoft/quantum-viz.js/blob/288e0cb506ee866ecca1b414c522e2d634f7b36d/src/styles.ts
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/* Background color for the circuit diagram */
|
|
25
|
+
.qs-circuit {
|
|
26
|
+
background: var(--main-background);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Wires and gate outlines */
|
|
30
|
+
.qs-circuit line,
|
|
31
|
+
.qs-circuit circle,
|
|
32
|
+
.qs-circuit rect {
|
|
33
|
+
stroke: var(--main-color);
|
|
34
|
+
stroke-width: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* Text for qubit labels */
|
|
38
|
+
.qs-circuit text {
|
|
39
|
+
fill: var(--main-color);
|
|
40
|
+
dominant-baseline: middle;
|
|
41
|
+
text-anchor: middle;
|
|
42
|
+
font-family: Arial;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Background for gates */
|
|
46
|
+
.qs-circuit .gate-unitary {
|
|
47
|
+
fill: var(--vscode-button-secondaryBackground, #d9f1fa);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Text for gates */
|
|
51
|
+
.qs-circuit .gate text {
|
|
52
|
+
fill: var(--vscode-button-secondaryForeground, #000000);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Dot and line for controlled gates */
|
|
56
|
+
.qs-circuit .gate > line,
|
|
57
|
+
.qs-circuit .control-dot {
|
|
58
|
+
fill: var(--main-color);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* X gate */
|
|
62
|
+
.qs-circuit .gate > .oplus > line,
|
|
63
|
+
.qs-circuit .gate > .oplus > circle {
|
|
64
|
+
fill: var(--main-background);
|
|
65
|
+
stroke: var(--main-color);
|
|
66
|
+
stroke-width: 2;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Measurement gate */
|
|
70
|
+
.qs-circuit .gate-measure {
|
|
71
|
+
fill: var(--vscode-button-background, #ffde86);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Measurement gate icon */
|
|
75
|
+
.qs-circuit .gate > g > line,
|
|
76
|
+
.qs-circuit .arc-measure {
|
|
77
|
+
stroke: var(--vscode-button-foreground, #000000);
|
|
78
|
+
fill: none;
|
|
79
|
+
stroke-width: 1;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* SWAP gate */
|
|
83
|
+
.qs-circuit rect.gate-swap {
|
|
84
|
+
fill: transparent;
|
|
85
|
+
stroke: transparent;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Classical wire */
|
|
89
|
+
.qs-circuit .register-classical {
|
|
90
|
+
stroke-width: 0.5;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
The following styles are unused so they are unthemed.
|
|
95
|
+
They relate to conditional circuits which are not currently supported.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
.qs-circuit .hidden {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.qs-circuit .classically-controlled-unknown {
|
|
103
|
+
opacity: 0.25;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.qs-circuit .classically-controlled-one .classical-container,
|
|
107
|
+
.qs-circuit .classically-controlled-one .classical-line {
|
|
108
|
+
stroke: #4059bd;
|
|
109
|
+
stroke-width: 1.3;
|
|
110
|
+
fill: #4059bd;
|
|
111
|
+
fill-opacity: 0.1;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.qs-circuit .classically-controlled-zero .classical-container,
|
|
115
|
+
.qs-circuit .classically-controlled-zero .classical-line {
|
|
116
|
+
stroke: #c40000;
|
|
117
|
+
stroke-width: 1.3;
|
|
118
|
+
fill: #c40000;
|
|
119
|
+
fill-opacity: 0.1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.qs-circuit .classically-controlled-btn {
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.qs-circuit .classically-controlled-unknown .classically-controlled-btn {
|
|
127
|
+
fill: #e5e5e5;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.qs-circuit .classically-controlled-one .classically-controlled-btn {
|
|
131
|
+
fill: #4059bd;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.qs-circuit .classically-controlled-zero .classically-controlled-btn {
|
|
135
|
+
fill: #c40000;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.qs-circuit .classically-controlled-btn text {
|
|
139
|
+
dominant-baseline: middle;
|
|
140
|
+
text-anchor: middle;
|
|
141
|
+
stroke: none;
|
|
142
|
+
font-family: Arial;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.qs-circuit .classically-controlled-unknown .classically-controlled-btn text {
|
|
146
|
+
fill: #000000;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.qs-circuit .classically-controlled-one .classically-controlled-btn text {
|
|
150
|
+
fill: #ffffff;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.qs-circuit .classically-controlled-zero .classically-controlled-btn text {
|
|
154
|
+
fill: #ffffff;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.qs-circuit .qviz .gate-collapse,
|
|
158
|
+
.qs-circuit .qviz .gate-expand {
|
|
159
|
+
opacity: 0;
|
|
160
|
+
transition: opacity 1s;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.qs-circuit .qviz:hover .gate-collapse,
|
|
164
|
+
.qs-circuit .qviz:hover .gate-expand {
|
|
165
|
+
visibility: visible;
|
|
166
|
+
opacity: 0.2;
|
|
167
|
+
transition: visibility 1s;
|
|
168
|
+
transition: opacity 1s;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.qs-circuit .gate-expand,
|
|
172
|
+
.gate-collapse {
|
|
173
|
+
cursor: pointer;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.qs-circuit .gate-collapse circle,
|
|
177
|
+
.qs-circuit .gate-expand circle {
|
|
178
|
+
fill: white;
|
|
179
|
+
stroke-width: 2px;
|
|
180
|
+
stroke: black;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.qs-circuit .gate-collapse path,
|
|
184
|
+
.qs-circuit .gate-expand path {
|
|
185
|
+
stroke-width: 4px;
|
|
186
|
+
stroke: black;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.qs-circuit .gate:hover > .gate-collapse,
|
|
190
|
+
.qs-circuit .gate:hover > .gate-expand {
|
|
191
|
+
visibility: visible;
|
|
192
|
+
opacity: 1;
|
|
193
|
+
transition: opacity 1s;
|
|
194
|
+
}
|