[petsc-users] How to get Matrix from MatGetArray()

Matthew Knepley knepley at gmail.com
Sat Oct 1 10:26:30 CDT 2011


On Sat, Oct 1, 2011 at 10:23 AM, behzad baghapour <
behzad.baghapour at gmail.com> wrote:

> I meant by MatAssembly, the global indices of matrix elements (related to a
> dense format) which is changed into sparse one. So what would be right
> pattern to read the content of the Matrix from MatGetArray if I know that
> the original matrix is created by AIJ?
>

MatGetArray() on an AIJ matrix will give you 'A'. What do you need this for?
There are usually much
better ways to do things, and keep your code data-structure neutral.

   Matt


>
> On Sat, Oct 1, 2011 at 4:21 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>>  On Sat, Oct 1, 2011 at 00:39, behzad baghapour <
>> behzad.baghapour at gmail.com> wrote:
>>
>>> I just be able to get right answer from MatGetArray( A, &a ) only if I
>>> define matrix in Dense fromat.
>>>
>>> How could I get the right Answer from this function when I define
>>> SparseAIJ matrix?
>>>
>>
>> Depends what you mean by "right answer". This function accesses private
>> storage, so it's different for each matrix format. You might want to look at
>> MatView() or MatConvert().
>>
>
>
>
> --
> ==================================
> Behzad Baghapour
> Ph.D. Candidate, Mechecanical Engineering
> University of Tehran, Tehran, Iran
> https://sites.google.com/site/behzadbaghapour
> Fax: 0098-21-88020741
> ==================================
>
>


-- 
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/20111001/daaf986c/attachment.htm>


More information about the petsc-users mailing list