Пример #1
0
        /**
         * Sets the value of this matrix to be the same as the value of the provided matrix.  Both
         * matrices must have the same shape:<br>
         * <br>
         * a<sub>ij</sub> = b<sub>ij</sub><br>
         * <br>
         *
         * @param b The matrix that this matrix is to be set equal to.
         */
        public void set(FMatrixD1 b)
        {
            this.reshape(b.numRows, b.numCols);

            int dataLength = b.getNumElements();

            Array.Copy(b.data, 0, this.data, 0, dataLength);
        }
Пример #2
0
 public void set(FMatrixD1 original,
                 int row0, int row1, int col0, int col1)
 {
     this.original = original;
     this.row0     = row0;
     this.col0     = col0;
     this.row1     = row1;
     this.col1     = col1;
 }
Пример #3
0
        /**
         * Creates a new iterator for traversing through a submatrix inside this matrix.  It can be traversed
         * by row or by column.  Range of elements is inclusive, e.g. minRow = 0 and maxRow = 1 will include rows
         * 0 and 1.  The iteration starts at (minRow,minCol) and ends at (maxRow,maxCol)
         *
         * @param a the matrix it is iterating through
         * @param rowMajor true means it will traverse through the submatrix by row first, false by columns.
         * @param minRow first row it will start at.
         * @param minCol first column it will start at.
         * @param maxRow last row it will stop at.
         * @param maxCol last column it will stop at.
         */
        public FMatrixIterator(FMatrixD1 a, bool rowMajor,
                               int minRow, int minCol, int maxRow, int maxCol
                               )
        {
            if (maxCol < minCol)
            {
                throw new ArgumentException("maxCol has to be more than or equal to minCol");
            }
            if (maxRow < minRow)
            {
                throw new ArgumentException("maxRow has to be more than or equal to minCol");
            }
            if (maxCol >= a.numCols)
            {
                throw new ArgumentException("maxCol must be < numCols");
            }
            if (maxRow >= a.numRows)
            {
                throw new ArgumentException("maxRow must be < numCRows");
            }

            this.a        = a;
            this.rowMajor = rowMajor;
            this.minCol   = minCol;
            this.minRow   = minRow;

            size = (maxCol - minCol + 1) * (maxRow - minRow + 1);

            if (rowMajor)
            {
                submatrixStride = maxCol - minCol + 1;
            }
            else
            {
                submatrixStride = maxRow - minRow + 1;
            }
        }
Пример #4
0
 public void set(FMatrixD1 original)
 {
     this.original = original;
     row1          = original.numRows;
     col1          = original.numCols;
 }
Пример #5
0
 public FSubmatrixD1(FMatrixD1 original,
                     int row0, int row1, int col0, int col1)
 {
     set(original, row0, row1, col0, col1);
 }
Пример #6
0
 public FSubmatrixD1(FMatrixD1 original)
 {
     set(original);
 }