Mathematica 9 is now available
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: 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


  • Prev by Date: Can't assign value to symbols
  • Next by Date: a question about the UnitStep function
  • Previous by thread: Re: Can't assign value to symbols
  • Next by thread: Re: Re: Weird behavior of SparseArray