'Returns B appended after A (column-wise augmenting)::
[A B]
Examples
>>> from sympy import SparseMatrix, Matrix
>>> A = SparseMatrix(((1, 0, 1), (0, 1, 0), (1, 1, 0)))
>>> A
Matrix([
[1, 0, 1],
[0, 1, 0],
[1, 1, 0]])
>>> B = SparseMatrix(((1, 0, 0), (0, 1, 0), (0, 0, 1)))
>>> B
Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
>>> C = A.row_join(B); C
Matrix([
[1, 0, 1, 1, 0, 0],
[0, 1, 0, 0, 1, 0],
[1, 1, 0, 0, 0, 1]])
>>> C == A.row_join(Matrix(B))
True
Joining at row ends is the same as appending columns at the end
of the matrix:
>>> C == A.col_insert(A.cols, B)
True'

def row_join(self, other):

    if ((self.cols == 0) and (self.rows != other.rows)):
        return self._new(other.rows, 0, []).row_join(other)
    (A, B) = (self, other)
    if (not (A.rows == B.rows)):
        raise ShapeError()
    A = A.copy()
    if (not isinstance(B, SparseMatrix)):
        k = 0
        b = B._mat
        for i in range(B.rows):
            for j in range(B.cols):
                v = b[k]
                if v:
                    A._smat[(i, (j + A.cols))] = v
                k += 1
    else:
        for ((i, j), v) in B._smat.items():
            A._smat[(i, (j + A.cols))] = v
    A.cols += B.cols
    return A
