public void JoinPipeline() { using (var p = Pipeline.Create("JoinPipeline")) { // create a generator that will produce a finite sequence var generator = Generators.Sequence(p, new[] { 0d, 1d }, x => new[] { x[0] + 0.1, x[1] + 0.1 }, count: 10); // instantiate our sample component var multiply = new ScalarMultiplier(p, 10); var divide = new ScalarMultiplier(p, 0.1); // create a pipeline of the form: // generator -> multiply \ // -> join -> add -> WriteLine // generator -> divide / generator.PipeTo(multiply); generator.PipeTo(divide); multiply .Join(divide, TimeSpan.Zero) .Select(t => new[] { t.Item1[0] + t.Item2[0], t.Item1[1] + t.Item2[1] }) .Do(a => Console.WriteLine($"[{a[0]}, {a[1]}]")); // start and run the pipeline p.Run(); } }
public void SimplePipeline() { using (var p = Pipeline.Create("SimplePipeline")) { var generate = Generators.Sequence(p, new[] { 0d, 1d }, x => new[] { x[0] + 0.1, x[1] + 0.1 }, 10); var transform = new ScalarMultiplier(p, 100); generate.PipeTo(transform); transform.Do(a => Console.WriteLine($"[{a[0]}, {a[1]}]")); // start and run the pipeline p.Run(); } }