MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Direct Memory Replacing in Array


Jeremy,

I think the following works.

matrix = {{a1, b1, c1}, {a2, b2, c2}};

Part[matrix, 2, 2] = b2new
b2new

matrix
{{a1, b1, c1}, {a2, b2new, c2}}

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/ 



From: Jeremy Fox [mailto:jeremytfox at yahoo.com]
To: mathgroup at smc.vnet.net

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



  • Prev by Date: Re: Direct Memory Replacing in Array
  • Next by Date: Re: Direct Memory Replacing in Array
  • Previous by thread: Re: Direct Memory Replacing in Array
  • Next by thread: Re: Direct Memory Replacing in Array