def build_permutation_matrix(permutation):
matrix = lil_matrix((len(permutation), len(permutation)))<EOL>column = <NUM_LIT:0><EOL>for row in permutation:<EOL><INDENT>matrix[row, column] = <NUM_LIT:1><EOL>column += <NUM_LIT:1><EOL><DEDENT>return matrix<EOL>
Build a permutation matrix for a permutation.