'Returns B augmented beneath A (row-wise joining)::
[A]
[B]
Examples
>>> from sympy import SparseMatrix, Matrix, ones
>>> A = SparseMatrix(ones(3))
>>> A
Matrix([
[1, 1, 1],
[1, 1, 1],
[1, 1, 1]])
>>> B = SparseMatrix.eye(3)
>>> B
Matrix([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
>>> C = A.col_join(B); C
Matrix([
[1, 1, 1],
[1, 1, 1],
[1, 1, 1],
[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
>>> C == A.col_join(Matrix(B))
True
Joining along columns is the same as appending rows at the end
of the matrix:
>>> C == A.row_insert(A.rows, Matrix(B))
True'

def col_join(self, other):

    if ((self.rows == 0) and (self.cols != other.cols)):
        return self._new(0, other.cols, []).col_join(other)
    (A, B) = (self, other)
    if (not (A.cols == B.cols)):
        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 + A.rows), j)] = v
                k += 1
    else:
        for ((i, j), v) in B._smat.items():
            A._smat[((i + A.rows), j)] = v
    A.rows += B.rows
    return A
