Re: memory management and pointers
- To: mathgroup at smc.vnet.net
- Subject: [mg27174] Re: memory management and pointers
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 9 Feb 2001 03:10:21 -0500 (EST)
- References: <95tpi7$m0s@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Sébastien , Re your first example: Try u[[1, 1]] = 1 -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 <Sebastien.deMentendeHorne at electrabel.com> wrote in message news:95tpi7$m0s at smc.vnet.net... > Hi, > > I never heard about pointers in Mathematica but I am facing a problem where > it should be nice if Mathematica doesn't allow/free memory every time. > > For instance: > > u = ReplacePart[u,1,{1,1}] where u is a very big matrix > > As I need to do this very often in an algorithm, Mathematica spends a lot of > the time by: > - creating the new object ReplacePart[u,1,{1,1}] which is as big as > u > - rebinding u to the new object > - freeing the old u object > Is it possible to ask Mathematica to do a ReplacePart directly on u without > all the hassle of allocation/free of memory. > > Another example: > u = u + f[u] +g[u] where u is again the big matrix > will imply a lot of wasted time in memory problems. > > When Mathematica says that "u += a" is equivalent to "u = u + a" is it true > or almost true (difference in memory management)? > > Thank you very much > Sébastien > > > Sébastien de Menten de Horne | ELECTRABEL > Tel: ++32 10 48 51 76 | R&D Energy Markets, > Fax: ++32 10 48 51 09 | Traverse d'Esope, 6 > Gsm: ++32 478 789 444 | B-1348 Louvain-la-Neuve, BELGIUM >