Question #129481 on DOLFIN changed: https://answers.launchpad.net/dolfin/+question/129481
Status: Open => Answered Johan Hake proposed the following answer: On Thursday October 14 2010 12:20:55 Andy R Terrel wrote: > New question #129481 on DOLFIN: > https://answers.launchpad.net/dolfin/+question/129481 > > I need to write out some assembled matrices in Matrix Market format, > hopefully from the Python interface. Easily for small matrices I can do: > > from dolfin import * > from scipy.io import mmio > from scipy.sparse import csr_matrix > ... > A = Matrix() > b = Vector() > > assemble_system(a, L, bcs=bc0, A_tensor=A, b_tensor=b) > > mmio.mmwrite("A.mtx", csr_matrix(A.array())) > mmio.mmwrite("b.mtx", csr_matrix(b.array())) > > But once A gets large calling "A.array()" takes forever. Is there a way in > python that I can just query the sparsity structure of A? > > Any other ideas on how to do this quickly? Shift backend to MTL4 or uBLAS and then: rows, cols, values = A.data() Johan -- 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 : dolfin@lists.launchpad.net Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp