public void TestNormalize()
        {
            Vector a       = Vector.Create(1.0, 2.0);
            Vector na      = new Vector(2);
            double old_len = VectorOperations.Normalize(a, ref na);

            Assert.AreEqual((double)Math.Sqrt(5.0), old_len, FloatComparison.DefaultEps);
            double new_len = VectorReductions.L2Norm(na);

            Assert.AreEqual(1.0, new_len, FloatComparison.DefaultEps);
        }
        public void TestBallContainsAll()
        {
            // Ball encapsulating entire region
            IVector diag     = _tree.Root.InternalBounds.Diagonal;
            IVector center   = _tree.Root.InternalBounds.Center;
            double  len_half = VectorReductions.L2Norm(diag) * 0.5;
            Ball    b        = new Ball(center, len_half);

            BoundingVolumeSearch <Vector> s = new BoundingVolumeSearch <Vector>(_tree.Root);
            List <Vector> result            = new List <Vector>(s.FindInsideBoundingVolume(b));

            Assert.AreEqual(7, result.Count);
        }
        public void TestL2Norm()
        {
            Vector a = Vector.Create(1.0, 2.0);

            Assert.IsTrue(FloatComparison.Close(VectorReductions.L2Norm(a), (double)Math.Sqrt(5.0), FloatComparison.DefaultEps));
        }