コード例 #1
0
        public static void TestMultiplication()
        {
            IntervalVector r1 = (IntervalVector)(v1 * v1);
            IntervalVector r2 = new Dictionary <string, Interval>
            {
                { "x", 1.0 },
                { "y", new Interval(4.0, 9.0) },
                { "z", new Interval(9.0, 25.0) }
            };

            Assert.True(r1 == r2);
        }
コード例 #2
0
        public static void TestSubtractionWithImputation()
        {
            IntervalVector r1 = (IntervalVector)v1.SubtractImputeMissingKeys(v2);
            IntervalVector r2 = new Dictionary <string, Interval>
            {
                { "x", 0.0 },
                { "y", v1["y"] },
                { "z", new Interval(5.0, 8.0) }
            };

            Assert.True(r1 == r2);
        }
コード例 #3
0
        public static void TestSubtraction()
        {
            IntervalVector r1 = (IntervalVector)(v1 - v1);
            IntervalVector r2 = new Dictionary <string, Interval>
            {
                { "x", 0.0 },
                { "y", new Interval(-1.0, 1.0) },
                { "z", new Interval(-2.0, 2.0) }
            };

            Assert.True(r1 == r2);
        }
コード例 #4
0
        public static void TestMultiplicationWithImputation()
        {
            IntervalVector r1 = (IntervalVector)v1.MultiplyImputeMissingKeys(v2);
            IntervalVector r2 = new Dictionary <string, Interval>
            {
                { "x", 1.0 },
                { "y", v1["y"] },
                { "z", new Interval(-15.0, -6.0) }
            };

            Assert.True(r1 == r2);
        }
コード例 #5
0
        public static void TestMoveBy()
        {
            IntervalVector r1 = v1
                                .MoveBy(new Dictionary <string, double> {
                { "x", -1.0 }
            })
                                .MoveBy(new Dictionary <string, double> {
                { "z", -3.0 }, { "y", -2.0 }
            });
            IntervalVector r2 = new Dictionary <string, Interval>
            {
                { "x", 0.0 },
                { "y", new Interval(0.0, 1.0) },
                { "z", new Interval(0.0, 2.0) }
            };

            Assert.True(r1 == r2);
        }
コード例 #6
0
        public static void TestConstrain()
        {
            IntervalVector r1 = v1
                                .Constrain(new Dictionary <string, Tuple <double, double> > {
                { "x", Tuple.Create(-1.0, 0.0) }
            })
                                .Constrain(new Dictionary <string, Tuple <double, double> > {
                { "y", Tuple.Create(3.0, 10.0) }
            })
                                .Constrain(new Dictionary <string, Tuple <double, double> > {
                { "z", Tuple.Create(-5.0, 4.0) }
            });
            IntervalVector r2 = new Dictionary <string, Interval>
            {
                { "x", 0.0 },
                { "y", 3.0 },
                { "z", new Interval(3.0, 4.0) }
            };

            Assert.True(r1 == r2);
        }