[petsc-users] MatSetValues and Zero enteries

Matthew Knepley knepley at gmail.com
Mon Jun 20 18:20:48 CDT 2011


On Mon, Jun 20, 2011 at 11:16 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>wrote:

> Matt,
>
> I see. Please forgive my ignorance, but I don't quite understand why you
> should not be able to set a tolerance for it. Could you please point me to
> the source file that applies the MAT_IGNORE_ZERO_ENTRIES option to the
> matrix? I may be able to manually modify it.
>

src/mat/impls/aij/seq/aij.c. Search for ignorezeroentries. I think changing
it here would be bad design. Its simple
to process your input matrix to MatSetValues() to chop small values to 0.0

   Matt


> Thanks,
> Mohammad
>
>
> On Mon, Jun 20, 2011 at 2:34 PM, Matthew Knepley <knepley at gmail.com>wrote:
>
>> On Mon, Jun 20, 2011 at 9:31 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>wrote:
>>
>>> Thanks John -- taht's helpful. Do you also know how I can change the
>>> tolerance for dropping elements?
>>>
>>
>> Right now, this only discards entires which are exactly floating point
>> 0.0.
>>
>>    Matt
>>
>>
>>> Mohammad
>>>
>>> On Mon, Jun 20, 2011 at 1:12 PM, John Mousel <john.mousel at gmail.com>wrote:
>>>
>>>> See the matrix options available in the man pages. I think the function
>>>> below is what you are looking for.
>>>>
>>>>
>>>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatSetOption.html
>>>>
>>>>
>>>> MatSetOption <http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatSetOption.html#MatSetOption>(A,MAT_IGNORE_ZERO_ENTRIES,PETSC_TRUE <http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Sys/PETSC_TRUE.html#PETSC_TRUE>);
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Best Regards,
>>>> John
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Jun 20, 2011 at 2:42 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>wrote:
>>>>
>>>>> Hi folks,
>>>>>
>>>>> I've noticed that MatSetValues explicitly inserts zeros in the matrix
>>>>> if an element is really zero. Is there a way to drop elements (or not save
>>>>> them in the first place) that are below a certain tolerance? I realize one
>>>>> way of doing it is in the application code and when using MatSetValues but
>>>>> I'm just wondering if PETSc has a function for it?
>>>>>
>>>>> Thanks,
>>>>> Mohammad
>>>>>
>>>>
>>>>
>>>
>>
>>
>> --
>> 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
>>
>
>


-- 
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/20110620/0f2323c1/attachment.htm>


More information about the petsc-users mailing list