Java Matrix Copy copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix)

Here you can find the source of copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix)

Description

copy Matrix

License

Open Source License

Declaration

public static double[][] copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix) 

Method Source Code

//package com.java2s;

public class Main {
    public static double[][] copyMatrix(final int rowsCount, final int columnsCount, final double[][] origMatrix) {
        final double[][] copiedMatrix = new double[rowsCount][columnsCount];

        for (int i = 0; i <= rowsCount; i++) {
            copiedMatrix[i] = new double[columnsCount];
            System.arraycopy(origMatrix[i], 0, copiedMatrix[i], 0, columnsCount);
        }/*from w w  w .  jav  a2 s  .c om*/

        return copiedMatrix;
    }
}

Related

  1. copyMatrix(boolean[][] matrix)
  2. copyMatrix(boolean[][] old)
  3. copyMatrix(final double[][] c)
  4. copyMatrix(final double[][] src, final double[][] dest, int n)
  5. copyMatrix(float[] origin, float destination[])
  6. copyMatrixBlock(final double[][] src, int i_src, int j_src, final double[][] dest, int i_dest, int j_dest, int rows, int cols)
  7. copyMatrixEliminateRowAndColumn(double[][] matrix, int rowToEliminate, int colToEliminate)
  8. copyMatrixRow(final float[] m_in, final int m_in_off, final int row, final float[] v_out, final int v_out_off)