Example #1
0
        public void TestMethod6()
        {
            var a = new[, ] {
                { 5, 0, 0 }, { 0, 4.9, 0 }, { 0, 0, 3 }
            };
            var b = new[] { 0, 1, 0 };

            MaxSdResult s;

            MaxSd.Method(a, out s);
            var c = s.SobstvVector;

            Assert.IsTrue(Enumerable.Range(0, b.Length).Any(i => Math.Abs(c[i] - b[i]) < 0.1));
        }
Example #2
0
        public void TestMethod5()
        {
            var a = new[, ] {
                { 5, 0, 0 }, { 0, 4.9, 0 }, { 0, 0, 3 }
            };
            var b = 4.9;

            MaxSdResult s;

            MaxSd.Method(a, out s);
            var c = s.SobstvMax;

            Assert.IsTrue(Math.Abs(c - b) < 0.1);
        }
Example #3
0
        public void TestMethod1()
        {
            var a = new[, ] {
                { 1.7, 0.8, 0.9 }, { 0.8, 0.7, 0.3 }, { 0.9, 0.3, 1.7 }
            };
            var b = 2.88474;

            MaxSdResult s;

            MaxSd.Method(a, out s);
            var c = s.SobstvMax;

            Assert.IsTrue(Math.Abs(c - b) < 0.1);
        }
Example #4
0
        public void TestMethod4()
        {
            var a = new[, ] {
                { 1.0, 0, 0 }, { 0, 3, 0 }, { 0, 0, 2 }
            };
            var b = 2;

            MaxSdResult s;

            MaxSd.Method(a, out s);
            var c = s.Sobstv2;

            Assert.IsTrue(Math.Abs(c - b) < 0.1);
        }
Example #5
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            label3.Text = string.Empty;
            double[,] m = null;
            try {
                m = LeftParser(textBox1.Text);
            }
            catch (Exception ex) {
                label3.Text = ex.ToString();
            }
            MaxSdResult s = new MaxSdResult();

            try {
                label2.Text = MaxSd.Method(m, out s).ToString(CultureInfo.InvariantCulture);
            }
            catch (Exception ex) {
                label3.Text += Environment.NewLine + ex;
            }

            label1.Text = ResultToText(s);
        }