← Back to team overview

dolfin team mailing list archive

Re: Matrix initialization broken in Python?

 


On 17/01/11 18:03, Anders Logg wrote:
> On Mon, Jan 17, 2011 at 04:30:23PM +0000, Garth N. Wells wrote:
>>
>>
>> On 17/01/11 16:28, Anders Logg wrote:
>>> The following doesn't seem to work in Python any longer:
>>>
>>> A = Matrix(10, 10)
>>>
>>> Is matrix initialization broken?
>>>
>>
>> Probably not broken - more like
>>
>>   A = Matrix(10, 10)
>>
>> is not supported. Since a Matrix is in general sparse, it doesn't make
>> sense to initialise it as above (some backends even insist on the
>> sparsity being defined at construction).
>>
>> Garth
> 
> It would be good to allow simple initialization of a Matrix without
> requiring to go through all the hassle of creating a SparsityPattern.
> 
> I generally don't think we should disallow certain operations just
> because they are potentially slow. 

It's not just that they're slow. They cannot be supported by all backends.

> Some operations (like Matrix index
> access) will only be performed for toy problems or while testing and
> then speed is not very important (since the problem is small anyway).
>

If it's made available, it will be used. This type of operation is main
reason for things breaking in parallel. We have getitem and setitem
which are sufficiently unfriendly that hopefully users get the idea that
they're for testing only.

Garth


> --
> Anders




Follow ups

References