Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3292

Re: Replacement rules for large matrixes

From dr DanW <dmaxwarren@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Replacement rules for large matrixes
Date 2011-06-25 09:27 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iu49mi$jmf$1@smc.vnet.net> (permalink)

Show all headers | View raw


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}], 
    Unevaluated[expr]]

Enjoy,
Daniel

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Replacement rules for large matrixes dr DanW <dmaxwarren@gmail.com> - 2011-06-25 09:27 +0000

csiph-web