Java Utililty Methods Matrix Clone

List of utility methods to do Matrix Clone

Description

The list of methods to do Matrix Clone are organized into topic(s).

Method

double[][]cloneMatrix(final double[][] matrix)
clone Matrix
final int m = matrix.length;
int n = matrix[0].length;
final double[][] outMatrix = new double[m][n];
for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
        outMatrix[i][j] = matrix[i][j];
return outMatrix;
double[][]cloneMatrix(final double[][] src, int l1, int l2)
Returns a new matrix exactly like a given matrix.
assert hasShape(src, l1, l2);
final double[][] mat = empty(l1, l2);
copyMatrix(src, mat, l1, l2);
return mat;
float[]cloneMatrix(float[] in)
clone Matrix
return new float[] { 
        in[0], in[1], in[2], in[3], 
        in[4], in[5], in[6], in[7], 
        in[8], in[9], in[10], in[11], 
        in[12], in[13], in[14], in[15] };
int[][]cloneMatrix(int[][] m)
clone Matrix
int[][] re = new int[m.length][];
for (int i = 0; i < re.length; i++)
    re[i] = m[i].clone();
return re;
int[][]cloneMatrix(int[][] matrix)
clone Matrix
int[][] clonedMatrix = new int[matrix.length][];
for (int i = 0; i < matrix.length; i++) {
    clonedMatrix[i] = matrix[i].clone();
return clonedMatrix;