public void Aggregate_Matrix4x4_Multiply_Test()
        {
            using (var matrices = new NativeArray <Matrix4x4>(1024, Allocator.Persistent))
            {
                InitializeMatrixArray(matrices);
                var identity = Matrix4x4.identity;
                sw.Start();
                for (var i = 0; i < Count; i++)
                {
                    identity = matrices.Aggregate <Matrix4x4>(identity, (accumulate, seed) => accumulate * seed);
                }
                Debug.Log(sw.Stop().ToString());

                sw.Start();
                for (var i = 0; i < Count; i++)
                {
                    matrices.Aggregate <Matrix4x4, Multiply>(ref identity, default);
                }
                Debug.Log(sw.Stop().ToString());

                identity = Matrix4x4.identity;
                sw.Start();
                for (var i = 0; i < Count; i++)
                {
                    identity = LE.Aggregate(matrices, identity, (accumulate, seed) => accumulate * seed);
                }
                Debug.Log(sw.Stop().ToString());
            }
        }
Exemplo n.º 2
0
        public string ExpressionText(ExpressionType type)
        {
            var text = "(\n";

            int i = 0;

            List <Exception> validationExceptions = new List <Exception>();

            foreach (var expression in NestedExpressions)
            {
                try
                {
                    i++;
                    text += expression.ExpressionText(type) +
                            (i < NestedExpressions.Count ? " " + GroupMenuButton.Content : "") + "\n";
                }
                catch (InvalidQueryExpressionException e)
                {
                    validationExceptions.Add(e);
                }
            }

            if (validationExceptions.Any())
            {
                string message = Enumerable.Aggregate(validationExceptions, string.Empty, (current, exeption) => current + $"{exeption.Message}\n");

                throw new InvalidQueryExpressionException(message);
            }

            return(text + ")");
        }
Exemplo n.º 3
0
        public static ulong HashX65599(this string input)
        {
            if (string.IsNullOrEmpty(input) == true)
            {
                return(0);
            }

            return(Enumerable.Aggregate <char, ulong>(input, 0, (current, t) => (current * 65599) ^ t));
        }
Exemplo n.º 4
0
        public override string ToString()
        {
            string s = string.Concat(new string(' ', 2), Name);

            return(Enumerable.Aggregate(Questions, s, (current, question) => string.Concat(current, Environment.NewLine, question)));
        }