Re: modify elements of arb.dimensionality matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg77278] Re: modify elements of arb.dimensionality matrices
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 6 Jun 2007 07:10:47 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f43ibj$3nf$1@smc.vnet.net>
alexxx.magni at gmail.com wrote: > I was able to write an interface to deal with matrices having > dimension defined at runtime (see > http://groups.google.it/group/comp.soft-sys.math.mathematica/browse_frm/thread/f286f5bdafba4195/c85eaca115f18a46?lnk=st&q=+%22Alessandro+Magni%22&rnum=2&hl=it#c85eaca115f18a46). > > My last problem - more a performance problem - is modify access to > those matrices: > > reading access at a given index location i (where i is the location > {x,y,z,...}) is made with: > >> Extract[h, i] > > while to increment h[[]] at i I use: > >> h = ReplacePart[h, i -> Extract[h, i] + 1] > > but I really miss the possibility to write h[[x,y]]=h[[x,y]]+1, and > I'm user there are serious performance issues with my solution. > > The nearest I came to a solution was with: > >> h[[##]] & @@ i = "x" > > but I immediately get: > >> Set::write: Tag Apply in (s[[##1]]&)@@{1,2,1} is Protected. >> > > Do you have any idea on this? > > thank you! > > Alessandro Magni Set[h[[##]], "x"] & @@ i should work. Regards, Jean-Marc