[petsc-users] MatGetSize for SeqBAIJ

Manav Bhatia bhatiamanav at gmail.com
Tue Mar 1 10:56:24 CST 2016


Thanks. That means I am doing something goofy in setting up my matrix. 

I am trying to create a matrix with block size 2, and 3000 as the number of block rows/columns. So, I would expect an output of 6000x6000 from the following code, but I get 3000x3000. Is it the sequence of my function calls? 

Thanks,
Manav



    PetscErrorCode   ierr;
    Mat              mat;
    PetscInt m,n;

    ierr = MatCreate(mpi_comm, &mat);    
    ierr = MatSetSizes(mat, 3000, 3000, 3000, 3000); 
    ierr = MatSetType(mat, MATBAIJ);                 
    ierr = MatSetBlockSize(mat, 2);                  
    ierr = MatGetSize(mat, &m, &n);

    std::cout << m << "  " << n << std::endl;



> On Mar 1, 2016, at 10:44 AM, Hong <hzhang at mcs.anl.gov> wrote:
> 
> Manav:
>    Is MatGetSize for a SeqBAIJ matrix expected to return the number of block rows and columns, or the total number of rows and columns (blocks rows times block size)?
>  
> +  m - the number of global rows
> -  n - the number of global columns
> the total number of rows and columns (blocks rows times block size).
> 
> Hong
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160301/68087820/attachment.html>


More information about the petsc-users mailing list