[petsc-users] Getting 0 for both start and end with MatGetOwnershipRange()
Barry Smith
bsmith at mcs.anl.gov
Fri May 11 11:34:16 CDT 2012
Dan,
Thanks for this report. MATMAIJ is not intended to be used in the same way as the other MatTypes, I have added a nice error message so you won't see this odd 0 range error that you were getting.
Barry
On May 10, 2012, at 12:52 PM, Daniel Christian Weflen wrote:
> I changed the type from MATSEQMAIJ to MATSEQAIJ and it works correctly. mat_size is not 0, should I still send the standalone executable?
>
> -Dan
>
> On 05/10/2012 05:21 AM, Matthew Knepley wrote:
>> 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> 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
More information about the petsc-users
mailing list