MatGetArrayF90 returns 2d array

Matthew Knepley knepley at
Tue Jun 30 17:48:56 CDT 2009

On Tue, Jun 30, 2009 at 1:19 PM, Barry Smith <bsmith at> wrote:

I thought the idea was that MatGetArray() never applies to a sparse matrix.
No other
sparse format supports this, does it?


  Good point.
>    Barry
> On Jun 30, 2009, at 12:45 PM, Stephan Kramer wrote:
>  Hello,
>> Why is it that MatGetArrayF90 returns a pointer to a 2d scalar array,
>> instead of 1d as stated in the documentation? In fact it seems to always
>> return a nrows x ncolumns array. Is this to deal with the MATDENSE case?
>> Would it not be more elegant to always return a 1d array, so you get what
>> you expect for the sparse matrices, and return a 1d array of length
>> nrows*ncolumns in the case of MATDENSE?
>> Cheers
>> Stephan Kramer
>> --
>> Stephan Kramer
>> Applied Modelling and Computation Group,
>> Department of Earth Science and Engineering,
>> Imperial College London

What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the petsc-users mailing list