def tdot_blas(mat, out=None):
if (mat.dtype != '<STR_LIT>') or (len(mat.shape) != <NUM_LIT:2>):<EOL><INDENT>return np.dot(mat, mat.T)<EOL><DEDENT>nn = mat.shape[<NUM_LIT:0>]<EOL>if out is None:<EOL><INDENT>out = np.zeros((nn, nn))<EOL><DEDENT>else:<EOL><INDENT>assert(out.dtype == '<STR_LIT>')<EOL>assert(out.shape == (nn, nn))<EOL>assert(<NUM_LIT:8> in out.strides)<EOL>out[:] = <NUM_LIT:0.0><EOL><DEDENT>mat = np.asfortranarray(mat)<EOL>out = blas.dsyrk(alpha=<NUM_LIT:1.0>, a=mat, beta=<NUM_LIT:0.0>, c=out, overwrite_c=<NUM_LIT:1>,<EOL>trans=<NUM_LIT:0>, lower=<NUM_LIT:0>)<EOL>symmetrify(out, upper=True)<EOL>return np.ascontiguousarray(out)<EOL>
returns np.dot(mat, mat.T), but faster for large 2D arrays of doubles.