Create a pure diagonal matrix

Shi Jin jinzishuai at
Mon Mar 31 16:11:32 CDT 2008


I have a related question to the one above: what is the best way to create a purely diagonal matrix?
I am using
But I would think there might be a even better (faster/less memory) way?

I thought about the BDiag Matrix. I tried
ierr=MatCreateMPIBDiag(comm,localM,globalSize,globalSize,PETSC_NULL,1,      PETSC_NULL,PETSC_NULL,&lumpedM);CHKERRQ(ierr);
but not sure if it is done correctly. I am a little suspicious about those pointers I set as NULL.

If the above two are both correct, is there a better one?

Thank you very much.
Shi Jin, PhD

No Cost - Get a month of Blockbuster Total Access now. Sweet deal for Yahoo! users and friends.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list