       Re: Re: Further information about size limits for Normal[SparseArray[<>]]?

• To: mathgroup at smc.vnet.net
• Subject: [mg49641] Re: [mg49616] Re: Further information about size limits for Normal[SparseArray[<>]]?
• From: Scott Morrison <scott at math.berkeley.edu>
• Date: Sun, 25 Jul 2004 02:55:53 -0400 (EDT)
• References: <cdqr0s\$kop\$1@smc.vnet.net> <200407240748.DAA05940@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```> Most of the basic operations have been extended to handle SparseArray
> objects, so, for example, there is no need to add any fixes to
> LinearAlgebra`MatrixManipulation` to make it compatible with
> SparseArray, because those fixes have already been made to the basic
> Mathematica functions like Part. However, there are a few exceptions:
> in some cases a function has to do the parsing of the input expression
> and forgets about SparseArray; for example:

There are more problems, specifically with MatrixManipulation, where
just making changes to the basic functions like Part wasn't enough. For
example:

In:=
<<LinearAlgebra`MatrixManipulation`

In:=
m={{1,2,3},{4,5,6},{7,8,9}};

In:=
sa=SparseArray[m];

In:=
BlockMatrix[Outer[Times,m,m]]

Out=
{{1,2,3,2,4,6,3,6,9},{4,5,6,8,10,12,12,15,
18},{7,8,9,14,16,18,21,24,27},{4,8,12,5,10,15,6,12,18},{16,
20,24,20,25,30,24,30,36},{28,32,36,35,40,45,42,48,54},{7,14,21,8,16,
24,9,18,27},{28,35,42,32,40,48,36,45,54},{49,56,63,56,64,72,63,72,81}}

In:=
BlockMatrix[Outer[Times,sa,sa]]

Out=
{SparseArray[<9>,{9}],SparseArray[<9>,{9}],SparseArray[<9>,{9}],
SparseArray[<9>,{9}],SparseArray[<9>,{9}],SparseArray[<9>,{9}],
SparseArray[<9>,{9}],SparseArray[<9>,{9}],SparseArray[<9>,{9}]}

In:=
SubMatrix[sa,{1,1},{2,2}]

Out=
SubMatrix[SparseArray[<9>,{3,3}],{1,1},{2,2}]

Here BlockMatrix gives the answer in a peculiar form; a list of
SparseArrays, each representing one row of the answer. This is not
ideal, as it's an extremely inefficient representation, worse even than
as a nested list.

SubMatrix failed simply because it's defined expecting a _List as it's
argument, rather than a _?MatrixQ. These are both easy problems to fix,
but I'd hope Wolfram could release a new MatrixManipulations package
with it all done for us. :-) There are plenty more similar examples.

Scott Morrison

```

• Prev by Date: Re: In Plot, horizontal range is reduced depending on PlotRange
• Next by Date: Re: Spacing of Words in Text Graphics Statements
• Previous by thread: Re: Further information about size limits for Normal[SparseArray[<>]]?
• Next by thread: A question on finite field package performance