MathGroup Archive 2006

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

Search the Archive

Re: replacement rule and sparsearray question


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