Here you can find the source of copyMatrixBlock(final double[][] src, int i_src, int j_src, final double[][] dest, int i_dest, int j_dest, int rows, int cols)
Parameter | Description |
---|---|
src | source matrix |
i_src | first row of the source matrix block to copy |
j_src | first column of the source matrix block to copy |
dest | destination matrix |
i_dest | first row of the destination matrix block to be copied to |
j_dest | first column of the destination matrix block to be copied to |
rows | number of rows to copy |
cols | number of columns to copy |
public static void copyMatrixBlock(final double[][] src, int i_src, int j_src, final double[][] dest, int i_dest, int j_dest, int rows, int cols)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from www. j a v a 2 s . c om*/ * Copies a block from one matrix to another * @param src source matrix * @param i_src first row of the source matrix block to copy * @param j_src first column of the source matrix block to copy * @param dest destination matrix * @param i_dest first row of the destination matrix block to be copied to * @param j_dest first column of the destination matrix block to be copied to * @param rows number of rows to copy * @param cols number of columns to copy */ public static void copyMatrixBlock(final double[][] src, int i_src, int j_src, final double[][] dest, int i_dest, int j_dest, int rows, int cols) { assert src != null; assert dest != null; assert src != dest; // TODO do all the other safety checks for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { dest[i_dest + i][j_dest + j] = src[i_src + i][j_src + j]; } } } }