Re: Re: Re: Weird behavior of SparseArray
- To: mathgroup at smc.vnet.net
- Subject: [mg58495] Re: [mg58429] Re: [mg58413] Re: Weird behavior of SparseArray
- From: stephen layland <layland at wolfram.com>
- Date: Mon, 4 Jul 2005 02:24:23 -0400 (EDT)
- Mail-followup-to: Adel Elsabbagh <aelsabbagh@gmail.com>
- References: <200507010602.CAA09204@smc.vnet.net> <200507020806.EAA01606@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
and thus spake Adel Elsabbagh [2005.07.02 @ 04:13]:
> But here is what I get using the same input:
>
> In[218]:=
> cp1=SparseArray[{i_,j_}\[Rule]0,{4,2}];
> cp1[[Range[4],1]]=cp1[[Range[4],1]]+{1,1,1,1};
> Normal[cp1]
> $Version
>
>
>
> Out[220]=
> {{0,0},{0,0},{0,0},{0,0}}
>
> Out[221]=
> 5.0 for Microsoft Windows (June 11, 2003)
Looks like a bug with 5.0.0, fixed in 5.0.1;
This use of SparseArray is rather unintuitive, however. What you shold
probably be doing is something like this:
cp1 = SparseArray[{_,1}->1,{4,2}]
Assigning a rule for every position in a sparse array defeats the
purpose of a sparse array.
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
That's a lot of exclaiming...
--
/*------------------------------*\
| stephen layland |
| Documentation Programmer |
| http://members.wri.com/layland |
\*------------------------------*/
- References:
- Re: Weird behavior of SparseArray
- From: Bill Rowe <readnewsciv@earthlink.net>
- Re: Re: Weird behavior of SparseArray
- From: Adel Elsabbagh <aelsabbagh@gmail.com>
- Re: Weird behavior of SparseArray