Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: replacement rule and sparsearray question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71320] Re: replacement rule and sparsearray question
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 15 Nov 2006 06:43:09 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <ejc4i2$6k9$1@smc.vnet.net>

Arkadiusz.Majka at gmail.com wrote:
> Hi,
> 
> How can I apply a replacement rule to sparse array, e.g
> 
> SparseArray[{1,2,3}]/.{2->222}
> 
> and obtain the same result as for {1,2,3}/.{2->222} (what is {1,222,3}.
> 
> I DON'T want to call Normal before.
> 
> Thanks,
> 
> arek
> 

SparseArray[{1, 2, 3} /. {2 -> 222}];
FullForm[%]
MatrixForm[%]

--> SparseArray[Automatic,List[3],0,List[1,List[List[0,3],List[List[
   1],List[2],List[3]]],List[1,222,3]]]

Regards,
Jean-Marc


  • Prev by Date: Re: replacement rule and sparsearray question
  • Next by Date: Re: Arithmetic Puzzle (so simple it's hard)
  • Previous by thread: Re: replacement rule and sparsearray question
  • Next by thread: Re: replacement rule and sparsearray question