Re: Weird behavior of SparseArray
- To: mathgroup at smc.vnet.net
- Subject: [mg58413] Re: Weird behavior of SparseArray
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 1 Jul 2005 02:02:07 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 6/30/05 at 4:37 AM, aelsabbagh at gmail.com (Adel Elsabbagh) wrote:
>I don't understand what is going on with SparseArray
>If I write this:
>cp1 = SparseArray[{i_, j_} -> 0, {4, 2}];
>cp1[[Range[4], 1]] = cp1[[Range[4], 1]] + {1, 1, 1, 1};
>cp1 // MatrixForm
>I get cp1 with all entries equal to zero
That's not what I see. I see
In[6]:=
cp1 = SparseArray[{i_, j_} -> 0, {4, 2}];
cp1[[Range[4],1]] = cp1[[Range[4],1]] + {1, 1, 1, 1};
Normal[cp1]
$Version
Out[8]=
{{1, 0}, {1, 0}, {1, 0}, {1, 0}}
Out[9]=
"5.1 for Mac OS X (January 27, 2005)"
as I would expect
--
To reply via email subtract one hundred and four
- Follow-Ups:
- Re: Re: Weird behavior of SparseArray
- From: Adel Elsabbagh <aelsabbagh@gmail.com>
- Re: Re: Weird behavior of SparseArray