public void PartialRy() { var target = new FreeQubit(0); var op = new QuantumSimulator().Get <Intrinsic.Ry>().Partial((double d) => new ValueTuple <double, Qubit>(d, target)); var args = op.__DataIn__(2.1); var expected = new RuntimeMetadata() { Label = "Ry", FormattedNonQubitArgs = "(" + 2.1 + ")", IsAdjoint = false, IsControlled = false, IsMeasurement = false, IsComposite = false, Children = null, Controls = new List <Qubit>() { }, Targets = new List <Qubit>() { target }, }; Assert.Equal(op.GetRuntimeMetadata(args), expected); }
public void AdjointAdjointH() { Qubit target = new FreeQubit(0); var op = new QuantumSimulator().Get <Intrinsic.H>().Adjoint.Adjoint; var args = op.__DataIn__(target); var expected = new RuntimeMetadata() { Label = "H", FormattedNonQubitArgs = "", IsAdjoint = false, IsControlled = false, IsMeasurement = false, IsComposite = false, Children = null, Controls = new List <Qubit>() { }, Targets = new List <Qubit>() { target }, }; Assert.Equal(op.GetRuntimeMetadata(args), expected); }
public void MResetZ() { var measureQubit = new FreeQubit(0); var op = new QuantumSimulator().Get <Measurement.MResetZ>(); var args = op.__DataIn__(measureQubit); var expected = new RuntimeMetadata() { Label = "MResetZ", FormattedNonQubitArgs = "", IsAdjoint = false, IsControlled = false, IsMeasurement = true, IsComposite = false, Children = null, Controls = new List <Qubit>() { }, Targets = new List <Qubit>() { measureQubit }, }; Assert.Equal(op.GetRuntimeMetadata(args), expected); }
public void ResetAll() { IQArray <Qubit> targets = new QArray <Qubit>(new[] { new FreeQubit(0) }); var op = new QuantumSimulator().Get <Intrinsic.ResetAll>(); var args = op.__DataIn__(targets); var expected = new RuntimeMetadata() { Label = "ResetAll", FormattedNonQubitArgs = "", IsAdjoint = false, IsControlled = false, IsMeasurement = false, IsComposite = true, Children = null, Controls = new List <Qubit>() { }, Targets = targets, }; Assert.Equal(op.GetRuntimeMetadata(args), expected); }
public void NestedOperation() { var op = new QuantumSimulator().Get <Circuits.NestedOp>(); var args = op.__DataIn__(QVoid.Instance); var expected = new RuntimeMetadata() { Label = "NestedOp", FormattedNonQubitArgs = "", IsAdjoint = false, IsControlled = false, IsMeasurement = false, IsComposite = false, Children = null, Controls = new List <Qubit>() { }, Targets = new List <Qubit>() { }, }; Assert.Equal(op.GetRuntimeMetadata(args), expected); }
public void QArrayArgs() { var op = new QuantumSimulator().Get <Circuits.BoolArrayOp>(); IQArray <Boolean> bits = new QArray <Boolean>(new bool[] { false, true }); var args = op.__DataIn__(bits); var expected = new RuntimeMetadata() { Label = "BoolArrayOp", FormattedNonQubitArgs = "[False, True]", IsAdjoint = false, IsControlled = false, IsMeasurement = false, IsComposite = false, Children = null, Controls = new List <Qubit>() { }, Targets = new List <Qubit>() { }, }; Assert.Equal(op.GetRuntimeMetadata(args), expected); }