def contained_segments_matrix(segments):
x1, y1 = segments[:, <NUM_LIT:0>], segments[:, <NUM_LIT:1>]<EOL>x2, y2 = x1 + segments[:, <NUM_LIT:2>], y1 + segments[:, <NUM_LIT:3>]<EOL>n = len(segments)<EOL>x1so, x2so, y1so, y2so = list(map(numpy.argsort, (x1, x2, y1, y2)))<EOL>x1soi, x2soi, y1soi, y2soi = list(map(numpy.argsort, (x1so, x2so, y1so, y2so)))  <EOL>o1 = numpy.triu(numpy.ones((n, n)), k=<NUM_LIT:1>).astype(bool)<EOL>o2 = numpy.tril(numpy.ones((n, n)), k=<NUM_LIT:0>).astype(bool)<EOL>a_inside_b_x = o2[x1soi][:, x1soi] * o1[x2soi][:, x2soi]  <EOL>a_inside_b_y = o2[y1soi][:, y1soi] * o1[y2soi][:, y2soi]  <EOL>a_inside_b = a_inside_b_x * a_inside_b_y<EOL>return a_inside_b<EOL>
givens a n*n matrix m, n=len(segments), in which m[i,j] means
segments[i] is contained inside segments[j]