コード例 #1
0
        private void RefreshButton_Click(object sender, EventArgs e)
        {
            CVector v = new CVector();
            CMatrix m = new CMatrix();
            int ccnt;
            string szTemp;

            szTemp = CStringUtil.SzForceSquareMatrixFormatDouble(BiasTextBox.Text);
            m.a = CStringUtil.SzMatrixToDouble2DArray(szTemp);
            BiasTextBox.Text = m.ConvertToStringA();
            UdateBiasMatrixModeling();

            // Make matrix m into a square matix
            m.a = CStringUtil.SzMatrixToDouble2DArray(BiasTextBox.Text);

            // Determin minimum nuber of columns
            ccnt = m.ColumnCount;
            if(ccnt < m.RowCount)
                ccnt = m.RowCount;
            v.a = CStringUtil.SzVectorToDoubleArray(ProbTurnVectorTextBox.Text);
            if(m_r.type == DIRECTIONMODELTYPE.VECTOR_DIRBIAS && v.columnCount > ccnt)
                ccnt = v.columnCount;

            while(m.RowCount > ccnt)
                m.DeleteRow(m.RowCount-1);
            while(m.RowCount < ccnt)
                m.AddRow();
            while(m.ColumnCount > ccnt)
                m.DeleteColumn(m.ColumnCount-1);
            while(m.ColumnCount < ccnt)
                m.AddColumn();
            BiasTextBox.Text = m.ConvertToStringA();
            UdateBiasMatrixModeling();



            while(v.columnCount > ccnt)
                v.DeleteColumn(v.columnCount-1);
            while(v.columnCount < ccnt)
                v.AddColumn();
            ProbTurnVectorTextBox.Text = v.ConvertToString();
            UpdateProbTurnVectorModeling();


            RefreshButton.Enabled = false;
            OkButton.Enabled = true;
        }