src/utils/matrix/AbstractMatrix.java
public Matrix concatenateHorizontal(Matrix other, boolean inplace, boolean concatenateAfter) throws MatrixException {
        if (getRows() != other.getRows()) throw new MatrixException("Merge Horizontal: Incompatible matrix sizes: " + getRows() + "x" + getColumns() + " by " + other.getRows() + "x" + other.getColumns());
        Matrix newMatrix = getNewMatrix(getRows(), getColumns() + other.getColumns());
        int rows = getRows();
        int columns = getColumns();
        int otherColumns = other.getColumns();
        int thisOffsetColumn = concatenateAfter ? 0 : other.getColumns();
        int otherOffsetColumn = concatenateAfter ? getColumns() : 0;
        for (int row = 0; row < rows; row++) {
            for (int column = 0; column < columns; column++) {
                newMatrix.setValue(row, thisOffsetColumn + column, getValue(row, column));
            }
            for (int column = 0; column < otherColumns; column++) {
                newMatrix.setValue(row, otherOffsetColumn + column, other.getValue(row, column));
            }
        }
        if (inplace) copyMatrixData(newMatrix);
        return newMatrix;
    }
/**
     * Concatenates this and other matrix horizontally.
     *
     * @param other matrix to be concatenated to the end of this matrix horizontally.
     * @param inplace if true other matrix is concatenated to this matrix in place.
     * @param concatenateAfter if true data of other matrix is concatenated after this matrix otherwise opposite is true.
     * @return concatenated matrix.
     * @throws MatrixException throws exception if row dimensions of this and other matrix are not matching.
     */
Concatenates this and other matrix horizontally.

@param other matrix to be concatenated to the end of this matrix horizontally.
@param inplace if true other matrix is concatenated to this matrix in place.
@param concatenateAfter if true data of other matrix is concatenated after this matrix otherwise opposite is true.
@return concatenated matrix.
@throws MatrixException throws exception if row dimensions of this and other matrix are not matching.
Concatenates this and other matrix horizontally . @param other matrix to be concatenated to the end of this matrix horizontally . @param inplace if true other matrix is concatenated to this matrix in place . @param concatenateAfter if true data of other matrix is concatenated after this matrix otherwise opposite is true . @return concatenated matrix . @throws MatrixException throws exception if row dimensions of this and other matrix are not matching .
public Matrix concatenateHorizontal(Matrix other, boolean inplace, boolean concatenateAfter) throws MatrixException {
        if (getRows() != other.getRows()) throw new MatrixException("Merge Horizontal: Incompatible matrix sizes: " + getRows() + "x" + getColumns() + " by " + other.getRows() + "x" + other.getColumns());
        Matrix newMatrix = getNewMatrix(getRows(), getColumns() + other.getColumns());
        int rows = getRows();
        int columns = getColumns();
        int otherColumns = other.getColumns();
        int thisOffsetColumn = concatenateAfter ? 0 : other.getColumns();
        int otherOffsetColumn = concatenateAfter ? getColumns() : 0;
        for (int row = 0; row < rows; row++) {
            for (int column = 0; column < columns; column++) {
                newMatrix.setValue(row, thisOffsetColumn + column, getValue(row, column));
            }
            for (int column = 0; column < otherColumns; column++) {
                newMatrix.setValue(row, otherOffsetColumn + column, other.getValue(row, column));
            }
        }
        if (inplace) copyMatrixData(newMatrix);
        return newMatrix;
    }
public Matrix concatenateHorizontal ( Matrix other , boolean inplace , boolean concatenateAfter ) throws MatrixException { if ( getRows ( ) != other . getRows ( ) ) throw new MatrixException ( "Merge Horizontal: Incompatible matrix sizes: " + getRows ( ) + "x" + getColumns ( ) + " by " + other . getRows ( ) + "x" + other . getColumns ( ) ) ; Matrix newMatrix = getNewMatrix ( getRows ( ) , getColumns ( ) + other . getColumns ( ) ) ; int rows = getRows ( ) ; int columns = getColumns ( ) ; int otherColumns = other . getColumns ( ) ; int thisOffsetColumn = concatenateAfter ? 0 : other . getColumns ( ) ; int otherOffsetColumn = concatenateAfter ? getColumns ( ) : 0 ; for ( int row = 0 ; row < rows ; row ++ ) { for ( int column = 0 ; column < columns ; column ++ ) { newMatrix . setValue ( row , thisOffsetColumn + column , getValue ( row , column ) ) ; } for ( int column = 0 ; column < otherColumns ; column ++ ) { newMatrix . setValue ( row , otherOffsetColumn + column , other . getValue ( row , column ) ) ; } } if ( inplace ) copyMatrixData ( newMatrix ) ; return newMatrix ; }
Concatenates this and other matrix horizontally.
Concatenates this and other matrix horizontally .