Ejemplo n.º 1
0
        public static MatrixOnGaloisField DotMultiplication(MatrixOnGaloisField matrixLeft, MatrixOnGaloisField matrixRight)
        {
            if (matrixLeft.ColumnCount != matrixRight.RowCount)
            {
                throw new DimensionMismatchException("Number of columns in first matrix does not equal number of rows in second matrix.");
            }

            var rowCount    = matrixLeft.RowCount;
            var columnCount = matrixRight.ColumnCount;

            var rawResult = new int[rowCount, columnCount];

            for (int row = 0; row < rowCount; row++)
            {
                for (int col = 0; col < columnCount; col++)
                {
                    int sum = -1;
                    for (int k = 0; k < matrixLeft.ColumnCount; k++)
                    {
                        var product = matrixLeft.GaloisField.MultiplyWords(matrixLeft.Data[row, k], matrixRight.Data[k, col]);
                        sum = matrixLeft.GaloisField.AddWords(sum, product);
                    }
                    rawResult[row, col] = sum;
                }
            }

            var result = new MatrixOnGaloisField(rawResult, matrixLeft.GaloisField);

            return(result);
        }
Ejemplo n.º 2
0
        public MatrixOnGaloisField GetRangeOfColumns(
            RangeInt columnRange)
        {
            var baseResult = GetRangeOfColumns(this, columnRange);
            var result     = new MatrixOnGaloisField(baseResult, GaloisField);

            return(result);
        }
Ejemplo n.º 3
0
        public MatrixOnGaloisField GetRangeOfRows(
            RangeInt rowRange)
        {
            var baseResult = GetRangeOfRows(this, rowRange);
            var result     = new MatrixOnGaloisField(baseResult, GaloisField);

            return(result);
        }
Ejemplo n.º 4
0
        public MatrixOnGaloisField Transpose()
        {
            var rawResult = Transpose(this);

            var result = new MatrixOnGaloisField(rawResult, GaloisField);

            return(result);
        }
Ejemplo n.º 5
0
        public MatrixOnGaloisField SubMatrix(
            RangeInt rowRange,
            RangeInt columnRange)
        {
            var baseResult = SubMatrix(this, rowRange, columnRange);
            var result     = new MatrixOnGaloisField(baseResult, GaloisField);

            return(result);
        }
Ejemplo n.º 6
0
        public static MatrixOnGaloisField Concatenate(
            MatrixOnGaloisField matrixLeft,
            MatrixOnGaloisField matrixRight)
        {
            var baseResult = MatrixBase <int> .Concatenate(matrixLeft, matrixRight);

            var result = new MatrixOnGaloisField(baseResult, matrixLeft.GaloisField);

            return(result);
        }
Ejemplo n.º 7
0
 protected static MatrixOnGaloisField Addition(
     MatrixOnGaloisField matrix,
     int scalar)
 {
     return(new MatrixOnGaloisField(
                ElementWiseOperation(
                    matrix,
                    scalar,
                    (a, b) => matrix.GaloisField.AddWords(a, b)),
                matrix.GaloisField));
 }
Ejemplo n.º 8
0
 protected static MatrixOnGaloisField Addition(
     MatrixOnGaloisField matrixLeft,
     MatrixOnGaloisField matrixRight)
 {
     return(new MatrixOnGaloisField(
                ElementWiseOperation(
                    matrixLeft,
                    matrixRight,
                    (a, b) => matrixLeft.GaloisField.AddWords(a, b)),
                matrixLeft.GaloisField));
 }
Ejemplo n.º 9
0
        public bool Equals(MatrixOnGaloisField other)
        {
            if (RowCount != other.RowCount)
            {
                throw new DimensionMismatchException("The number of rows in this matrix does not equal the number of rows in other matrix");
            }
            if (ColumnCount != other.ColumnCount)
            {
                throw new DimensionMismatchException("The number of columns in this matrix does not equal the number of columns in other matrix");
            }

            for (var row = 0; row < RowCount; row++)
            {
                for (var col = 0; col < ColumnCount; col++)
                {
                    if (this[row, col] != other[row, col])
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 10
0
 public MatrixOnGaloisField(MatrixOnGaloisField matrix) : base(matrix)
 {
     GaloisField = matrix.GaloisField;
 }
Ejemplo n.º 11
0
        public int FindColumn(MatrixOnGaloisField column)
        {
            var result = FindColumn(this, column);

            return(result);
        }
Ejemplo n.º 12
0
        internal int FindRow(MatrixOnGaloisField row)
        {
            var result = FindRow(this, row);

            return(result);
        }
Ejemplo n.º 13
0
        public MatrixOnGaloisField AppendRows(MatrixOnGaloisField rows)
        {
            var baseResult = AppendRows(this, rows);

            return(new MatrixOnGaloisField(baseResult, GaloisField));
        }