Here you can find the source of matrixConcatLR(double[][] LMatrix, double[][] RMatrix)
public static double[][] matrixConcatLR(double[][] LMatrix, double[][] RMatrix)
//package com.java2s; //License from project: Open Source License public class Main { public static double[][] matrixConcatLR(double[][] LMatrix, double[][] RMatrix) { if (LMatrix.length != RMatrix.length) { System.out//from w w w. j av a 2 s. co m .println("matrixConcatLR error: the number of rows in two matrix should be same"); System.exit(0); } int numRows = LMatrix.length; int numColsForLMatrix = LMatrix[0].length; int numColsForRMatrix = RMatrix[0].length; double[][] newMatrix = new double[numRows][numColsForLMatrix + numColsForRMatrix]; for (int row = 0; row < numRows; row++) { for (int col = 0; col < numColsForLMatrix; col++) { newMatrix[row][col] = LMatrix[row][col]; } for (int col = numColsForLMatrix; col < numColsForLMatrix + numColsForRMatrix; col++) { newMatrix[row][col] = RMatrix[row][col - numColsForLMatrix]; } } return newMatrix; } }