Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

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 |
\*------------------------------*/


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