MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Weird behavior of SparseArray

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58429] Re: [mg58413] Re: Weird behavior of SparseArray
  • From: Adel Elsabbagh <aelsabbagh at gmail.com>
  • Date: Sat, 2 Jul 2005 04:06:30 -0400 (EDT)
  • References: <200507010602.CAA09204@smc.vnet.net>
  • Reply-to: Adel Elsabbagh <aelsabbagh at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

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)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Thanks anyway. 

On 7/1/05, Bill Rowe <readnewsciv at earthlink.net> wrote:
> 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
> 
> 


-- 
Adel


  • Prev by Date: Re: a question about the UnitStep function
  • Next by Date: Re: a question about the UnitStep function
  • Previous by thread: Re: Weird behavior of SparseArray
  • Next by thread: Re: Re: Re: Weird behavior of SparseArray