[petsc-users] Whether can one set the row and col sizes of a Mat to zero when creating it?
Yujie
recrusader at gmail.com
Mon May 10 17:00:09 CDT 2010
I got it. Thank you very much, Barry.
Regards,
Yujie
On Mon, May 10, 2010 at 4:55 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
> You cannot call MatVecSetValues() on a zero size array in the same way that you cannot do v[0] = 2 on an array with size 0.
>
> PETSc only allows you to call VecMatSetValues() on indices that the Vec Mat has, since an empty Vec Mat has no indices you cannot call SetValues
>
> Barry
>
> On May 10, 2010, at 4:41 PM, Yujie wrote:
>
>> Dear Barry,
>>
>> Thank you for your reply.
>>
>> One can create an array with zero sizes. When he wants to set the
>> values of the array, he can use
>> "
>> for(i=0; i<m;++i)
>> "
>> he doesn't need to consider whether the size of the array is zero
>> since "loop for" can handle it even if the size of the array is zero.
>>
>> Whether is the operation done for Mat and Vec? I mean
>> one can use
>> "
>> Mat(Vec)SetValues()
>> "
>> regardless of the size of Mat and Vec.
>>
>> Thanks again.
>>
>> Regards,
>> Yujie
>>
>> On Mon, May 10, 2010 at 4:16 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>>>
>>> Yes, Mats and Vecs can have zero sizes. They are just like other Mats and Vecs but with no space allocated for data.
>>>
>>> Since these are not commonly used they may have glitches, let us know about them and we will fix them.
>>>
>>> Barry
>>>
>>> On May 10, 2010, at 4:08 PM, Yujie wrote:
>>>
>>>> Dear PETSc developers,
>>>>
>>>> Whether can one set the row and col sizes of a Mat to zero when creating it?
>>>> How about a Vec?
>>>>
>>>> If we can, how about the object of Mat and Vec? thanks a lot.
>>>>
>>>> Regards,
>>>> Yujie
>>>
>>>
>
>
More information about the petsc-users
mailing list