public void TestVectorOperations() { VectorOperations.Sub(_a, _b, ref _dest); Assert.AreEqual(-2.0, _dest[0], FloatComparison.DefaultEps); Assert.AreEqual(-2.0, _dest[1], FloatComparison.DefaultEps); VectorOperations.Add(_a, _b, ref _dest); Assert.AreEqual(4.0, _dest[0], FloatComparison.DefaultEps); Assert.AreEqual(6.0, _dest[1], FloatComparison.DefaultEps); VectorOperations.ScalarMul(_a, 2, ref _dest); Assert.AreEqual(2.0, _dest[0], FloatComparison.DefaultEps); Assert.AreEqual(4.0, _dest[1], FloatComparison.DefaultEps); VectorOperations.Copy(_a, ref _dest); Assert.AreEqual(1.0, _dest[0], FloatComparison.DefaultEps); Assert.AreEqual(2.0, _dest[1], FloatComparison.DefaultEps); VectorOperations.Normalize(_a, ref _dest); Assert.AreEqual(0.44721359549995793, _dest[0], FloatComparison.DefaultEps); Assert.AreEqual(0.89442719099991586, _dest[1], FloatComparison.DefaultEps); VectorOperations.Fill(ref _dest, 5.0); Assert.AreEqual(5.0, _dest[0], FloatComparison.DefaultEps); Assert.AreEqual(5.0, _dest[1], FloatComparison.DefaultEps); }
public void TestFill() { Vector a = new Vector(2); VectorOperations.Fill(ref a, 2.0); Assert.AreEqual(2.0, a[0], FloatComparison.DefaultEps); Assert.AreEqual(2.0, a[1], FloatComparison.DefaultEps); }