/// <summary> /// Creates a new vantage-point tree from the given points. /// </summary> /// /// <param name="points">The points to be added to the tree.</param> /// <param name="values">The corresponding values at each data point.</param> /// <param name="distance">The distance function to use.</param> /// <param name="inPlace">Whether to perform operations in place, altering the /// original array of points instead of creating an extra copy.</param> /// /// <returns>A <see cref="VPTree{TPoint, TData}"/> populated with the given data points.</returns> /// public static VPTree <TPoint, TData> FromData(TPoint[] points, TData[] values, IDistance <TPoint> distance, bool inPlace) { var tree = new VPTree <TPoint, TData>(distance); tree.Root = tree.buildFromPoints(points, values, 0, points.Length - 1, inPlace); return(tree); }
/// <summary> /// Creates a new vantage-point tree from the given points. /// </summary> /// /// <param name="points">The points to be added to the tree.</param> /// <param name="distance">The distance function to use.</param> /// <param name="inPlace">Whether to perform operations in place, altering the /// original array of points instead of creating an extra copy.</param> /// /// <returns>A <see cref="VPTree"/> populated with the given data points.</returns> /// public static VPTree FromData(double[][] points, IDistance distance, bool inPlace = false) { var tree = new VPTree(distance); tree.Root = tree.buildFromPoints(points, 0, points.Length, inPlace); return(tree); }
/// <summary> /// Creates a new vantage-point tree from the given points. /// </summary> /// /// <param name="points">The points to be added to the tree.</param> /// <param name="distance">The distance function to use.</param> /// <param name="inPlace">Whether to perform operations in place, altering the /// original array of points instead of creating an extra copy.</param> /// /// <returns>A <see cref="VPTree{TPoint}"/> populated with the given data points.</returns> /// public static VPTree <TPoint> FromData(TPoint[] points, IDistance <TPoint> distance, bool inPlace = false) { var tree = new VPTree <TPoint>(distance); tree.Root = tree.buildFromPoints(points, 0, points.Length, inPlace); return(tree); }
/// <summary> /// Creates a new vantage-point tree from the given points. /// </summary> /// /// <param name="points">The points to be added to the tree.</param> /// <param name="inPlace">Whether to perform operations in place, altering the /// original array of points instead of creating an extra copy.</param> /// /// <returns>A <see cref="VPTree"/> populated with the given data points.</returns> /// public static VPTree <double> FromData(double[] points, bool inPlace = false) { return(VPTree <double> .FromData(points, new Euclidean(), inPlace)); }
/// <summary> /// Creates a new vantage-point tree from the given points. /// </summary> /// /// <typeparam name="TPoint">The type for the position vectors.</typeparam> /// <typeparam name="TData">The type of the value to be stored.</typeparam> /// /// <param name="points">The points to be added to the tree.</param> /// <param name="values">The corresponding values at each data point.</param> /// <param name="distance">The distance function to use.</param> /// <param name="inPlace">Whether to perform operations in place, altering the /// original array of points instead of creating an extra copy.</param> /// /// <returns>A <see cref="VPTree{TPoint, TData}"/> populated with the given data points.</returns> /// public static VPTree <TPoint, TData> FromData <TPoint, TData>(TPoint[] points, TData[] values, IDistance <TPoint> distance, bool inPlace = false) { return(VPTree <TPoint, TData> .FromData(points, values, distance, inPlace)); }
/// <summary> /// Creates a new vantage-point tree from the given points. /// </summary> /// /// <typeparam name="TData">The type of the value to be stored.</typeparam> /// /// <param name="points">The points to be added to the tree.</param> /// <param name="values">The corresponding values at each data point.</param> /// <param name="inPlace">Whether to perform operations in place, altering the /// original array of points instead of creating an extra copy.</param> /// /// <returns>A <see cref="VPTree{TPoint, TData}"/> populated with the given data points.</returns> /// public static VPTree <double[], TData> FromData <TData>(double[][] points, TData[] values, bool inPlace = false) { return(VPTree <double[], TData> .FromData(points, values, new Euclidean(), inPlace)); }