Re: Direct Memory Replacing in Array
- To: mathgroup at smc.vnet.net
- Subject: [mg46830] Re: Direct Memory Replacing in Array
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 9 Mar 2004 19:57:25 -0500 (EST)
- Organization: Universitaet Leipzig
- References: <c2k4q5$qq0$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi, assign a Part of the matrix ? $HistoryLength=0; m=Table[0,{10000},{10000}] m[[5,All]]=Table[1,{10000}] Regards Jens Jeremy Fox wrote: > > The Mathematica syntax > > mat = ReplacePart[mat,new,index] > > is clean. However, it probably involves a complete replacing of the > entire, old mat with the entire new mat, in memory. This operation is > expensive if the user is interested in changing only a small part of a > large array mat. > > Is there a way to change small numbers of elements in an array without > requiring the other elements to be copied again? This is how low-level > languages such a C and Fortran work. > > Jeremy