New question #151130 on DOLFIN: https://answers.launchpad.net/dolfin/+question/151130
Hi, --- This might be stupid. Just wondering if there is some efficient routine to create the identity matrix of a given size? The straight-forward commands I tried: A = Matrix(n, n) A[0,0] = 0 A.ident_zeros() proved to be slow when n is large (e.g. time = 7sec when n = 10000). The alternative code mesh = UnitInterval(n) V = FunctionSpace(mesh, 'DG', 0) f = TrialFunction(V) g = TestFunction(V) A = assemble( f * g * dx ) A *= n works with less time (t = 0.05sec when n = 10000). I guess I might missed some simple routine. Anyone knows what the better way is? Thanks. --- Bo You received this question notification because you are a member of DOLFIN Team, which is an answer contact for DOLFIN. _______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

