void DenseGenMatrix::atPutSubmatrix( int destRow, int destCol, DoubleMatrix & Mat, int srcRow, int srcCol, int rowExtent, int colExtent ) { int m = mStorage->m, n = mStorage->n; double ** M = mStorage->M; assert( destRow >= 0 && destRow + rowExtent <= m ); assert( destCol >= 0 && destCol + colExtent <= n ); // If assertions are turned off, clip to the actual size of this matrix destRow = ( destRow >= 0 ) ? destRow : 0; destCol = ( destCol >= 0 ) ? destCol : 0; rowExtent = ( destRow + rowExtent <= m ) ? rowExtent : m - destRow; colExtent = ( destCol + colExtent <= n ) ? colExtent : n - destCol; Mat.fromGetDense( srcRow, srcCol, &M[destRow][destCol], n, rowExtent, colExtent ); }
void DenseSymMatrix::symAtPutSubmatrix( int destRow, int destCol, DoubleMatrix& Mat, int srcRow, int srcCol, int rowExtent, int colExtent, int forceSymUpdate) { if(forceSymUpdate==0) { symAtPutSubmatrix(destRow, destCol, Mat, srcRow, srcCol, rowExtent, colExtent); return; } int m = mStorage->m, n = mStorage->n; double ** M = mStorage->M; assert( destRow >= 0 && destRow + rowExtent <= m ); assert( destCol >= 0 && destCol + colExtent <= n ); // If assertions are turned off, clip to the actual size of this matrix destRow = ( destRow >= 0 ) ? destRow : 0; destCol = ( destCol >= 0 ) ? destCol : 0; rowExtent = ( destRow + rowExtent <= m ) ? rowExtent : m - destRow; colExtent = ( destCol + colExtent <= n ) ? colExtent : n - destCol; Mat.fromGetDense( srcRow, srcCol, &M[destRow][destCol], n, rowExtent, colExtent ); //!exec for(int i=destRow; i<destRow + rowExtent; i++) { for(int j=destCol; j<destCol + colExtent; j++) { M[j][i] = M[i][j]; } } }