def bench_construction(self):
matrices = []<EOL>matrices.append(('<STR_LIT>',csr_matrix((<NUM_LIT>,<NUM_LIT>))))<EOL>matrices.append(('<STR_LIT>',sparse.eye(<NUM_LIT>)))<EOL>matrices.append(('<STR_LIT>', poisson2d(<NUM_LIT:100>)))<EOL>print()<EOL>print('<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>print('<STR_LIT>')<EOL>fmt = '<STR_LIT>'<EOL>for name,A in matrices:<EOL><INDENT>A = A.tocoo()<EOL>for format in ['<STR_LIT>','<STR_LIT>']:<EOL><INDENT>start = time.clock()<EOL>iter = <NUM_LIT:0><EOL>while time.clock() < start + <NUM_LIT:0.5>:<EOL><INDENT>T = eval(format + '<STR_LIT>')(A.shape)<EOL>for i,j,v in zip(A.row,A.col,A.data):<EOL><INDENT>T[i,j] = v<EOL><DEDENT>iter += <NUM_LIT:1><EOL><DEDENT>end = time.clock()<EOL>del T<EOL>name = name.center(<NUM_LIT:12>)<EOL>shape = ("<STR_LIT:%s>" % (A.shape,)).center(<NUM_LIT:20>)<EOL>print(fmt % (format,name,shape,A.nnz,(end-start)/float(iter)))<EOL><DEDENT><DEDENT>
build matrices by inserting single values