[petsc-users] MatGetSize for SeqBAIJ
Matthew Knepley
knepley at gmail.com
Tue Mar 1 11:06:43 CST 2016
On Tue, Mar 1, 2016 at 10:56 AM, Manav Bhatia <bhatiamanav at gmail.com> wrote:
> 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);
>
MatSetSizes also takes the number of rows, not blocks.
Matt
> 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
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160301/668466f8/attachment-0001.html>
More information about the petsc-users
mailing list