예제 #1
0
        private void btnUcitajB_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Tekstualna datoteka|*.txt";
            ofd.Title  = "Odaberite vektor B";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    b = Matrica.UcitajIzDatoteke(ofd.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Greška!");
                    return;
                }

                if (b.JeLiVektor())
                {
                    txtVektorB.Text = b.ToString();
                    return;
                }
                else
                {
                    MessageBox.Show("Učitana matrica nije vektor!", "Greška");
                    txtVektorB.Text = "";
                }
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Matrica matrica;
            //matrica = Matrica.UcitajIzDatoteke("matrica.txt");

            //textBox1.Text = matrica.ToString();


            //Matrica A = new Matrica(2, 3);
            //A.NapuniMatricu(new double[] {1,2,3, 4,5,6});
            //A *= 2;
            //A.ZapisiUDatoteku("nekaj.txt");
            //txtMatricaA.Text = A.ToString();
            //txtMatricaA.Text += Environment.NewLine + Environment.NewLine;
            //txtMatricaA.Text += (A.Transponiraj()).Transponiraj().ToString();


            A = Matrica.UcitajIzDatoteke("matricaA.txt");
            txtMatricaA.Text = A.ToString();
            b = Matrica.UcitajIzDatoteke("vektorB.txt");
            txtVektorB.Text = b.ToString();
            Matrica permVektor;
            Matrica Adek = A.DekompozicijaLUP(out permVektor);

            MessageBox.Show(Adek.ToString());
            Matrica y_ = Adek.SupstitucijaUnaprijed(b.VratiPermutiraniVektor(permVektor));
            //MessageBox.Show(Adek.ToString());
            Matrica x = Adek.SupstitucijaUnatrag(y_);

            txtVektorX.Text = x.ToString();
        }
예제 #3
0
        private void btnUcitajA_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Tekstualna datoteka|*.txt";
            ofd.Title  = "Odaberite matricu A";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    A = Matrica.UcitajIzDatoteke(ofd.FileName);
                    txtMatricaA.Text = A.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Greška!");
                }
            }
        }