コード例 #1
0
ファイル: GraphFactory.cs プロジェクト: maalik0786/brightwire
        /// <summary>
        /// Concatenates two wires together into a new wire
        /// </summary>
        /// <param name="input1">First wire to join</param>
        /// <param name="input2">Second wire to join</param>
        /// <param name="name">Optional name to give the node</param>
        /// <returns></returns>
        public WireBuilder Join(WireBuilder input1, WireBuilder input2, string name = null)
        {
            var ret             = new JoinGate(name, input1, input2);
            var wireToPrimary   = new WireToNode(ret);
            var wireToSecondary = new WireToNode(ret, 1);

            input1.LastNode.Output.Add(wireToPrimary);
            input2.LastNode.Output.Add(wireToSecondary);
            return(new WireBuilder(this, input1.CurrentSize + input2.CurrentSize, ret));
        }
コード例 #2
0
        /// <summary>
        /// Concatenates two wires together into a new wire, but reverses the temporal index of the second input to realign with reversed sequences
        /// </summary>
        /// <param name="forwardInput">Forward wire to join</param>
        /// <param name="backwardInput">Backward wire to join</param>
        /// <param name="name">Optional name to give the node</param>
        /// <returns></returns>
        public WireBuilder ReverseTemporalJoin(WireBuilder forwardInput, WireBuilder backwardInput, string name = null)
        {
            var ret             = new ReverseTemporalJoin(name, forwardInput, backwardInput);
            var wireToPrimary   = new WireToNode(ret);
            var wireToSecondary = new WireToNode(ret, 1);

            forwardInput.LastNode.Output.Add(wireToPrimary);
            backwardInput.LastNode.Output.Add(wireToSecondary);

            return(new WireBuilder(this, forwardInput.CurrentSize + backwardInput.CurrentSize, ret));
        }
コード例 #3
0
 /// <summary>
 /// Multiplies the output of two wires into a new wire
 /// </summary>
 /// <param name="input1"></param>
 /// <param name="input2"></param>
 /// <param name="name">Optional name to give the node</param>
 /// <returns></returns>
 public WireBuilder Multiply(WireBuilder input1, WireBuilder input2, string name = null)
 {
     Debug.Assert(input1.CurrentSize == input2.CurrentSize);
     return(Multiply(input1.CurrentSize, input1.LastNode, input2.LastNode, name));
 }