Пример #1
0
        //------------------------------------------------------------------------------------------
        //Проверка размеров матриц
        public static bool IsEqualMatricesSize(
            ComplexMatrix matrixOne,
            ComplexMatrix matrixTwo
            )
        {
            bool equalityRowsCount    = (matrixOne.rowCount == matrixTwo.rowCount);
            bool equalityColumnsCount = (matrixOne.columnCount == matrixTwo.columnCount);
            bool result = equalityRowsCount && equalityColumnsCount;

            return(result);
        }
Пример #2
0
 //-----------------------------------------------------------------------------------------------------
 public static RealMatrix[] GetRealMatrices(ComplexMatrix[] complexMatrices)
 {
     RealMatrix[] realMatrices = new RealMatrix[complexMatrices.Length];
     for (int index = 0; index < complexMatrices.Length; index++)
     {
         ComplexMatrix complexMatrix = complexMatrices[index];
         RealMatrix    realMatrix    = complexMatrix.GetRealMatrix();
         realMatrices[index] = realMatrix;
     }
     return(realMatrices);
 }
Пример #3
0
        //------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------
        //Матрица с размером степени 2
        public ComplexMatrix GetMatrixAtSizePowerOfTwoGreaterCurrentSize()
        {
            int newRowCount    = MathHelper.GetNextHighestPowerOfTwo(this.RowCount);
            int newColumnCount = MathHelper.GetNextHighestPowerOfTwo(this.ColumnCount);

            ComplexMatrix newMatrix     = new ComplexMatrix(newRowCount, newColumnCount);
            int           rowTopLeft    = (newRowCount - this.RowCount) / 2;
            int           columnTopLeft = (newColumnCount - this.ColumnCount) / 2;

            newMatrix.SetSubMatrix(this, rowTopLeft, columnTopLeft);

            return(newMatrix);
        }
Пример #4
0
        //------------------------------------------------------------------------------------------
        //Установка подматрицы
        public void SetSubMatrix(ComplexMatrix matrix, int rowTopLeft, int columnTopLeft)
        {
            bool incorrectParameters =
                this.RowCount < rowTopLeft + matrix.RowCount ||
                this.ColumnCount < columnTopLeft + matrix.ColumnCount;

            if (incorrectParameters)
            {
                throw new MatrixException();
            }
            for (
                int row = rowTopLeft, subMatrixRow = 0; subMatrixRow < matrix.RowCount;
                row++, subMatrixRow++
                )
            {
                for (
                    int column = columnTopLeft, subMatrixColumn = 0; subMatrixColumn < matrix.ColumnCount;
                    column++, subMatrixColumn++
                    )
                {
                    this[row, column] = matrix[subMatrixRow, subMatrixColumn];
                }
            }
        }