/// <summary> /// A shell for simple Apply tests. /// </summary> internal static void applyTestShell <I, O>(SimulatorBase sim, ICallable <I, O> operation, Action <Qubit> test) { var allocate = sim.Get <Intrinsic.Allocate>(); var release = sim.Get <Intrinsic.Release>(); var qbits = allocate.Apply(1); var q = qbits[0]; operation.Apply(q); // this is ok. test(q); operation.Apply(q); // still ok. release.Apply(qbits); }
public static TraceImpl <T> GetTracer <T>(this SimulatorBase s) { return(s.Get <GenericCallable>(typeof(Tests.Circuits.Generics.Trace <>)).FindCallable(typeof(T), typeof(QVoid)) as TraceImpl <T>); }
/// <summary> /// This method is a wrapper to let the tests keep using a one Type parameter /// method to fetch for Gates. /// </summary> public static T Get <T>(this SimulatorBase sim) where T : AbstractCallable { return(sim.Get <T, T>()); }