def save_linkage(linkage_matrix, filename):
    """Save the linkage matrix to file

    Each row of the matrix is saved to a row in the output file

    :param linkage_matrix:
    :type linkage_matrix: numpy.ndarray
    :param filename: file name
    :type filename: basestring
    :return: success of the saving process
    :rtype: bool
    """
    buffer=''
    for i in range(len(linkage_matrix)):
        row=linkage_matrix[i]
        buffer += "{0:6d} {1:6d} {2:7.3f} {3:7d}\n".format(int(row[0]), int(row[1]), row[2], int(row[3]))
    try:
        open(filename, "w").write(buffer)
        return True
    except:
        return False