[SciPy-dev] Sparse feature suggestion: zero-sized sparse matrices

Nathan Bell wnbell at gmail.com
Mon Feb 11 12:09:49 EST 2008


On Feb 11, 2008 10:50 AM, Neilen Marais <nmarais at sun.ac.za> wrote:
>
> This kind of ties in to the sparse block matrix assembly I brought up
> last week. I build up the sparse blocks from different subsystems, but in
> some cases some of the subsystems fall away. It would be very convenient
> if I could represent the "null" systems simply as zero-sized sparse
> matrices that will then make no contribution to the global matrix.
>
> It seems normal numpy arrays support the idea of zero-dimension 2-D
> arrays. Would anyone object to this feature in sparse matrices? If not, I
> could try to cook up a patch.

You're welcome to try, but I think it would be a nightmare to implement.

I would only object if the necessary changes introduced a large number
of statements of the form

  if shape[0] == 0:
     do strange thing
  else:
     do normal thing

because that sort of thing is difficult to maintain.

On the other hand, there may be a comprehensive solution that resolves
such matters in a simple and consistent way.

-- 
Nathan Bell wnbell at gmail.com
http://graphics.cs.uiuc.edu/~wnbell/



More information about the SciPy-Dev mailing list