Java Matrix Clone cloneMatrix(int[][] m)

Here you can find the source of cloneMatrix(int[][] m)

Description

clone Matrix

License

Apache License

Declaration

public static int[][] cloneMatrix(int[][] m) 

Method Source Code

//package com.java2s;
/**/*from  www . j  av a 2s. co  m*/
 * 
 *    Copyright 2017 Florian Erhard
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * 
 */

public class Main {
    public static int[][] cloneMatrix(int[][] m) {
        int[][] re = new int[m.length][];
        for (int i = 0; i < re.length; i++)
            re[i] = m[i].clone();
        return re;
    }

    public static double[][] cloneMatrix(double[][] m) {
        double[][] re = new double[m.length][];
        for (int i = 0; i < re.length; i++)
            re[i] = m[i].clone();
        return re;
    }
}

Related

  1. cloneMatrix(final double[][] matrix)
  2. cloneMatrix(final double[][] src, int l1, int l2)
  3. cloneMatrix(float[] in)
  4. cloneMatrix(int[][] matrix)