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


Groups > comp.soft-sys.math.mathematica > #3311 > unrolled thread

Re: Replacement rules for large matrixes

Started byGabriel Landi <gtlandi@gmail.com>
First post2011-06-26 10:29 +0000
Last post2011-06-26 10:29 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Replacement rules for large matrixes Gabriel Landi <gtlandi@gmail.com> - 2011-06-26 10:29 +0000

#3311 — Re: Replacement rules for large matrixes

FromGabriel Landi <gtlandi@gmail.com>
Date2011-06-26 10:29 +0000
SubjectRe: Replacement rules for large matrixes
Message-ID<iu71ma$1bd$1@smc.vnet.net>
Dear Daniel,

Thank you for the reply. My matrix is constructed from a system of
polynomial equations using CoefficientArrays.
Indeed, replacement does not work. What I was doing was (sadly)

SparseArray[Normal@matrix /.rules].

Gabriel

On Sat, Jun 25, 2011 at 6:27 AM, dr DanW <dmaxwarren@gmail.com> wrote:

> 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
>
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web