コード例 #1
0
        private Tuple <int, int> FindMaxInRowsAndColumns(int startRow, int startColumn)
        {
            int rowOfMaxValue = startRow;
            int colOfMaxValue = startColumn;

            dynamic maxValue = Data[startRow, startColumn];

            maxValue = Absolute.GetAbs(maxValue);

            dynamic temp;

            for (int row = startRow; row < RowCount; row++)
            {
                for (int col = startColumn; col < ColumnCount - 1; col++)
                {
                    temp = Data[row, col];
                    temp = Absolute.GetAbs(temp);
                    if (maxValue < temp)
                    {
                        maxValue      = temp;
                        rowOfMaxValue = row;
                        colOfMaxValue = col;
                    }
                }
            }
            return(Tuple.Create(rowOfMaxValue, colOfMaxValue));
        }
コード例 #2
0
        //}

        public GaussMath <T> Difference(GaussMath <T> matrix)
        {
            GaussMath <T> results = Clone(this);

            for (int i = 0; i < RowCount; i++)
            {
                for (int j = 0; j < ColumnCount; j++)
                {
                    results.Data[i, j] = Absolute.GetAbs((dynamic)Data[i, j] - (dynamic)matrix.Data[i, j]);
                }
            }
            return(results);
        }
コード例 #3
0
        private int GetRowToSwap(int startRow, int column)
        {
            dynamic maxValue = Data[startRow, column];

            maxValue = Absolute.GetAbs(maxValue);
            int     rowOfMaxValue = startRow;
            dynamic val;

            for (int row = startRow + 1; row < RowCount; row++)
            {
                val = Data[row, column];
                val = Absolute.GetAbs(val);
                if (val > maxValue)
                {
                    maxValue      = val;
                    rowOfMaxValue = row;
                }
            }
            return(rowOfMaxValue);
        }