- Timestamp:
- 03/27/17 15:28:48 (8 years ago)
- Location:
- branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4
- Files:
-
- 3 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/HeuristicLab.Algorithms.DataAnalysis-3.4.csproj
r14785 r14787 331 331 <Compile Include="Interfaces\ISupportVectorMachineSolution.cs" /> 332 332 <Compile Include="Interfaces\IDataAnalysisAlgorithm.cs" /> 333 <Compile Include="Interfaces\TSNEInterfaces\ICell.cs" />334 <Compile Include="Interfaces\TSNEInterfaces\IDataPoint.cs" />335 333 <Compile Include="Interfaces\TSNEInterfaces\IDistance.cs" /> 336 334 <Compile Include="Interfaces\TSNEInterfaces\ISpacePartitioningTree.cs" /> … … 418 416 </Compile> 419 417 <Compile Include="TimeSeries\AutoregressiveModeling.cs" /> 420 <Compile Include="TSNE\Cell.cs" />421 418 <Compile Include="TSNE\Distances\DistanceBase.cs" /> 422 419 <Compile Include="TSNE\Distances\EuclideanDistance.cs" /> -
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/SpacePartitioningTree.cs
r14785 r14787 58 58 using System.Linq; 59 59 using HeuristicLab.Common; 60 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;61 60 62 61 namespace HeuristicLab.Algorithms.DataAnalysis { … … 64 63 /// Space partitioning tree (SPTree) 65 64 /// </summary> 66 [StorableClass] 67 public class SpacePartitioningTree : DeepCloneable, ISpacePartitioningTree { 65 public class SpacePartitioningTree : ISpacePartitioningTree { 68 66 private const uint QT_NODE_CAPACITY = 1; 69 67 70 #region properties71 [Storable]72 68 private double[] buff; 73 [Storable]74 69 private SpacePartitioningTree parent; 75 [Storable]76 70 private int dimension; 77 [Storable]78 71 private bool isLeaf; 79 [Storable]80 72 private uint size; 81 [Storable]82 73 private uint cumulativeSize; 83 74 84 75 // Axis-aligned bounding box stored as a center with half-dimensions to represent the boundaries of this quad tree 85 [Storable] 86 private ICell boundary; 76 private Cell boundary; 87 77 88 78 // Indices in this space-partitioning tree node, corresponding center-of-mass, and list of all children 89 [Storable] 90 public double[,] Data { private get; set; } 91 [Storable] 79 public double[,] Data { private get; set; } // TODO public setter, private getter? 80 92 81 private double[] centerOfMass; 93 [Storable] 94 private int[] index = new int[QT_NODE_CAPACITY]; 82 private readonly int[] index = new int[QT_NODE_CAPACITY]; 95 83 96 84 // Children 97 85 private SpacePartitioningTree[] children; 98 [Storable]99 86 private uint noChildren; 100 #endregion101 102 #region HLConstructors & Cloning103 [StorableConstructor]104 protected SpacePartitioningTree(bool deserializing) { }105 protected SpacePartitioningTree(SpacePartitioningTree original, Cloner cloner)106 : base(original, cloner) {107 buff = original.buff.Select(x => x).ToArray();108 parent = cloner.Clone(original.parent);109 dimension = original.dimension;110 isLeaf = original.isLeaf;111 size = original.size;112 cumulativeSize = original.cumulativeSize;113 boundary = cloner.Clone(original.boundary);114 if (original.Data != null) {115 Data = new double[size, dimension];116 Buffer.BlockCopy(original.Data, 0, Data, 0, original.Data.Length * sizeof(double));117 }118 centerOfMass = original.centerOfMass.Select(x => x).ToArray();119 index = original.index.Select(x => x).ToArray();120 children = original.children.Select(cloner.Clone).ToArray();121 noChildren = original.noChildren;122 }123 public override IDeepCloneable Clone(Cloner cloner) { return new SpacePartitioningTree(this, cloner); }124 87 125 88 public SpacePartitioningTree(double[,] inpData) { … … 151 114 Init(parent, inpData, impCorner, impWith); 152 115 } 153 #endregion154 116 155 117 public ISpacePartitioningTree GetParent() { … … 327 289 #endregion 328 290 291 292 private class Cell { 293 private readonly uint dimension; 294 private readonly double[] corner; 295 private readonly double[] width; 296 297 public Cell(uint inpDimension) { 298 dimension = inpDimension; 299 corner = new double[dimension]; 300 width = new double[dimension]; 301 } 302 303 public double GetCorner(int d) { 304 return corner[d]; 305 } 306 public double GetWidth(int d) { 307 return width[d]; 308 } 309 public void SetCorner(int d, double val) { 310 corner[d] = val; 311 } 312 public void SetWidth(int d, double val) { 313 width[d] = val; 314 } 315 public bool ContainsPoint(double[] point) { 316 for (var d = 0; d < dimension; d++) 317 if (corner[d] - width[d] > point[d] || corner[d] + width[d] < point[d]) return false; 318 return true; 319 } 320 } 329 321 } 330 322 } -
branches/TSNE/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/VantagePointTree.cs
r14785 r14787 54 54 #endregion 55 55 56 using System;57 56 using System.Collections.Generic; 58 57 using System.Linq; 59 58 using HeuristicLab.Collections; 60 using HeuristicLab.Common;61 using HeuristicLab.Core;62 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;63 59 using HeuristicLab.Random; 64 60 … … 72 68 /// </summary> 73 69 /// <typeparam name="T"></typeparam> 74 [StorableClass]75 70 public class VantagePointTree<T> : IVantagePointTree<T> { 76 71 #region properties
Note: See TracChangeset
for help on using the changeset viewer.