qsharp-lang 1.15.2-dev → 1.15.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 +5 -5
- package/dist/katas-content.generated.md.js +5 -5
- package/dist/samples.generated.js +6 -0
- package/dist/shared/legacyCircuitUpdate.js +1 -0
- package/dist/shared/register.d.ts +5 -5
- package/docs/Microsoft.Quantum.Core/Length.md +1 -1
- package/docs/Microsoft.Quantum.Core/Repeated.md +1 -1
- package/docs/Microsoft.Quantum.Core/index.md +1 -1
- package/docs/Std.Arithmetic/AddLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfEqualL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfEqualLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterOrEqualL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfGreaterOrEqualLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessLE.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessOrEqualL.md +1 -1
- package/docs/Std.Arithmetic/ApplyIfLessOrEqualLE.md +1 -1
- package/docs/Std.Arithmetic/FourierTDIncByLE.md +1 -1
- package/docs/Std.Arithmetic/IncByI.md +1 -1
- package/docs/Std.Arithmetic/IncByIUsingIncByLE.md +1 -1
- package/docs/Std.Arithmetic/IncByL.md +1 -1
- package/docs/Std.Arithmetic/IncByLE.md +1 -1
- package/docs/Std.Arithmetic/IncByLEUsingAddLE.md +1 -1
- package/docs/Std.Arithmetic/IncByLUsingIncByLE.md +1 -1
- package/docs/Std.Arithmetic/LookAheadDKRSAddLE.md +1 -1
- package/docs/Std.Arithmetic/MAJ.md +1 -1
- package/docs/Std.Arithmetic/ReflectAboutInteger.md +1 -1
- package/docs/Std.Arithmetic/RippleCarryCGAddLE.md +1 -1
- package/docs/Std.Arithmetic/RippleCarryCGIncByLE.md +1 -1
- package/docs/Std.Arithmetic/RippleCarryTTKIncByLE.md +1 -1
- package/docs/Std.Arithmetic/index.md +1 -1
- package/docs/Std.Arrays/All.md +1 -1
- package/docs/Std.Arrays/Any.md +1 -1
- package/docs/Std.Arrays/Chunks.md +1 -1
- package/docs/Std.Arrays/CircularlyShifted.md +1 -1
- package/docs/Std.Arrays/ColumnAt.md +1 -1
- package/docs/Std.Arrays/Count.md +1 -1
- package/docs/Std.Arrays/Diagonal.md +1 -1
- package/docs/Std.Arrays/DrawMany.md +1 -1
- package/docs/Std.Arrays/Enumerated.md +1 -1
- package/docs/Std.Arrays/Excluding.md +1 -1
- package/docs/Std.Arrays/Filtered.md +1 -1
- package/docs/Std.Arrays/FlatMapped.md +1 -1
- package/docs/Std.Arrays/Flattened.md +1 -1
- package/docs/Std.Arrays/Fold.md +1 -1
- package/docs/Std.Arrays/ForEach.md +1 -1
- package/docs/Std.Arrays/Head.md +1 -1
- package/docs/Std.Arrays/HeadAndRest.md +1 -1
- package/docs/Std.Arrays/IndexOf.md +1 -1
- package/docs/Std.Arrays/IndexRange.md +1 -1
- package/docs/Std.Arrays/Interleaved.md +1 -1
- package/docs/Std.Arrays/IsEmpty.md +1 -1
- package/docs/Std.Arrays/IsRectangularArray.md +1 -1
- package/docs/Std.Arrays/IsSorted.md +1 -1
- package/docs/Std.Arrays/IsSquareArray.md +1 -1
- package/docs/Std.Arrays/Mapped.md +1 -1
- package/docs/Std.Arrays/MappedByIndex.md +1 -1
- package/docs/Std.Arrays/MappedOverRange.md +1 -1
- package/docs/Std.Arrays/Most.md +1 -1
- package/docs/Std.Arrays/MostAndTail.md +1 -1
- package/docs/Std.Arrays/Padded.md +1 -1
- package/docs/Std.Arrays/Partitioned.md +1 -1
- package/docs/Std.Arrays/Rest.md +1 -1
- package/docs/Std.Arrays/Reversed.md +1 -1
- package/docs/Std.Arrays/SequenceI.md +1 -1
- package/docs/Std.Arrays/SequenceL.md +1 -1
- package/docs/Std.Arrays/Sorted.md +1 -1
- package/docs/Std.Arrays/Subarray.md +1 -1
- package/docs/Std.Arrays/Swapped.md +1 -1
- package/docs/Std.Arrays/Tail.md +1 -1
- package/docs/Std.Arrays/Transposed.md +1 -1
- package/docs/Std.Arrays/Unzipped.md +1 -1
- package/docs/Std.Arrays/Where.md +1 -1
- package/docs/Std.Arrays/Windows.md +1 -1
- package/docs/Std.Arrays/Zipped.md +1 -1
- package/docs/Std.Arrays/index.md +1 -1
- package/docs/Std.Canon/ApplyCNOTChain.md +1 -1
- package/docs/Std.Canon/ApplyControlledOnBitString.md +1 -1
- package/docs/Std.Canon/ApplyControlledOnInt.md +1 -1
- package/docs/Std.Canon/ApplyOperationPowerA.md +25 -0
- package/docs/Std.Canon/ApplyP.md +1 -1
- package/docs/Std.Canon/ApplyPauli.md +1 -1
- package/docs/Std.Canon/ApplyPauliFromBitString.md +1 -1
- package/docs/Std.Canon/ApplyPauliFromInt.md +1 -1
- package/docs/Std.Canon/ApplyQFT.md +1 -1
- package/docs/Std.Canon/ApplyToEach.md +1 -1
- package/docs/Std.Canon/ApplyToEachA.md +1 -1
- package/docs/Std.Canon/ApplyToEachC.md +1 -1
- package/docs/Std.Canon/ApplyToEachCA.md +1 -1
- package/docs/Std.Canon/ApplyXorInPlace.md +1 -1
- package/docs/Std.Canon/ApplyXorInPlaceL.md +1 -1
- package/docs/Std.Canon/CX.md +1 -1
- package/docs/Std.Canon/CY.md +1 -1
- package/docs/Std.Canon/CZ.md +1 -1
- package/docs/Std.Canon/Fst.md +1 -1
- package/docs/Std.Canon/Relabel.md +1 -1
- package/docs/Std.Canon/Snd.md +1 -1
- package/docs/Std.Canon/SwapReverseRegister.md +1 -1
- package/docs/Std.Canon/index.md +2 -1
- package/docs/Std.Convert/BigIntAsBoolArray.md +1 -1
- package/docs/Std.Convert/BigIntAsInt.md +30 -0
- package/docs/Std.Convert/BoolArrayAsBigInt.md +1 -1
- package/docs/Std.Convert/BoolArrayAsInt.md +1 -1
- package/docs/Std.Convert/BoolArrayAsResultArray.md +1 -1
- package/docs/Std.Convert/BoolAsResult.md +1 -1
- package/docs/Std.Convert/ComplexAsComplexPolar.md +1 -1
- package/docs/Std.Convert/ComplexPolarAsComplex.md +1 -1
- package/docs/Std.Convert/DoubleAsStringWithPrecision.md +1 -1
- package/docs/Std.Convert/IntAsBigInt.md +1 -1
- package/docs/Std.Convert/IntAsBoolArray.md +1 -1
- package/docs/Std.Convert/IntAsDouble.md +1 -1
- package/docs/Std.Convert/ResultArrayAsBoolArray.md +1 -1
- package/docs/Std.Convert/ResultArrayAsInt.md +1 -1
- package/docs/Std.Convert/ResultAsBool.md +1 -1
- package/docs/Std.Convert/index.md +2 -1
- package/docs/Std.Core/Length.md +1 -1
- package/docs/Std.Core/Repeated.md +1 -1
- package/docs/Std.Core/index.md +1 -1
- package/docs/Std.Diagnostics/ApplyIdleNoise.md +1 -1
- package/docs/Std.Diagnostics/BitFlipNoise.md +1 -1
- package/docs/Std.Diagnostics/CheckAllZero.md +1 -1
- package/docs/Std.Diagnostics/CheckOperationsAreEqual.md +1 -1
- package/docs/Std.Diagnostics/CheckZero.md +1 -1
- package/docs/Std.Diagnostics/ConfigurePauliNoise.md +1 -1
- package/docs/Std.Diagnostics/DepolarizingNoise.md +1 -1
- package/docs/Std.Diagnostics/DumpMachine.md +1 -1
- package/docs/Std.Diagnostics/DumpOperation.md +1 -1
- package/docs/Std.Diagnostics/DumpRegister.md +1 -1
- package/docs/Std.Diagnostics/Fact.md +1 -1
- package/docs/Std.Diagnostics/NoNoise.md +1 -1
- package/docs/Std.Diagnostics/PhaseFlipNoise.md +1 -1
- package/docs/Std.Diagnostics/StartCountingFunction.md +1 -1
- package/docs/Std.Diagnostics/StartCountingOperation.md +1 -1
- package/docs/Std.Diagnostics/StartCountingQubits.md +1 -1
- package/docs/Std.Diagnostics/StopCountingFunction.md +1 -1
- package/docs/Std.Diagnostics/StopCountingOperation.md +1 -1
- package/docs/Std.Diagnostics/StopCountingQubits.md +1 -1
- package/docs/Std.Diagnostics/index.md +1 -1
- package/docs/Std.Intrinsic/AND.md +1 -1
- package/docs/Std.Intrinsic/ApplyUnitary.md +1 -1
- package/docs/Std.Intrinsic/CCNOT.md +1 -1
- package/docs/Std.Intrinsic/CNOT.md +1 -1
- package/docs/Std.Intrinsic/Exp.md +1 -1
- package/docs/Std.Intrinsic/H.md +1 -1
- package/docs/Std.Intrinsic/I.md +1 -1
- package/docs/Std.Intrinsic/M.md +1 -1
- package/docs/Std.Intrinsic/Measure.md +1 -1
- package/docs/Std.Intrinsic/Message.md +1 -1
- package/docs/Std.Intrinsic/R.md +1 -1
- package/docs/Std.Intrinsic/R1.md +1 -1
- package/docs/Std.Intrinsic/R1Frac.md +1 -1
- package/docs/Std.Intrinsic/RFrac.md +1 -1
- package/docs/Std.Intrinsic/Reset.md +1 -1
- package/docs/Std.Intrinsic/ResetAll.md +1 -1
- package/docs/Std.Intrinsic/Rx.md +1 -1
- package/docs/Std.Intrinsic/Rxx.md +1 -1
- package/docs/Std.Intrinsic/Ry.md +1 -1
- package/docs/Std.Intrinsic/Ryy.md +1 -1
- package/docs/Std.Intrinsic/Rz.md +1 -1
- package/docs/Std.Intrinsic/Rzz.md +1 -1
- package/docs/Std.Intrinsic/S.md +1 -1
- package/docs/Std.Intrinsic/SWAP.md +1 -1
- package/docs/Std.Intrinsic/T.md +1 -1
- package/docs/Std.Intrinsic/X.md +1 -1
- package/docs/Std.Intrinsic/Y.md +1 -1
- package/docs/Std.Intrinsic/Z.md +1 -1
- package/docs/Std.Intrinsic/index.md +1 -1
- package/docs/Std.Logical/Xor.md +1 -1
- package/docs/Std.Logical/index.md +1 -1
- package/docs/Std.Math/AbsComplex.md +1 -1
- package/docs/Std.Math/AbsComplexPolar.md +1 -1
- package/docs/Std.Math/AbsD.md +1 -1
- package/docs/Std.Math/AbsI.md +1 -1
- package/docs/Std.Math/AbsL.md +1 -1
- package/docs/Std.Math/AbsSquaredComplex.md +1 -1
- package/docs/Std.Math/AbsSquaredComplexPolar.md +1 -1
- package/docs/Std.Math/ApproximateFactorial.md +1 -1
- package/docs/Std.Math/ArcCos.md +1 -1
- package/docs/Std.Math/ArcCosh.md +1 -1
- package/docs/Std.Math/ArcSin.md +1 -1
- package/docs/Std.Math/ArcSinh.md +1 -1
- package/docs/Std.Math/ArcTan.md +1 -1
- package/docs/Std.Math/ArcTan2.md +1 -1
- package/docs/Std.Math/ArcTanh.md +1 -1
- package/docs/Std.Math/ArgComplex.md +1 -1
- package/docs/Std.Math/ArgComplexPolar.md +1 -1
- package/docs/Std.Math/Binom.md +1 -1
- package/docs/Std.Math/BitSizeI.md +1 -1
- package/docs/Std.Math/BitSizeL.md +1 -1
- package/docs/Std.Math/Ceiling.md +1 -1
- package/docs/Std.Math/Complex.md +1 -1
- package/docs/Std.Math/ComplexPolar.md +1 -1
- package/docs/Std.Math/ContinuedFractionConvergentI.md +1 -1
- package/docs/Std.Math/ContinuedFractionConvergentL.md +1 -1
- package/docs/Std.Math/Cos.md +1 -1
- package/docs/Std.Math/Cosh.md +1 -1
- package/docs/Std.Math/DivRemI.md +1 -1
- package/docs/Std.Math/DivRemL.md +1 -1
- package/docs/Std.Math/DividedByC.md +1 -1
- package/docs/Std.Math/DividedByCP.md +1 -1
- package/docs/Std.Math/E.md +1 -1
- package/docs/Std.Math/ExpModI.md +1 -1
- package/docs/Std.Math/ExpModL.md +1 -1
- package/docs/Std.Math/ExtendedGreatestCommonDivisorI.md +1 -1
- package/docs/Std.Math/ExtendedGreatestCommonDivisorL.md +1 -1
- package/docs/Std.Math/FactorialI.md +1 -1
- package/docs/Std.Math/FactorialL.md +1 -1
- package/docs/Std.Math/Floor.md +1 -1
- package/docs/Std.Math/GreatestCommonDivisorI.md +1 -1
- package/docs/Std.Math/GreatestCommonDivisorL.md +1 -1
- package/docs/Std.Math/HammingWeightI.md +1 -1
- package/docs/Std.Math/InverseModI.md +1 -1
- package/docs/Std.Math/InverseModL.md +1 -1
- package/docs/Std.Math/IsCoprimeI.md +1 -1
- package/docs/Std.Math/IsCoprimeL.md +1 -1
- package/docs/Std.Math/IsInfinite.md +1 -1
- package/docs/Std.Math/IsNaN.md +1 -1
- package/docs/Std.Math/LargestFixedPoint.md +1 -1
- package/docs/Std.Math/Lg.md +1 -1
- package/docs/Std.Math/Log.md +1 -1
- package/docs/Std.Math/Log10.md +1 -1
- package/docs/Std.Math/LogFactorialD.md +1 -1
- package/docs/Std.Math/LogGammaD.md +1 -1
- package/docs/Std.Math/LogOf2.md +1 -1
- package/docs/Std.Math/Max.md +1 -1
- package/docs/Std.Math/MaxD.md +1 -1
- package/docs/Std.Math/MaxI.md +1 -1
- package/docs/Std.Math/MaxL.md +1 -1
- package/docs/Std.Math/Min.md +1 -1
- package/docs/Std.Math/MinD.md +1 -1
- package/docs/Std.Math/MinI.md +1 -1
- package/docs/Std.Math/MinL.md +1 -1
- package/docs/Std.Math/MinusC.md +1 -1
- package/docs/Std.Math/MinusCP.md +1 -1
- package/docs/Std.Math/ModulusI.md +1 -1
- package/docs/Std.Math/ModulusL.md +1 -1
- package/docs/Std.Math/NegationC.md +1 -1
- package/docs/Std.Math/NegationCP.md +1 -1
- package/docs/Std.Math/PI.md +1 -1
- package/docs/Std.Math/PNorm.md +1 -1
- package/docs/Std.Math/PNormalized.md +1 -1
- package/docs/Std.Math/PlusC.md +1 -1
- package/docs/Std.Math/PlusCP.md +1 -1
- package/docs/Std.Math/PowC.md +1 -1
- package/docs/Std.Math/PowCP.md +1 -1
- package/docs/Std.Math/RealMod.md +1 -1
- package/docs/Std.Math/Round.md +8 -5
- package/docs/Std.Math/RoundHalfAwayFromZero.md +27 -0
- package/docs/Std.Math/SignD.md +1 -1
- package/docs/Std.Math/SignI.md +1 -1
- package/docs/Std.Math/SignL.md +1 -1
- package/docs/Std.Math/Sin.md +1 -1
- package/docs/Std.Math/Sinh.md +1 -1
- package/docs/Std.Math/SmallestFixedPoint.md +1 -1
- package/docs/Std.Math/Sqrt.md +1 -1
- package/docs/Std.Math/SquaredNorm.md +1 -1
- package/docs/Std.Math/Tan.md +1 -1
- package/docs/Std.Math/Tanh.md +1 -1
- package/docs/Std.Math/TimesC.md +1 -1
- package/docs/Std.Math/TimesCP.md +1 -1
- package/docs/Std.Math/TrailingZeroCountI.md +1 -1
- package/docs/Std.Math/TrailingZeroCountL.md +1 -1
- package/docs/Std.Math/Truncate.md +1 -1
- package/docs/Std.Math/index.md +3 -2
- package/docs/Std.Measurement/MResetEachZ.md +1 -1
- package/docs/Std.Measurement/MResetX.md +1 -1
- package/docs/Std.Measurement/MResetY.md +1 -1
- package/docs/Std.Measurement/MResetZ.md +1 -1
- package/docs/Std.Measurement/MeasureAllZ.md +1 -1
- package/docs/Std.Measurement/MeasureEachZ.md +1 -1
- package/docs/Std.Measurement/MeasureInteger.md +1 -1
- package/docs/Std.Measurement/index.md +1 -1
- package/docs/Std.Random/DrawRandomBool.md +1 -1
- package/docs/Std.Random/DrawRandomDouble.md +1 -1
- package/docs/Std.Random/DrawRandomInt.md +1 -1
- package/docs/Std.Random/index.md +1 -1
- package/docs/Std.Range/IsRangeEmpty.md +1 -1
- package/docs/Std.Range/RangeEnd.md +1 -1
- package/docs/Std.Range/RangeReverse.md +1 -1
- package/docs/Std.Range/RangeStart.md +1 -1
- package/docs/Std.Range/RangeStep.md +1 -1
- package/docs/Std.Range/index.md +1 -1
- package/docs/Std.ResourceEstimation/AccountForEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/AuxQubitCount.md +1 -1
- package/docs/Std.ResourceEstimation/BeginEstimateCaching.md +1 -1
- package/docs/Std.ResourceEstimation/BeginRepeatEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/CczCount.md +1 -1
- package/docs/Std.ResourceEstimation/EndEstimateCaching.md +1 -1
- package/docs/Std.ResourceEstimation/EndRepeatEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/MeasurementCount.md +1 -1
- package/docs/Std.ResourceEstimation/PSSPCLayout.md +1 -1
- package/docs/Std.ResourceEstimation/RepeatEstimates.md +1 -1
- package/docs/Std.ResourceEstimation/RotationCount.md +1 -1
- package/docs/Std.ResourceEstimation/RotationDepth.md +1 -1
- package/docs/Std.ResourceEstimation/SingleVariant.md +1 -1
- package/docs/Std.ResourceEstimation/TCount.md +1 -1
- package/docs/Std.ResourceEstimation/index.md +1 -1
- package/docs/Std.StatePreparation/ApproximatelyPreparePureStateCP.md +1 -1
- package/docs/Std.StatePreparation/PreparePureStateD.md +1 -1
- package/docs/Std.StatePreparation/PrepareUniformSuperposition.md +1 -1
- package/docs/Std.StatePreparation/index.md +1 -1
- package/docs/Std.TableLookup/Select.md +1 -1
- package/docs/Std.TableLookup/index.md +1 -1
- package/docs/index.md +1 -1
- package/docs/toc.yml +3 -0
- package/lib/node/qsc_wasm.cjs +2 -2
- package/lib/node/qsc_wasm.d.cts +3 -6
- package/lib/node/qsc_wasm_bg.wasm +0 -0
- package/lib/web/qsc_wasm.d.ts +3 -6
- package/lib/web/qsc_wasm.js +2 -2
- package/lib/web/qsc_wasm_bg.wasm +0 -0
- package/package.json +1 -1
- package/ux/circuit-vis/circuitManipulation.ts +31 -9
- package/ux/circuit-vis/contextMenu.ts +42 -18
- package/ux/circuit-vis/draggable.ts +3 -3
- package/ux/circuit-vis/events.ts +21 -6
- package/ux/circuit-vis/formatters/formatUtils.ts +3 -3
- package/ux/circuit-vis/formatters/gateFormatter.ts +106 -65
- package/ux/circuit-vis/formatters/inputFormatter.ts +9 -31
- package/ux/circuit-vis/formatters/registerFormatter.ts +4 -4
- package/ux/circuit-vis/{metadata.ts → gateRenderData.ts} +4 -4
- package/ux/circuit-vis/panel.ts +31 -32
- package/ux/circuit-vis/process.ts +114 -106
- package/ux/circuit-vis/register.ts +1 -1
- package/ux/circuit-vis/sqore.ts +14 -10
- package/ux/circuit-vis/utils.ts +56 -4
- package/ux/circuit.tsx +7 -1
- package/ux/qsharp-circuit.css +353 -334
|
@@ -9,26 +9,26 @@ import {
|
|
|
9
9
|
groupBoxPadding,
|
|
10
10
|
} from "./constants";
|
|
11
11
|
import { ComponentGrid, Operation, ConditionalRender } from "./circuit";
|
|
12
|
-
import {
|
|
12
|
+
import { GateRenderData, GateType } from "./gateRenderData";
|
|
13
13
|
import { Register, RegisterMap } from "./register";
|
|
14
14
|
import { getGateWidth } from "./utils";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Takes in a component grid and maps the operations to `
|
|
17
|
+
* Takes in a component grid and maps the operations to `GateRenderData` objects which
|
|
18
18
|
* contains information for formatting the corresponding SVG.
|
|
19
19
|
*
|
|
20
20
|
* @param componentGrid Grid of circuit components.
|
|
21
|
-
* @param registers Mapping from qubit IDs to register
|
|
21
|
+
* @param registers Mapping from qubit IDs to register render data.
|
|
22
22
|
*
|
|
23
|
-
* @returns An object containing `
|
|
23
|
+
* @returns An object containing `renderDataArray` (2D Array of GateRenderData objects) and
|
|
24
24
|
* `svgWidth` which is the width of the entire SVG.
|
|
25
25
|
*/
|
|
26
26
|
const processOperations = (
|
|
27
27
|
componentGrid: ComponentGrid,
|
|
28
28
|
registers: RegisterMap,
|
|
29
|
-
): {
|
|
29
|
+
): { renderDataArray: GateRenderData[][]; svgWidth: number } => {
|
|
30
30
|
if (componentGrid.length === 0)
|
|
31
|
-
return {
|
|
31
|
+
return { renderDataArray: [], svgWidth: startX };
|
|
32
32
|
const numColumns: number = componentGrid.length;
|
|
33
33
|
const columnsWidths: number[] = new Array(numColumns).fill(minGateWidth);
|
|
34
34
|
|
|
@@ -36,68 +36,73 @@ const processOperations = (
|
|
|
36
36
|
const classicalRegs: [number, Register][] =
|
|
37
37
|
_getClassicalRegStart(componentGrid);
|
|
38
38
|
|
|
39
|
-
// Map operation index to gate
|
|
40
|
-
const
|
|
41
|
-
col
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
39
|
+
// Map operation index to gate render data for formatting later
|
|
40
|
+
const renderDataArray: GateRenderData[][] = componentGrid.map(
|
|
41
|
+
(col, colIndex) =>
|
|
42
|
+
col.components.map((op) => {
|
|
43
|
+
const renderData: GateRenderData = _opToRenderData(op, registers);
|
|
44
|
+
|
|
45
|
+
if (
|
|
46
|
+
op != null &&
|
|
47
|
+
[GateType.Unitary, GateType.Ket, GateType.ControlledUnitary].includes(
|
|
48
|
+
renderData.type,
|
|
49
|
+
)
|
|
50
|
+
) {
|
|
51
|
+
// If gate is a unitary type, split targetsY into groups if there
|
|
52
|
+
// is a classical register between them for rendering
|
|
53
|
+
|
|
54
|
+
// Get y coordinates of classical registers in the same column as this operation
|
|
55
|
+
const classicalRegY: number[] = classicalRegs
|
|
56
|
+
.filter(([regCol]) => regCol <= colIndex)
|
|
57
|
+
.map(([, reg]) => {
|
|
58
|
+
if (reg.result == null)
|
|
59
|
+
throw new Error("Could not find cId for classical register.");
|
|
60
|
+
const { children } = registers[reg.qubit];
|
|
61
|
+
if (children == null)
|
|
62
|
+
throw new Error(
|
|
63
|
+
`Failed to find classical registers for qubit ID ${reg.qubit}.`,
|
|
64
|
+
);
|
|
65
|
+
return children[reg.result].y;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
let qubits: Register[];
|
|
69
|
+
switch (op.kind) {
|
|
70
|
+
case "unitary":
|
|
71
|
+
qubits = op.targets;
|
|
72
|
+
break;
|
|
73
|
+
case "measurement":
|
|
74
|
+
qubits = op.qubits;
|
|
75
|
+
break;
|
|
76
|
+
case "ket":
|
|
77
|
+
qubits = op.targets;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
renderData.targetsY = _splitTargetsY(
|
|
82
|
+
qubits,
|
|
83
|
+
classicalRegY,
|
|
84
|
+
registers,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
82
87
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
// Expand column size, if needed
|
|
89
|
+
if (renderData.width > columnsWidths[colIndex]) {
|
|
90
|
+
columnsWidths[colIndex] = renderData.width;
|
|
91
|
+
}
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
return renderData;
|
|
94
|
+
}),
|
|
90
95
|
);
|
|
91
96
|
|
|
92
97
|
// Filter out invalid gates
|
|
93
|
-
const
|
|
98
|
+
const filteredArray: GateRenderData[][] = renderDataArray
|
|
94
99
|
.map((col) => col.filter(({ type }) => type != GateType.Invalid))
|
|
95
100
|
.filter((col) => col.length > 0);
|
|
96
101
|
|
|
97
102
|
// Fill in x coord of each gate
|
|
98
|
-
const endX: number =
|
|
103
|
+
const endX: number = _fillRenderDataX(filteredArray, columnsWidths);
|
|
99
104
|
|
|
100
|
-
return {
|
|
105
|
+
return { renderDataArray: filteredArray, svgWidth: endX };
|
|
101
106
|
};
|
|
102
107
|
|
|
103
108
|
/**
|
|
@@ -125,19 +130,19 @@ const _getClassicalRegStart = (
|
|
|
125
130
|
};
|
|
126
131
|
|
|
127
132
|
/**
|
|
128
|
-
* Maps operation to
|
|
133
|
+
* Maps operation to render data (e.g. gate type, position, dimensions, text)
|
|
129
134
|
* required to render the image.
|
|
130
135
|
*
|
|
131
|
-
* @param op Operation to be mapped into
|
|
136
|
+
* @param op Operation to be mapped into render data.
|
|
132
137
|
* @param registers Array of registers.
|
|
133
138
|
*
|
|
134
|
-
* @returns
|
|
139
|
+
* @returns GateRenderData representation of given operation.
|
|
135
140
|
*/
|
|
136
|
-
const
|
|
141
|
+
const _opToRenderData = (
|
|
137
142
|
op: Operation | null,
|
|
138
143
|
registers: RegisterMap,
|
|
139
|
-
):
|
|
140
|
-
const
|
|
144
|
+
): GateRenderData => {
|
|
145
|
+
const renderData: GateRenderData = {
|
|
141
146
|
type: GateType.Invalid,
|
|
142
147
|
x: 0,
|
|
143
148
|
controlsY: [],
|
|
@@ -146,7 +151,7 @@ const _opToMetadata = (
|
|
|
146
151
|
width: -1,
|
|
147
152
|
};
|
|
148
153
|
|
|
149
|
-
if (op == null) return
|
|
154
|
+
if (op == null) return renderData;
|
|
150
155
|
|
|
151
156
|
let isAdjoint: boolean;
|
|
152
157
|
let controls: Register[] | undefined;
|
|
@@ -179,8 +184,8 @@ const _opToMetadata = (
|
|
|
179
184
|
} = op;
|
|
180
185
|
|
|
181
186
|
// Set y coords
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
renderData.controlsY = controls?.map((reg) => _getRegY(reg, registers)) || [];
|
|
188
|
+
renderData.targetsY = targets.map((reg) => _getRegY(reg, registers));
|
|
184
189
|
|
|
185
190
|
if (isConditional) {
|
|
186
191
|
// Classically-controlled operations
|
|
@@ -198,7 +203,7 @@ const _opToMetadata = (
|
|
|
198
203
|
}))
|
|
199
204
|
.filter((col) => col.components.length > 0);
|
|
200
205
|
let childrenInstrs = processOperations(onZeroOps, registers);
|
|
201
|
-
const zeroGates:
|
|
206
|
+
const zeroGates: GateRenderData[][] = childrenInstrs.renderDataArray;
|
|
202
207
|
const zeroChildWidth: number = childrenInstrs.svgWidth;
|
|
203
208
|
|
|
204
209
|
// Gates to display when classical bit is 1.
|
|
@@ -210,77 +215,80 @@ const _opToMetadata = (
|
|
|
210
215
|
}))
|
|
211
216
|
.filter((col) => col.components.length > 0);
|
|
212
217
|
childrenInstrs = processOperations(onOneOps, registers);
|
|
213
|
-
const oneGates:
|
|
218
|
+
const oneGates: GateRenderData[][] = childrenInstrs.renderDataArray;
|
|
214
219
|
const oneChildWidth: number = childrenInstrs.svgWidth;
|
|
215
220
|
|
|
216
221
|
// Subtract startX (left-side) and 2*gatePadding (right-side) from nested child gates width
|
|
217
222
|
const width: number =
|
|
218
223
|
Math.max(zeroChildWidth, oneChildWidth) - startX - gatePadding * 2;
|
|
219
224
|
|
|
220
|
-
|
|
221
|
-
|
|
225
|
+
renderData.type = GateType.ClassicalControlled;
|
|
226
|
+
renderData.children = [zeroGates, oneGates];
|
|
222
227
|
// Add additional width from control button and inner box padding for dashed box
|
|
223
|
-
|
|
228
|
+
renderData.width = width + controlBtnOffset + groupBoxPadding * 2;
|
|
224
229
|
|
|
225
230
|
// Set targets to first and last quantum registers so we can render the surrounding box
|
|
226
231
|
// around all quantum registers.
|
|
227
232
|
const qubitsY: number[] = Object.values(registers).map(({ y }) => y);
|
|
228
233
|
if (qubitsY.length > 0)
|
|
229
|
-
|
|
234
|
+
renderData.targetsY = [Math.min(...qubitsY), Math.max(...qubitsY)];
|
|
230
235
|
} else if (
|
|
231
236
|
conditionalRender == ConditionalRender.AsGroup &&
|
|
232
237
|
(children?.length || 0) > 0
|
|
233
238
|
) {
|
|
234
239
|
const childrenInstrs = processOperations(children!, registers);
|
|
235
|
-
|
|
236
|
-
|
|
240
|
+
renderData.type = GateType.Group;
|
|
241
|
+
renderData.children = childrenInstrs.renderDataArray;
|
|
237
242
|
// _zoomButton function in gateFormatter.ts relies on
|
|
238
243
|
// 'expanded' attribute to render zoom button
|
|
239
|
-
|
|
244
|
+
renderData.dataAttributes = { expanded: "true" };
|
|
240
245
|
// Subtract startX (left-side) and add inner box padding (minus nested gate padding) for dashed box
|
|
241
|
-
|
|
246
|
+
renderData.width =
|
|
242
247
|
childrenInstrs.svgWidth - startX + (groupBoxPadding - gatePadding) * 2;
|
|
243
248
|
} else if (op.kind === "measurement") {
|
|
244
|
-
|
|
249
|
+
renderData.type = GateType.Measure;
|
|
245
250
|
} else if (op.kind === "ket") {
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
renderData.type = GateType.Ket;
|
|
252
|
+
renderData.label = gate;
|
|
248
253
|
} else if (gate === "SWAP") {
|
|
249
|
-
|
|
254
|
+
renderData.type = GateType.Swap;
|
|
250
255
|
} else if (controls && controls.length > 0) {
|
|
251
|
-
|
|
252
|
-
|
|
256
|
+
renderData.type = gate === "X" ? GateType.Cnot : GateType.ControlledUnitary;
|
|
257
|
+
renderData.label = gate;
|
|
253
258
|
} else if (gate === "X") {
|
|
254
|
-
|
|
255
|
-
|
|
259
|
+
renderData.type = GateType.X;
|
|
260
|
+
renderData.label = gate;
|
|
256
261
|
} else {
|
|
257
262
|
// Any other gate treated as a simple unitary gate
|
|
258
|
-
|
|
259
|
-
|
|
263
|
+
renderData.type = GateType.Unitary;
|
|
264
|
+
renderData.label = gate;
|
|
260
265
|
}
|
|
261
266
|
|
|
262
267
|
// If adjoint, add ' to the end of gate label
|
|
263
|
-
if (isAdjoint &&
|
|
268
|
+
if (isAdjoint && renderData.label.length > 0) renderData.label += "'";
|
|
264
269
|
|
|
265
270
|
// If gate has extra arguments, display them
|
|
266
271
|
// For now, we only display the first argument
|
|
267
|
-
if (args !== undefined && args.length > 0)
|
|
272
|
+
if (args !== undefined && args.length > 0) renderData.displayArgs = args[0];
|
|
268
273
|
|
|
269
274
|
// Set gate width
|
|
270
|
-
|
|
275
|
+
renderData.width = getGateWidth(renderData);
|
|
271
276
|
|
|
272
277
|
// Extend existing data attributes with user-provided data attributes
|
|
273
278
|
if (dataAttributes != null)
|
|
274
|
-
|
|
279
|
+
renderData.dataAttributes = {
|
|
280
|
+
...renderData.dataAttributes,
|
|
281
|
+
...dataAttributes,
|
|
282
|
+
};
|
|
275
283
|
|
|
276
|
-
return
|
|
284
|
+
return renderData;
|
|
277
285
|
};
|
|
278
286
|
|
|
279
287
|
/**
|
|
280
288
|
* Compute the y coord of a given register.
|
|
281
289
|
*
|
|
282
290
|
* @param reg Register to compute y coord of.
|
|
283
|
-
* @param registers Map of qubit IDs to
|
|
291
|
+
* @param registers Map of qubit IDs to RegisterRenderData.
|
|
284
292
|
*
|
|
285
293
|
* @returns The y coord of give register.
|
|
286
294
|
*/
|
|
@@ -309,7 +317,7 @@ const _getRegY = (reg: Register, registers: RegisterMap): number => {
|
|
|
309
317
|
*
|
|
310
318
|
* @param targets Target qubit registers.
|
|
311
319
|
* @param classicalRegY y coords of classical registers overlapping current column.
|
|
312
|
-
* @param registers Mapping from register qubit IDs to register
|
|
320
|
+
* @param registers Mapping from register qubit IDs to register render data.
|
|
313
321
|
*
|
|
314
322
|
* @returns Groups of target qubit y coords.
|
|
315
323
|
*/
|
|
@@ -368,15 +376,15 @@ const _splitTargetsY = (
|
|
|
368
376
|
};
|
|
369
377
|
|
|
370
378
|
/**
|
|
371
|
-
* Updates the x coord of each
|
|
379
|
+
* Updates the x coord of each render data object in the given 2D array and returns rightmost x coord.
|
|
372
380
|
*
|
|
373
|
-
* @param
|
|
381
|
+
* @param renderDataArray 2D array of render data.
|
|
374
382
|
* @param columnWidths Array of column widths.
|
|
375
383
|
*
|
|
376
384
|
* @returns Rightmost x coord.
|
|
377
385
|
*/
|
|
378
|
-
const
|
|
379
|
-
|
|
386
|
+
const _fillRenderDataX = (
|
|
387
|
+
renderDataArray: GateRenderData[][],
|
|
380
388
|
columnWidths: number[],
|
|
381
389
|
): number => {
|
|
382
390
|
let endX: number = startX;
|
|
@@ -387,29 +395,29 @@ const _fillMetadataX = (
|
|
|
387
395
|
return x;
|
|
388
396
|
});
|
|
389
397
|
|
|
390
|
-
|
|
391
|
-
col.forEach((
|
|
398
|
+
renderDataArray.forEach((col, colIndex) =>
|
|
399
|
+
col.forEach((renderData) => {
|
|
392
400
|
const x = colStartX[colIndex];
|
|
393
|
-
switch (
|
|
401
|
+
switch (renderData.type) {
|
|
394
402
|
case GateType.ClassicalControlled:
|
|
395
403
|
case GateType.Group:
|
|
396
404
|
{
|
|
397
405
|
// Subtract startX offset from nested gates and add offset and padding
|
|
398
406
|
let offset: number = x - startX + groupBoxPadding;
|
|
399
|
-
if (
|
|
407
|
+
if (renderData.type === GateType.ClassicalControlled)
|
|
400
408
|
offset += controlBtnOffset;
|
|
401
409
|
|
|
402
410
|
// Offset each x coord in children gates
|
|
403
|
-
_offsetChildrenX(
|
|
411
|
+
_offsetChildrenX(renderData.children, offset);
|
|
404
412
|
|
|
405
413
|
// We don't use the centre x coord because we only care about the rightmost x for
|
|
406
414
|
// rendering the box around the group of nested gates
|
|
407
|
-
|
|
415
|
+
renderData.x = x;
|
|
408
416
|
}
|
|
409
417
|
break;
|
|
410
418
|
|
|
411
419
|
default:
|
|
412
|
-
|
|
420
|
+
renderData.x = x + columnWidths[colIndex] / 2;
|
|
413
421
|
break;
|
|
414
422
|
}
|
|
415
423
|
}),
|
|
@@ -421,11 +429,11 @@ const _fillMetadataX = (
|
|
|
421
429
|
/**
|
|
422
430
|
* Offset x coords of nested children operations.
|
|
423
431
|
*
|
|
424
|
-
* @param children 2D or 3D array of children
|
|
432
|
+
* @param children 2D or 3D array of children GateRenderData.
|
|
425
433
|
* @param offset x coord offset.
|
|
426
434
|
*/
|
|
427
435
|
const _offsetChildrenX = (
|
|
428
|
-
children:
|
|
436
|
+
children: GateRenderData[][] | GateRenderData[][][] | undefined,
|
|
429
437
|
offset: number,
|
|
430
438
|
): void => {
|
|
431
439
|
if (children == null) return;
|
package/ux/circuit-vis/sqore.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Operation,
|
|
14
14
|
Column,
|
|
15
15
|
} from "./circuit";
|
|
16
|
-
import {
|
|
16
|
+
import { GateRenderData, GateType } from "./gateRenderData";
|
|
17
17
|
import { createUUID } from "./utils";
|
|
18
18
|
import { gateHeight, minGateWidth, minToolboxHeight, svgNS } from "./constants";
|
|
19
19
|
import { createDragzones } from "./draggable";
|
|
@@ -21,7 +21,7 @@ import { enableEvents } from "./events";
|
|
|
21
21
|
import { createPanel } from "./panel";
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Contains
|
|
24
|
+
* Contains render data for visualization.
|
|
25
25
|
*/
|
|
26
26
|
interface ComposedSqore {
|
|
27
27
|
/** Width of visualization. */
|
|
@@ -171,10 +171,13 @@ export class Sqore {
|
|
|
171
171
|
*
|
|
172
172
|
* @param circuit Circuit to be visualized.
|
|
173
173
|
*
|
|
174
|
-
* @returns `ComposedSqore` object containing
|
|
174
|
+
* @returns `ComposedSqore` object containing render data for visualization.
|
|
175
175
|
*/
|
|
176
176
|
private compose(circuit: Circuit): ComposedSqore {
|
|
177
|
-
const add = (
|
|
177
|
+
const add = (
|
|
178
|
+
acc: GateRenderData[],
|
|
179
|
+
gate: GateRenderData | GateRenderData[],
|
|
180
|
+
): void => {
|
|
178
181
|
if (Array.isArray(gate)) {
|
|
179
182
|
gate.forEach((g) => add(acc, g));
|
|
180
183
|
} else {
|
|
@@ -183,20 +186,20 @@ export class Sqore {
|
|
|
183
186
|
}
|
|
184
187
|
};
|
|
185
188
|
|
|
186
|
-
const flatten = (
|
|
187
|
-
const result:
|
|
188
|
-
|
|
189
|
+
const flatten = (renderData: GateRenderData[][]): GateRenderData[] => {
|
|
190
|
+
const result: GateRenderData[] = [];
|
|
191
|
+
renderData.forEach((col) => col.forEach((g) => add(result, g)));
|
|
189
192
|
return result;
|
|
190
193
|
};
|
|
191
194
|
|
|
192
195
|
const { qubits, componentGrid } = circuit;
|
|
193
196
|
const { qubitWires, registers, svgHeight } = formatInputs(qubits);
|
|
194
|
-
const {
|
|
197
|
+
const { renderDataArray, svgWidth } = processOperations(
|
|
195
198
|
componentGrid,
|
|
196
199
|
registers,
|
|
197
200
|
);
|
|
198
|
-
const formattedGates: SVGElement = formatGates(
|
|
199
|
-
const measureGates:
|
|
201
|
+
const formattedGates: SVGElement = formatGates(renderDataArray);
|
|
202
|
+
const measureGates: GateRenderData[] = flatten(renderDataArray).filter(
|
|
200
203
|
({ type }) => type === GateType.Measure,
|
|
201
204
|
);
|
|
202
205
|
const formattedRegs: SVGElement = formatRegisters(
|
|
@@ -468,6 +471,7 @@ export class Sqore {
|
|
|
468
471
|
|
|
469
472
|
// Minimize the circuits in a circuit group to remove dataAttributes
|
|
470
473
|
minimizeCircuits(circuitGroup: CircuitGroup): CircuitGroup {
|
|
474
|
+
// Create a deep copy of the circuit group
|
|
471
475
|
const minimizedCircuits: CircuitGroup = JSON.parse(
|
|
472
476
|
JSON.stringify(circuitGroup),
|
|
473
477
|
);
|
package/ux/circuit-vis/utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { GateRenderData, GateType } from "./gateRenderData";
|
|
5
5
|
import {
|
|
6
6
|
minGateWidth,
|
|
7
7
|
labelPadding,
|
|
@@ -11,6 +11,44 @@ import {
|
|
|
11
11
|
import { ComponentGrid, Operation } from "./circuit";
|
|
12
12
|
import { Register } from "./register";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Performs a deep equality check between two objects or arrays.
|
|
16
|
+
* @param obj1 - The first object or array to compare.
|
|
17
|
+
* @param obj2 - The second object or array to compare.
|
|
18
|
+
* @returns True if the objects are deeply equal, false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
export const deepEqual = (obj1: unknown, obj2: unknown): boolean => {
|
|
21
|
+
if (obj1 === obj2) return true;
|
|
22
|
+
|
|
23
|
+
if (
|
|
24
|
+
obj1 === null ||
|
|
25
|
+
obj2 === null ||
|
|
26
|
+
typeof obj1 !== "object" ||
|
|
27
|
+
typeof obj2 !== "object"
|
|
28
|
+
) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const keys1 = Object.keys(obj1);
|
|
33
|
+
const keys2 = Object.keys(obj2);
|
|
34
|
+
|
|
35
|
+
if (keys1.length !== keys2.length) return false;
|
|
36
|
+
|
|
37
|
+
for (const key of keys1) {
|
|
38
|
+
if (
|
|
39
|
+
!keys2.includes(key) ||
|
|
40
|
+
!deepEqual(
|
|
41
|
+
(obj1 as Record<string, unknown>)[key],
|
|
42
|
+
(obj2 as Record<string, unknown>)[key],
|
|
43
|
+
)
|
|
44
|
+
) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return true;
|
|
50
|
+
};
|
|
51
|
+
|
|
14
52
|
/**
|
|
15
53
|
* Generate a UUID using `Math.random`.
|
|
16
54
|
* Note: this implementation came from https://stackoverflow.com/questions/105034/how-to-create-guid-uuid
|
|
@@ -26,9 +64,9 @@ const createUUID = (): string =>
|
|
|
26
64
|
});
|
|
27
65
|
|
|
28
66
|
/**
|
|
29
|
-
* Calculate the width of a gate, given its
|
|
67
|
+
* Calculate the width of a gate, given its render data.
|
|
30
68
|
*
|
|
31
|
-
* @param
|
|
69
|
+
* @param renderData - The rendering data of the gate, including its type, label, display arguments, and width.
|
|
32
70
|
*
|
|
33
71
|
* @returns Width of given gate (in pixels).
|
|
34
72
|
*/
|
|
@@ -37,7 +75,7 @@ const getGateWidth = ({
|
|
|
37
75
|
label,
|
|
38
76
|
displayArgs,
|
|
39
77
|
width,
|
|
40
|
-
}:
|
|
78
|
+
}: GateRenderData): number => {
|
|
41
79
|
if (width > 0) return width;
|
|
42
80
|
|
|
43
81
|
switch (type) {
|
|
@@ -327,6 +365,19 @@ const getGateElems = (container: HTMLElement): SVGGraphicsElement[] => {
|
|
|
327
365
|
: [];
|
|
328
366
|
};
|
|
329
367
|
|
|
368
|
+
// Non-ASCII chars are fraught with danger. Copy/paste these when possible.
|
|
369
|
+
// Use the following regex in VS Code to find invalid unicode chars
|
|
370
|
+
// [^\x20-\x7e\u{03b8}-\u{03c8}\u{2020}\u{27e8}\u{27e9}]
|
|
371
|
+
|
|
372
|
+
const mathChars = {
|
|
373
|
+
theta: "θ", // \u{03b8}
|
|
374
|
+
pi: "π", // \u{03c0}
|
|
375
|
+
psi: "ψ", // \u{03c8}
|
|
376
|
+
dagger: "†", // \u{2020}
|
|
377
|
+
langle: "⟨", // \u{27e8}
|
|
378
|
+
rangle: "⟩", // \u{27e9}
|
|
379
|
+
};
|
|
380
|
+
|
|
330
381
|
export {
|
|
331
382
|
createUUID,
|
|
332
383
|
getGateWidth,
|
|
@@ -342,4 +393,5 @@ export {
|
|
|
342
393
|
getToolboxElems,
|
|
343
394
|
getHostElems,
|
|
344
395
|
getGateElems,
|
|
396
|
+
mathChars,
|
|
345
397
|
};
|
package/ux/circuit.tsx
CHANGED
|
@@ -270,7 +270,13 @@ export function CircuitPanel(props: CircuitProps) {
|
|
|
270
270
|
)}
|
|
271
271
|
<p>
|
|
272
272
|
Learn more at{" "}
|
|
273
|
-
|
|
273
|
+
{props.isEditable ? (
|
|
274
|
+
<a href="https://aka.ms/qdk.circuit-editor">
|
|
275
|
+
https://aka.ms/qdk.circuit-editor
|
|
276
|
+
</a>
|
|
277
|
+
) : (
|
|
278
|
+
<a href="https://aka.ms/qdk.circuits">https://aka.ms/qdk.circuits</a>
|
|
279
|
+
)}
|
|
274
280
|
</p>
|
|
275
281
|
{props.calculating ? (
|
|
276
282
|
<div>
|