Changeset 17418 for branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors
- Timestamp:
- 02/03/20 17:25:38 (5 years ago)
- Location:
- branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors/DoubleVector.cs
r17400 r17418 85 85 86 86 public double Sum() { 87 return values.Sum();87 return Values.Sum(); 88 88 } 89 89 90 90 public double Mean() { 91 return values.Average();91 return Values.Average(); 92 92 } 93 93 94 94 public DoubleVector CumulativeMean() { 95 // todo: zero range average throws exception 95 96 return new DoubleVector( 96 97 Enumerable.Range(0, this.Count) -
branches/3040_VectorBasedGP/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Vectors/Vector.cs
r17367 r17418 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections; 23 24 using System.Collections.Generic; … … 29 30 public abstract class Vector<T> : IVector<T> { 30 31 [Storable] 31 protected readonly List<T> values;32 protected readonly List<T> Values; 32 33 33 34 protected Vector(IEnumerable<T> values) { 34 this. values = values.ToList();35 this.Values = values.ToList(); 35 36 } 36 37 … … 38 39 protected Vector(StorableConstructorFlag _) { } 39 40 41 public override string ToString() { 42 const int maxCount = 10; 43 string extension = Values.Count > maxCount ? ", ..." : ""; 44 return $"[{string.Join(", ", Values.Cast<object>().Take(Math.Min(Values.Count, maxCount)))}{extension}]"; 45 } 40 46 41 47 #region Interface members 42 48 43 49 public int Count { 44 get { return values.Count; }50 get { return Values.Count; } 45 51 } 46 52 47 53 public T this[int index] { 48 get { return values[index]; }54 get { return Values[index]; } 49 55 } 50 56 51 57 public IEnumerator<T> GetEnumerator() { 52 return values.GetEnumerator();58 return Values.GetEnumerator(); 53 59 } 54 60
Note: See TracChangeset
for help on using the changeset viewer.