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: [mg71326] Re: [mg71297] replacement rule and sparsearray question
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 15 Nov 2006 06:43:21 -0500 (EST)
  • References: <200611141006.FAA06663@smc.vnet.net>

On Nov 14, 2006, at 5:06 AM, 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.

Just replace the rule and make a new array:

a=SparseArray[{1->1,2->2,3->3}];
b=SparseArray[ArrayRules[a]/.({2}->_)->({2}->222)]

Regards,

Ssezi


  • Prev by Date: Assumptions for Trigonometry Inequalities
  • Next by Date: Re: replacement rule and sparsearray question
  • Previous by thread: replacement rule and sparsearray question
  • Next by thread: Re: replacement rule and sparsearray question