Here you can find the source of arrayCopy(double[][] src)
Parameter | Description |
---|---|
src | a parameter |
dest | a parameter |
public static double[][] arrayCopy(double[][] src)
//package com.java2s; /*//from w w w. j a va2 s .c om * Java Information Dynamics Toolkit (JIDT) * Copyright (C) 2012, Joseph T. Lizier * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * Copies all rows and columns between two double arrays * * @param src * @param dest */ public static void arrayCopy(double[][] src, double[][] dest) { for (int r = 0; r < src.length; r++) { System.arraycopy(src[r], 0, dest[r], 0, src[r].length); } } /** * Copies all rows and columns between two double arrays * * @param src * @param dest */ public static double[][] arrayCopy(double[][] src) { double[][] dest = new double[src.length][]; for (int r = 0; r < src.length; r++) { dest[r] = new double[src[r].length]; System.arraycopy(src[r], 0, dest[r], 0, src[r].length); } return dest; } /** * Copies the required rows and columns between two * double arrays * * @param src * @param srcStartRow * @param srcStartCol * @param dest * @param destStartRow * @param destStartCol * @param rows * @param cols */ public static void arrayCopy(double[][] src, int srcStartRow, int srcStartCol, double[][] dest, int destStartRow, int destStartCol, int rows, int cols) { for (int r = 0; r < rows; r++) { System.arraycopy(src[srcStartRow + r], srcStartCol, dest[destStartRow + r], destStartCol, cols); } } /** * Copies all rows and columns between two int arrays * * @param src * @param dest */ public static void arrayCopy(int[][] src, int[][] dest) { for (int r = 0; r < src.length; r++) { System.arraycopy(src[r], 0, dest[r], 0, src[r].length); } } /** * Copies the required rows and columns between two * double arrays * * @param src * @param srcStartRow * @param srcStartCol * @param dest * @param destStartRow * @param destStartCol * @param rows * @param cols */ public static void arrayCopy(int[][] src, int srcStartRow, int srcStartCol, int[][] dest, int destStartRow, int destStartCol, int rows, int cols) { for (int r = 0; r < rows; r++) { System.arraycopy(src[srcStartRow + r], srcStartCol, dest[destStartRow + r], destStartCol, cols); } } }