<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fast_intersection(rows, cols, values, target, unknown_dist=1.0, far_dist=5.0):
 """Under the assumption of categorical distance for the intersecting simplicial set perform a fast intersection. Parameters rows: array An array of the row of each non-zero in the sparse matrix representation. cols: array An array of the column of each non-zero in the sparse matrix representation. values: array An array of the value of each non-zero in the sparse matrix representation. target: array of shape (n_samples) The categorical labels to use in the intersection. unknown_dist: float (optional, default 1.0) The distance an unknown label (-1) is assumed to be from any point. far_dist float (optional, default 5.0) The distance between unmatched labels. Returns ------- None """

    for nz in range(rows.shape[0]):
        i = rows[nz]
        j = cols[nz]
        if target[i] == -1 or target[j] == -1:
            values[nz] *= np.exp(-unknown_dist)
        elif target[i] != target[j]:
            values[nz] *= np.exp(-far_dist)

    return