MathGroup Archive 2007

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

Search the Archive

matrices with arbitrary dimensionality

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76640] matrices with arbitrary dimensionality
  • From: "alexxx.magni at gmail.com" <alexxx.magni at gmail.com>
  • Date: Fri, 25 May 2007 06:28:52 -0400 (EDT)

Hi there,
with V.6.0 I keep on with my experiment in translating a large C++
spin simulation program.

What I'm bouncing my head against today is the following:

there is a way in M to describe objects (matrices) having an arbitrary
number of dimensions, defined just at runtime?

In detail, I work on an orthogonal lattice where my spins are defined,
but the simulations require sometimes to deal with 1d (arrays),
sometimes more.

Yet I'd like to write the most general code it is possible, e.g. when
writing a procedure that - given a location in the lattice at the
coordinates {i,j,...} - returns a list of locations of the nearest
neighbors
(in 1d: {{i-1},{i+1}}; in 2d: {{i-1,j},{i+1,j},{i,j-1},{i,j+1}} and so
on...)

thanks for any hint...

Alessandro Magni



  • Prev by Date: Re: StackGraphics missing in Mathematica 6?
  • Next by Date: Re: On typesetting
  • Previous by thread: Mathematica 6.0: bug with autosave mechanism for packages
  • Next by thread: Re: matrices with arbitrary dimensionality