Ejemplo n.º 1
0
        public void Replace_ShouldSucceed()
        {
            var A = new VectorXD(new double[] { 1, 3, -1, 0, double.PositiveInfinity, -1 }).ToSparse();

            A.Replace(x => x == -1 ? 0.0 : x);
            Assert.Equal(0, A.Get(2));
            Assert.Equal(0, A.Get(5));
            A.Replace(x => double.IsInfinity(x) ? 0.0 : x);
            Assert.Equal(0, A.Get(4));
        }
Ejemplo n.º 2
0
        public void Replace_ShouldSucceed()
        {
            var A = new VectorXD(new double[] { 1, 3, double.NaN, 0, double.PositiveInfinity, double.NaN });

            A.Replace(x => double.IsNaN(x) ? 0.0 : x);
            Assert.Equal(0, A.Get(2));
            Assert.Equal(0, A.Get(5));
            A.Replace(x => double.IsInfinity(x) ? 0.0 : x);
            Assert.Equal(0, A.Get(4));
        }