← Back to team overview

dolfin team mailing list archive

Re: Zeros in matrices

 

On Sun, Apr 29, 2007 at 12:02:59PM +0200, Garth N. Wells wrote:
> 
> 
> Garth N. Wells wrote:
> > 
> > 
> > Anders Logg wrote:
> >> On Fri, Apr 27, 2007 at 05:24:34PM +0200, Garth N. Wells wrote:
> >>>
> >>> Anders Logg wrote:
> >>>> I'm comparing the entries in the Stokes systems between the new code
> >>>> and the old and there seem to be quite a few more zeros in the sparse
> >>>> matrix than before.
> >>>>
> >>> Strange. Have you counted the non-zeroes, or are you displaying the 
> >>> matrix?
> >>
> >> Displaying the matrix and counting everything that looks like zero.
> >> (Just looking at the numbers.)
> >>
> > 
> > There are about double the number of non-zeros (you can get the number 
> > by A.nnz()) for the Stokes example with the new version compared to 
> > version 0.6.4. For poisson and elasticity, the number of non-zeroes is 
> > the same as with version 0.6.4. The linear algebra looks fine - 
> > something is going on with the computation of the sparsity pattern for 
> > the Stokes problem.
> > 
> 
> This is due to the significant number of zeroes in the element matrix 
> for the Stokes problem. Previously, for uBLAS matrices the stiffness 
> matrix was assembled into a temporary matrix A_temp which was then 
> copied to a compressed row matrix A
> 
>    A.assign(A_temp);
> 
> The assign operation removed all non-zero terms. We no longer assemble 
> into the temporary matrix.
> 
> Perhaps FFC could produce something to indicate the non-zero terms in 
> the element matrix, although this would make things more complicated.
> 
> Garth

We could add something like

    void tabulate_nonzero_entries(bool* nonzero_entries);

to go along with tabulate_tensor() in the UFC interface.

This would not catch things like entries being zero because of
geometry (like entries for vertices "diagonal to each other" on a
regular simplicial mesh) but would catch entries that are known to be
always zero.

For 2D Stokes with P2-P1 Taylor-Hood elements, it looks like we have
117 out of 225 entries being zero in the element tensor so then it
would be useful to know this in advance.

Opinions?

/Anders


Follow ups

References