[petsc-users] Getting 0 for both start and end with MatGetOwnershipRange()

Matthew Knepley knepley at gmail.com
Thu May 10 06:21:39 CDT 2012


On Wed, May 9, 2012 at 8:09 PM, Daniel Christian Weflen <
Daniel.Weflen at colorado.edu> wrote:

> I still get 0 for both the start and end rows.
>

1) Is mat_size 0?

2) If not, put these line in a standalone executable that shows the bug and
send it.

   Thanks,

     Matt


> -Dan
>
>
> On 05/09/2012 05:35 PM, Lisandro Dalcin wrote:
>
>> On 9 May 2012 20:01, Daniel Christian Weflen<Daniel.Weflen at colorado.**edu<Daniel.Weflen at colorado.edu>>
>>  wrote:
>>
>>> I have the following code:
>>>
>>>     Mat H;
>>>     PetscInt mat_size=x_npts*y_npts;
>>>     ierr=MatCreate(PETSC_COMM_**WORLD,&H);CHKERRQ(ierr);
>>>
>>> ierr=MatSetSizes(H,PETSC_**DECIDE,PETSC_DECIDE,mat_size,**
>>> mat_size);CHKERRQ(ierr);
>>>     ierr=MatSetType(H,MATSEQMAIJ);**CHKERRQ(ierr);
>>>     PetscInt* nonzeros;
>>>     PetscInt start_row,end_row,row_index;
>>>     MatGetOwnershipRange(H,&start_**row,&end_row);
>>>
>>> When I check the values of start_row and end_row right after calling
>>> MatGetOwnershipRange, both are 0. What am I doing wrong here? Am I
>>> calling
>>> MatCreate(), MatSetSizes() and MatSetType() in the wrong order?
>>>
>> Call MatSetUp() after MatSetType().
>>
>>
>>


-- 
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/20120510/3272c272/attachment.htm>


More information about the petsc-users mailing list