Changeset 14927 for branches/PersistenceReintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/Distances/InnerProductDistance.cs
- Timestamp:
- 05/04/17 17:19:35 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceReintegration/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/Distances/InnerProductDistance.cs
r14767 r14927 25 25 using HeuristicLab.Common; 26 26 using HeuristicLab.Core; 27 using HeuristicLab.Persistence .Default.CompositeSerializers.Storable;27 using HeuristicLab.Persistence; 28 28 29 29 namespace HeuristicLab.Algorithms.DataAnalysis { … … 33 33 /// It is designed for vectors with all positive coordinates. 34 34 /// </summary> 35 [Storable Class]35 [StorableType("8610393e-1a38-4ba3-8f5e-037ebb1de87f")] 36 36 [Item("InnerProductDistance", "The angluar distance as defined as a normalized distance measure dependent on the angle between two vectors.\nIt is designed for vectors with all positive coordinates")] 37 37 public class InnerProductDistance : DistanceBase<IEnumerable<double>> { … … 53 53 var ys = point2.GetEnumerator(); 54 54 var sum = 0.0; 55 while (xs.MoveNext() & ys.MoveNext()) {56 if (xs.Current < 0 || ys.Current < 0) throw new ArgumentException("Inner product distance is only defined for vectors with non-negative elements");55 while (xs.MoveNext() & ys.MoveNext()) { 56 if (xs.Current < 0 || ys.Current < 0) throw new ArgumentException("Inner product distance is only defined for vectors with non-negative elements"); 57 57 sum += xs.Current * ys.Current; 58 58 } 59 if (xs.MoveNext() || ys.MoveNext()) throw new ArgumentException("Enumerables contain a different number of elements");59 if (xs.MoveNext() || ys.MoveNext()) throw new ArgumentException("Enumerables contain a different number of elements"); 60 60 return sum; 61 61 }
Note: See TracChangeset
for help on using the changeset viewer.