Example #1
0
 public Aggregate(
     CombinationFunction combine,
     params ISetExpressionTerm[] subExpressions)
 {
     mCombine        = combine;
     mSubExpressions = subExpressions;
 }
Example #2
0
 public CustomizableNode(CombinationFunction combinationFunction,
                         ActivationFunction activationFunction,
                         float[] constants)
     : base(constants, activationFunction)
 {
     this.combinationFunction = combinationFunction;
 }
Example #3
0
 public CustomizableNode(CombinationFunction combinationFunction,
                         ActivationFunction activationFunction,
                         float[] constants)
     : base(constants, activationFunction)
 {
     this.combinationFunction = combinationFunction;
 }
Example #4
0
    public void Test()
    {
        var m   = 6;
        var mod = 7;

        var expected = new[]
        {
            new[] { 1, 0, 0, 0, 0, 0, 0, },
            new[] { 1, 1, 0, 0, 0, 0, 0, },
            new[] { 1, 2, 1, 0, 0, 0, 0, },
            new[] { 1, 3, 3, 1, 0, 0, 0, },
            new[] { 1, 4, 6, 4, 1, 0, 0, },
            new[] { 1, 5, 3, 3, 5, 1, 0, },
            new[] { 1, 6, 1, 6, 1, 6, 1, },
        };

        var combinationFunction = new CombinationFunction(m, mod);

        Enumerable.Range(0, m + 1)
        .Select(n =>
                Enumerable.Range(0, m + 1)
                .Select(k => (int)combinationFunction.Combination(n, k))
                .ToArray()
                )
        .IsSeq(expected);
    }
Example #5
0
        public WorleyNoise(int seed, float jitter, DistanceFunction distanceFunc = DistanceFunction.Euclidean, CombinationFunction combinationFunc = CombinationFunction.D1_D0)
        {
            Jitter      = jitter;
            Distance    = distanceFunc;
            Combination = combinationFunc;

            Perm = new NoiseUtil.PermutationTable(1024, 255, seed);
        }
Example #6
0
        public void getCombinationFunctionTest()
        {
            string func = "sumation";
            CombinationFunction expected = CombinationFunctions.sumation;
            CombinationFunction actual;

            actual = StandLibFactory.getCombinationFunction(func);
            Assert.AreEqual(expected, actual);
        }
Example #7
0
        public Node()
        {
            outConnections  = new List<Connection>();
            inConnections = new List<Connection>();
            inValues = new List<double>();
            inWeights = new List<double>();

            activate = Activation.SigmoidActivation.evaluate;
            combine = Combination.Summation.evaluate;
            fired = false;
            bias = false;
        }
Example #8
0
    IEnumerable <long> Solve()
    {
        yield return(n);

        var combination = new CombinationFunction(n, Mod);

        // ?? n+1 ???? n ?????1??????????????
        // ????1?????2??????
        // ??????????3? (P, Q, R) ????????????? p, q, r ????
        var p = default(int);
        var q = default(int);
        var r = default(int);

        {
            // ?? i ? ys[i] ???????????
            var ys = Enumerable.Repeat(-1, n + 2).ToArray();
            for (var i = 0; i <= n; i++)
            {
                var j = ys[xs[i]];
                if (j == -1)
                {
                    ys[xs[i]] = i;
                }
                else
                {
                    p = j;
                    q = i - j - 1;
                    r = (n + 1) - i - 1;
                    break;
                }
            }
        }

        for (var k = 2; k <= n; k++)
        {
            // ????????????????
            // PQR
            var c = 0L;

            c = combination.Invoke(p + q + r, k);
            // ???????1???????????
            // P1QR + PQ1R - P1R
            c = (c + combination.Invoke(p + q + r, k - 1)) % Mod;
            c = (c + combination.Invoke(p + q + r, k - 1)) % Mod;
            c = (((c - combination.Invoke(p + r, k - 1)) % Mod) + Mod) % Mod;
            // ???????2?????????
            // P1Q1R
            c = (c + combination.Invoke(p + q + r, k - 2)) % Mod;
            yield return(c);
        }

        yield return(1);
    }
Example #9
0
 public static IEnumerable <Tuple <T, T, T> > CombinationsWithReplacementsTernary <T>(this IEnumerable <T> iterable)
 {
     return(CombinationFunction.CombinationsWithReplacementsTernary(iterable));
 }
Example #10
0
 public static IEnumerable <Tuple <T, T, T, T, T> > CombinationsQuinary <T>(this IEnumerable <T> iterable)
 {
     return(CombinationFunction.CombinationsQuinary(iterable));
 }