Chih-Chuen Lin via petsc-users <petsc-users@mcs.anl.gov> writes: > Dear PETSc users, > > I am Ian. I trying to implement a solver which involves a sparse symmetric > matrix A multiplied by a dense matrix X. And because of the nature of the > problem, the bandwidth of the matrix A would be kind of large.For A*X, I am > thinking using reverse Cuthill-Mckee algorithm to reduce the bandwidth. > > Are the following approach reasonable, or do you have a better advice? > > 1. Use MatGetOrdering to get a MATORDERINGRCM ordering, and MatPermute to > create a new with it.
You can do this. It may not make much difference. Note that if you permute columns of A, you'll also need to permute rows of X. > 2. What’s the difference by using MATAIJ and MATBAIJ in terms of the entry > insertion and computation and MPI efficiency for a sparse-dense matrix > multiplication? Would it be better to use MATSBAIJ in terms of the > computational efficiency? The sparse-dense variant isn't implemented for all cases and may not provide benefit anyway. Using a parallel symmetric format for SpMV requires more communication of the "vector", which in your case is a dense matrix.