/** * Set a submatrix. * * @param r Array of row indices. * @param j0 Initial column index * @param j1 Final column index * @param X A(r(:),j0:j1) * @exception ArrayIndexOutOfBoundsException Submatrix indices */ public void setMatrix(int[] r, int j0, int j1, Matrix X) { try { for (int i = 0; i < r.length; i++) { for (int j = j0; j <= j1; j++) { A[r[i]][j] = X.get(i, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
/** * Set a submatrix. * * @param i0 Initial row index * @param i1 Final row index * @param c Array of column indices. * @param X A(i0:i1,c(:)) * @exception ArrayIndexOutOfBoundsException Submatrix indices */ public void setMatrix(int i0, int i1, int[] c, Matrix X) { try { for (int i = i0; i <= i1; i++) { for (int j = 0; j < c.length; j++) { A[i][c[j]] = X.get(i - i0, j); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }
/** * Set a submatrix. * * @param i0 Initial row index * @param i1 Final row index * @param j0 Initial column index * @param j1 Final column index * @param X A(i0:i1,j0:j1) * @exception ArrayIndexOutOfBoundsException Submatrix indices */ public void setMatrix(int i0, int i1, int j0, int j1, Matrix X) { try { for (int i = i0; i <= i1; i++) { for (int j = j0; j <= j1; j++) { A[i][j] = X.get(i - i0, j - j0); } } } catch (ArrayIndexOutOfBoundsException e) { throw new ArrayIndexOutOfBoundsException("Submatrix indices"); } }