コード例 #1
0
        public PriorityQueue2(int capacity = 512)
        {
            priorityMath = TypeMath <TPriority> .GetMath();

            maxPriority = priorityMath.Max;
            Initialize(capacity);
        }
コード例 #2
0
        public KdTree(int dimensions)
        {
            this.dimensions = dimensions;
            this.typeMath   = TypeMath <TKey> .GetMath();

            Count = 0;
        }
コード例 #3
0
        public PriorityQueue(int capacity, ITypeMath <TPriority> priorityMath = null)
        {
            if (capacity <= 0)
            {
                throw new ArgumentException("Capacity must be greater than zero");
            }

            this.capacity = capacity;
            queue         = new ItemPriority <TItem, TPriority> [capacity];

            if (priorityMath != null)
            {
                this.priorityMath = priorityMath;
            }
            else
            {
                this.priorityMath = TypeMath <TPriority> .GetMath();
            }
        }
コード例 #4
0
ファイル: HyperRect.cs プロジェクト: phrisk/KdTree
        public static HyperRect <T> Infinite(int dimensions, ITypeMath <T> math = null)
        {
            if (math == null)
            {
                math = TypeMath <T> .GetMath();
            }

            var rect = new HyperRect <T>();

            rect.MinPoint = new T[dimensions];
            rect.MaxPoint = new T[dimensions];

            for (var dimension = 0; dimension < dimensions; dimension++)
            {
                rect.MinPoint[dimension] = math.NegativeInfinity;
                rect.MaxPoint[dimension] = math.PositiveInfinity;
            }

            return(rect);
        }
コード例 #5
0
ファイル: ReverseGeoCode.cs プロジェクト: nabinked/NGeoNames
 static DoubleMath()
 {
     // Make sure we register ourselves!
     TypeMath <double> .Register(new DoubleMath());
 }