Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2011

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

Search the Archive

Re: Replacement rules for large matrixes

  • To: mathgroup at
  • Subject: [mg119838] Re: Replacement rules for large matrixes
  • From: dr DanW <dmaxwarren at>
  • Date: Sat, 25 Jun 2011 05:27:05 -0400 (EDT)
  • Reply-to: comp.soft-sys.math.mathematica at

Is your matrix a nested list or a SparseArray[]?  From your description, I am guessing it is a nested list.  Try working with your matrix as a SparseArray[] instead.

Next problem: Replace[] does not work on SparseArray[]'s.  However, you can use BlockRules[] (code below) to do the replacement.

Code for BlockRules[] by Andrew Moylen at Wolfram, from an earlier posting on this group that I can't find right now:

SetAttributes[BlockRules, HoldRest]; 

BlockRules[rules_, expr_] := Block @@ Append[Apply[Set, Hold[rules], {2}], 


  • Prev by Date: Re: RevolutionPlot3D Help
  • Next by Date: Re: How can I write the input code for a comparison
  • Previous by thread: Replacement rules for large matrixes
  • Next by thread: Re: Replacement rules for large matrixes