On Sun, 21 Feb 2010 13:48:09 -0600, Yujie <recrusader at gmail.com> wrote: > Hi, Jeb > > It looks MatGetRow() only can get the nonzero row values for sparse matrix. > It is not suitable for A./B if there are different formats between A and B.
Of course, but note that B must have at least all the nonzeros of A, otherwise you divide by 0. If you really need to do A./B where A was not preallocated to match B (it is a strict subset), then MatDuplicate B (call it C), loop over rows inserting rows of A into C, then perform the division with MatGetArray B and C (you'll have to work with the off-diagonal blocks separately in parallel). But you would be *much* better off to find a way to assemble the matrix you want rather than these other matrices with inequivalent nonzero patterns. Jed
