• Documentation
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API

    Show / Hide Table of Contents
    • Mars.Common
      • GeoHash
      • GeoHashDecoder
      • GeohashDecodeResult
      • GeoHashEncoder
      • GeoHashPrecision
      • Hyperrectangle
      • InputHashHelper
      • PositionHelper
    • Mars.Common.Collections
      • BinaryArrayHeap<T>
      • DoubleBits
      • FibonacciHeap<T, TKey>
      • FibonacciHeapDoubleKey<T>
      • FibonacciHeapNode<T, TKey>
      • FibonacciHeapNodeDoubleKey<T>
      • HeapNode
      • IntervalSize
      • K2DTree<T>
      • K2dTreeNode<T>
      • KdTree
      • KdTree<T>
      • KdTreeBase<TNode>
      • KdTreeNode
      • KdTreeNode<T>
      • KdTreeNodeBase<TNode>
      • KdTreeNodeCollection<TNode>
      • KdTreeNodeList<T>
      • Key
      • Node<T>
      • NodeBase<T>
      • NodeDataContainer<T>
      • NodeDistance<TNode>
      • QuadTree<T>
      • Root<T>
      • TreeDataContainer<T>
    • Mars.Common.Collections.CritBit
      • ICritBitTree<TValue>
    • Mars.Common.Collections.Graph
      • EdgeData
      • GraphData
      • GraphSerializer
      • ISpatialGraph
      • KeyContainer
      • NodeData
      • SpatialGraph
      • SpatialGraphHelper
    • Mars.Common.Collections.Graph.Algorithms
      • AStar
      • CompressedPathDatabase
      • ContractionSearch
      • DepthLimitedTraversal
    • Mars.Common.Collections.Graph.Helper
      • INodeFinder
      • KdTreeNodeFinder
      • RunLengthEncoder
    • Mars.Common.Collections.KNNGraph
      • DefaultRandomGenerator
      • DistanceUtils
      • EventSources
      • EventSources.GraphBuildEventSource
      • EventSources.GraphSearchEventSource
      • IProgressReporter
      • IProvideRandomValues
      • KnnGraph<TItem, TDistance>
      • KnnGraph<TItem, TDistance>.KnnSearchResult
      • KnnGraph<TItem, TDistance>.Parameters
      • Node
      • ReverseComparer<T>
      • ReverseComparerExtensions
      • SelectionKind
      • TravelingCosts<TItem, TDistance>
    • Mars.Common.Compat
      • FormatDecoderAttribute
      • FormatEncoderAttribute
      • FormatHandlerAttribute
      • IntegerAttribute
      • NegativeIntegerAttribute
      • NonnegativeIntegerAttribute
      • NonpositiveIntegerAttribute
      • PositiveIntegerAttribute
    • Mars.Common.Data
      • DomainDataImporter
    • Mars.Common.Data.Providers
      • AscDataProvider
      • GeoJsonFeatureCollectionConverter
      • GeoJsonFeatureConverter
      • GeoJsonHelper
      • GeometryDataProvider
      • GraphMlProvider
      • HttpDataProvider
      • IDataProvider<TInput>
      • JsonFileDataProvider
      • JsonTextDataProvider
      • XmlFileDataProvider
      • XmlTextDataProvider
    • Mars.Common.Exceptions
      • DimensionMismatchException
      • ParseException
    • Mars.Common.IO
      • ExtensionMethods
      • FileClientUtils
      • FileKeys
      • HttpClientUtils
      • ObjectSerialize
      • Serializer
      • SerializerCompression
      • SparseFormat
      • SparseReader
      • SparseWriter
    • Mars.Common.IO.Attributes
      • SerializationBinderAttribute
      • SurrogateSelectorAttribute
    • Mars.Common.IO.Console
      • ChildProgressBar
      • IProgressBar
      • ProgressBar
      • ProgressBarBase
      • ProgressBarHeight
      • ProgressBarOptions
      • ProgressBarSimple
    • Mars.Common.IO.Csv
      • CsvAnalyzer
      • CsvReader
      • CsvReader.RecordEnumerator
      • CsvWriter
      • MissingFieldAction
      • ParseErrorAction
      • ValueTrimmingOptions
    • Mars.Common.IO.Events
      • ParseErrorEventArgs
    • Mars.Common.IO.Exceptions
      • MalformedCsvException
      • MissingFieldCsvException
    • Mars.Common.IO.Mapped
      • Context
      • DefaultArrayFactory
      • Extensions
      • IArrayFactory
      • ISerializableToStream
      • MappedAccessor<T>
      • MemoryMap
      • MemoryMap.CreateAccessorFunc<T>
      • MemoryMap.ReadFromDelegate<T>
      • MemoryMap.WriteToDelegate<T>
      • MemoryMapDelegates
      • MemoryMapDelegates.CreateAccessorFunc<T>
      • MemoryMapStream
    • Mars.Common.IO.Mapped.Accessors
      • MappedAccessorByte
      • MappedAccessorDouble
      • MappedAccessorInt16
      • MappedAccessorInt32
      • MappedAccessorInt64
      • MappedAccessorSingle
      • MappedAccessorUInt16
      • MappedAccessorUInt32
      • MappedAccessorUInt64
      • MappedAccessorVariable<T>
    • Mars.Common.IO.Mapped.Arrays
      • Array<T>
      • ArrayBase<T>
      • ArrayProfile
      • MappedArray<TMapped, T>
      • MappedArray<TMapped, T>.MapFrom
      • MappedArray<TMapped, T>.MapTo
      • MemoryArray<T>
      • VariableArray<T>
    • Mars.Common.IO.Mapped.Collections
      • MemoryBackedDictionary<TKey, TValue>
      • MemoryBackedList<T>
    • Mars.Common.IO.Mapped.Indexes
      • Index<T>
    • Mars.Common.IO.Mapped.Streams
      • CappedStream
    • Mars.Common.Socket
      • ByteOrder
      • CloseEventArgs
      • CloseStatusCode
      • CompressionMethod
      • ErrorEventArgs
      • Ext
      • MessageEventArgs
      • WebSocket
      • WebSocketException
      • WebSocketState
    • Mars.Common.Socket.Server
      • IWebSocketSession
      • WebHeaderCollection
      • WebSocketBehavior
      • WebSocketContext
      • WebSocketServer
      • WebSocketServiceHost
      • WebSocketServiceManager
      • WebSocketSessionManager
    • Mars.Numerics
      • Classes
      • Combinatorics
      • Constants
      • Distance
      • Elementwise
      • Jagged
      • MathematicsException
      • MathHelper
      • Matrix
      • MatrixOrder
      • MatrixType
      • Norm
      • Sort
      • Sorting
      • Sparse
      • Sparse<T>
      • Tools
      • Vector
      • VectorHelper
      • VectorType
    • Mars.Numerics.Comparers
      • ArrayComparer<T>
      • ComparerDirection
      • CustomComparer<T>
      • ElementComparer
      • ElementComparer<T>
      • GeneralComparer
      • StableComparer<T>
    • Mars.Numerics.Distances
      • Angular
      • Chebyshev
      • Cosine
      • Dirac<T>
      • Euclidean
      • Hamming
      • Hamming<T>
      • Haversine
      • Jaccard
      • Jaccard<T>
      • Kulczynski
      • Levenshtein
      • Levenshtein<T>
      • Manhattan
      • Matching
      • Minkowski
      • SquareEuclidean
      • Vincenty
      • Vincenty.Ellipsoid
    • Mars.Numerics.Distances.Base
      • IDistance<T>
      • IDistance<TFirst, TSecond>
      • IMetric<T>
      • ISimilarity<T, TU>
      • ISimilarity<T>
    • Mars.Numerics.Exceptions
      • DimensionMismatchException
      • NonPositiveDefiniteMatrixException
      • SingularMatrixException
    • Mars.Numerics.Formats
      • DefaultMatrixFormatProvider
      • IMatrixFormatProvider
      • MatrixFormatProviderBase
      • MatrixFormatter
      • OctaveMatrixFormatProvider
    • Mars.Numerics.Ranges
      • ByteRange
      • DoubleRange
      • FloatRange
      • IntRange
      • IRange<T>
    • Mars.Numerics.Statistics
      • ConstValueDistribution<T>
      • Distribution<T>
      • FastGaussianDistributionD
      • FastGaussianDistributionF
      • IDistribution
      • UniformDiscreteDistribution
      • UniformDistributionD
      • UniformDistributionF
    • Mars.Numerics.Statistics.Base
      • BinarySearch
      • DistributionBase
      • ISampleableDistribution<TObservations>
      • IUnivariateDistribution
      • IUnivariateDistribution<TObservation>
      • UnivariateDiscreteDistribution

    Class KdTree

    Convenience class for k-dimensional tree static methods. To create a new KdTree, specify the generic parameter as in KdTree<T>.
    Inheritance
    IEnumerable<KdTreeNode>
    Mars.Common.Core.Collections.SimpleTree.BinaryTree<KdTreeNode>
    KdTreeBase<KdTreeNode>
    KdTree
    Inherited Members
    KdTreeBase<KdTreeNode>.Dimensions
    KdTreeBase<KdTreeNode>.Distance
    KdTreeBase<KdTreeNode>.Count
    KdTreeBase<KdTreeNode>.Leaves
    KdTreeBase<KdTreeNode>.Nearest(Position, Double, Int32, Func<KdTreeNode, Boolean>)
    KdTreeBase<KdTreeNode>.Nearest(Double[], Double, Int32, Func<KdTreeNode, Boolean>)
    KdTreeBase<KdTreeNode>.Nearest(Double[], Double, Func<KdTreeNode, Boolean>)
    KdTreeBase<KdTreeNode>.Nearest(Double[], Int32, Func<KdTreeNode, Boolean>)
    KdTreeBase<KdTreeNode>.Nearest(Double[])
    KdTreeBase<KdTreeNode>.Nearest(Double[], Double, Func<KdTreeNode, Boolean>)
    KdTreeBase<KdTreeNode>.Nearest<T1>(Double[], Double, Int32, Func<KdTreeNode, T1, Boolean>, T1)
    KdTreeBase<KdTreeNode>.Nearest<T1, T2>(Double[], Double, Int32, Func<KdTreeNode, T1, T2, Boolean>, T1, T2)
    KdTreeBase<KdTreeNode>.Nearest<T1, T2, T3>(Double[], Double, Int32, Func<KdTreeNode, T1, T2, T3, Boolean>, T1, T2, T3)
    KdTreeBase<KdTreeNode>.ApproximateNearest(Double[], Int32, Double)
    KdTreeBase<KdTreeNode>.ApproximateNearest(Double[], Double, Double)
    KdTreeBase<KdTreeNode>.ApproximateNearest(Double[], Double)
    KdTreeBase<KdTreeNode>.ApproximateNearest(Double[], Int32, Int32)
    KdTreeBase<KdTreeNode>.ApproximateNearest(Double[], Int32)
    KdTreeBase<KdTreeNode>.InsideRegion(Hyperrectangle)
    KdTreeBase<KdTreeNode>.Clear()
    KdTreeBase<KdTreeNode>.CopyTo(KdTreeNode[], Int32)
    KdTreeBase<KdTreeNode>.CreateRoot(Double[][], Boolean, Int32)
    KdTreeBase<KdTreeNode>.AddNode(Double[])
    Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.KdTreeNode>.Root
    Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.KdTreeNode>.GetEnumerator()
    Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.KdTreeNode>.SerializeJson()
    Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.KdTreeNode>.Deserialize(System.String)
    Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.KdTreeNode>.Traverse(Mars.Common.Core.Collections.SimpleTree.BinaryTraversalMethod<Mars.Common.Collections.KdTreeNode>)
    Namespace: Mars.Common.Collections
    Assembly: Mars.Common.dll
    Syntax
    public class KdTree : KdTreeBase<KdTreeNode>
    Remarks
    Please check the documentation page for KdTree<T> for examples, usage and actual remarks about kd-trees.

    Constructors

    KdTree(Int32)

    Creates a new KdTree.
    Declaration
    public KdTree(int dimensions)
    Parameters
    Type Name Description
    System.Int32 dimensions The number of dimensions in the tree.

    KdTree(Int32, KdTreeNode)

    Creates a new KdTree.
    Declaration
    public KdTree(int dimension, KdTreeNode root)
    Parameters
    Type Name Description
    System.Int32 dimension The number of dimensions in the tree.
    KdTreeNode root The root node, if already existent.

    KdTree(Int32, KdTreeNode, Int32, Int32)

    Creates a new KdTree.
    Declaration
    public KdTree(int dimension, KdTreeNode root, int count, int leaves)
    Parameters
    Type Name Description
    System.Int32 dimension The number of dimensions in the tree.
    KdTreeNode root The root node, if already existent.
    System.Int32 count The number of elements in the root node.
    System.Int32 leaves The number of leaves linked through the root node.

    Methods

    Add(Position)

    Adds a new Position to this tree
    Declaration
    public void Add(Position position)
    Parameters
    Type Name Description
    Position position A Position with respective coordinate, geospatial or not

    Add(Double[])

    Adds a new point to this tree.
    Declaration
    public void Add(double[] position)
    Parameters
    Type Name Description
    System.Double[] position A double-vector with the same number of elements as dimensions in the tree.

    FromData(Double[][], IMetric<Double[]>, Boolean)

    Creates a new k-dimensional tree from the given points.
    Declaration
    public static KdTree FromData(double[][] points, IMetric<double[]> distance, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The points to be added to the tree.
    IMetric<System.Double[]> distance The distance function to use.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    KdTree A KdTree<T> populated with the given data points.

    FromData(Double[][], Boolean)

    Creates a new k-dimensional tree from the given points.
    Declaration
    public static KdTree FromData(double[][] points, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The points to be added to the tree.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    KdTree A KdTree<T> populated with the given data points.

    FromData<T>(Double[][], T[], IMetric<Double[]>, Boolean)

    Creates a new k-dimensional tree from the given points.
    Declaration
    public static KdTree<T> FromData<T>(double[][] points, T[] values, IMetric<double[]> distance, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The points to be added to the tree.
    T[] values The corresponding values at each data point.
    IMetric<System.Double[]> distance The distance function to use.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    KdTree<T> A KdTree<T> populated with the given data points.
    Type Parameters
    Name Description
    T The type of the value to be stored.

    FromData<T>(Double[][], T[], Boolean)

    Creates a new k-dimensional tree from the given points.
    Declaration
    public static KdTree<T> FromData<T>(double[][] points, T[] values, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The points to be added to the tree.
    T[] values The corresponding values at each data point.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    KdTree<T> A KdTree<T> populated with the given data points.
    Type Parameters
    Name Description
    T The type of the value to be stored.

    FromData<T>(Double[][], IMetric<Double[]>, Boolean)

    Creates a new k-dimensional tree from the given points.
    Declaration
    public static KdTree<T> FromData<T>(double[][] points, IMetric<double[]> distance, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The points to be added to the tree.
    IMetric<System.Double[]> distance The distance function to use.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    KdTree<T> A KdTree<T> populated with the given data points.
    Type Parameters
    Name Description
    T The type of the value to be stored.

    FromData<T>(Double[][], Boolean)

    Creates a new k-dimensional tree from the given points.
    Declaration
    public static KdTree<T> FromData<T>(double[][] points, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The points to be added to the tree.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    KdTree<T> A KdTree<T> populated with the given data points.
    Type Parameters
    Name Description
    T The type of the value to be stored.

    FromData2D<T>(Double[][], T[], Boolean)

    Creates a new 2-dimensional tree from the given points.
    Declaration
    public static K2DTree<T> FromData2D<T>(double[][] points, T[] values, bool inPlace = false)
    Parameters
    Type Name Description
    System.Double[][] points The 2-dimensional points to be added to the tree.
    T[] values The corresponding values at each data point.
    System.Boolean inPlace Whether the given points vector can be ordered in place. Passing true will change the original order of the vector. If set to false, all operations will be performed on an extra copy of the vector.
    Returns
    Type Description
    K2DTree<T> A K2DTree<T> populated with the given data points.
    Type Parameters
    Name Description
    T The type of the value to be stored.

    Extension Methods

    DomainDataImporter.Import(Object, InputConfiguration)
    ObjectSerialize.Serialize(Object)
    Serializer.Save<T>(T, Stream, SerializerCompression)
    Serializer.Save<T>(T, BinaryFormatter, Stream, SerializerCompression)
    Serializer.Save<T>(T, String)
    Serializer.Save<T>(T, String, SerializerCompression)
    Serializer.Save<T>(T, out Byte[], SerializerCompression)
    Matrix.Replace<T>(T, Object, Object)
    Matrix.IsEqual(Object, Object, Decimal, Decimal)
    Matrix.Concatenate<T>(T, T[])

    See Also

    KdTree<T>
    Back to top Copyright © MARS GROUP.
    HAW Hamburg