public void Substract_RestulVectorIsCorrect() { Vector vector = new Vector(new double[] { 1.0, 2.0, 3.0 }); Vector vector2 = new Vector(new double[] { 2.0, 4.0, 6.0 }); vector.Subtract(vector2); Assert.AreEqual(vector.Values[0], -1.0); Assert.AreEqual(vector.Values[1], -2.0); Assert.AreEqual(vector.Values[2], -3.0); }
public List<Vector> GetScatterVectors() { List<Vector> scatterVectors = new List<Vector>(clustersX.Count - 1); Vector C = this.GetCFromClustersX(); foreach (var item in clustersX) { Vector newScatter = new Vector(item.Mean.Values.ToArray()); newScatter.Subtract(C); scatterVectors.Add(newScatter); } // delete one vectore, we need q-1 int i = 0; int index = 0; int minCount = int.MaxValue; foreach (var item in clustersX) { if (item.Items.Count < minCount) { index = i; minCount = item.Items.Count; } i++; } //removing vector scatterVectors.RemoveAt(index); return scatterVectors; }