Nested loop limit?

P

Peter Hansen

Fernando said:
Feel free to contact me directly at fperez AT colorado DOT edu if you don't feel
like talking about quantum gravity on c.l.py :)

Just a note: quantum gravity discussions are _clearly_ on-topic in
c.l.py.

This is obviously so, for one thing because if you look at other
discussions which are not considered off-topic, and compare the
degree of association with Python, you will see that quantum gravity
is relatively (approximately) 100% Python-related.

Secondly, though it's not widely known, the technology behind
the still-missing time machine is based on combining phase-change
metaphysics (cf. the "transmogrifier", for example, of Calvin-Hobbes
Inc.) with quantum gravity to form an electro-gravitic
four-dimensional propulsive system which the PSU first rel
 
M

Michele Simionato

Dan Christensen said:
Yes, I've considered it, and in fact I'll be forced to use a
table-driven approach to handle more general situations, where the
geometry is read in from a file. I haven't done timing comparisons,
but I would be very surprised if it was faster. There would be some
beneficial cache effects from the shorter code, but more lookups and
index shuffling which I would expect to slow things down. But maybe
I'm not familiar with some tricks that would make this technique
faster.

As for maintainability of my method, using the macros means that
writing the code is very similar to filling in the table in the first
place! :)

I've actually toyed with the idea of having the program generate the
code (maybe in Python) on the fly, compile it (e.g. with psyco), and
then run it. But with Python's limit of 20 nested loops, that won't
fly.

Dan

You should consider writing your code in Lisp if have in mind that kind
of tricks (not that I claim that would be the right way to go, more
likely not).

BTW, just out of curiosity, what kind of computation are you trying to
perform? Is it in the context of loop quantum gravity, or Regge calculus,
or just general relativity?

You would be surprised by the backgrounds of people reading c.l.p. ...


Michele Simionato
 
D

Dan Christensen

Peter Hansen said:
Secondly, though it's not widely known, the technology behind
the still-missing time machine is based on combining phase-change
metaphysics (cf. the "transmogrifier", for example, of Calvin-Hobbes
Inc.) with quantum gravity to form an electro-gravitic
four-dimensional propulsive system which the PSU first rel

Thankfully, I was able to zap Peter with my own transmogrifier before
he completely gave away my secret technique for achieving time travel.

See you later (or sooner),

Dan
 
D

Dan Christensen

BTW, just out of curiosity, what kind of computation are you trying to
perform? Is it in the context of loop quantum gravity, or Regge calculus,
or just general relativity?

Spin foam models of quantum gravity, which are thought to be the path
integral version of loop quantum gravity.

(Sorry to the rest of list for going off topic. People who want to
pursue the non-python aspects of my question further should feel free
to e-mail me directly.)

Dan
 
P

Paul Rubin

Dan Christensen said:
I've actually toyed with the idea of having the program generate the
code (maybe in Python) on the fly, compile it (e.g. with psyco), and
then run it. But with Python's limit of 20 nested loops, that won't fly.

If you're going to generate code and compile it, you might as well
generate C code.
 
G

Greg Ewing

Peter said:
Maybe Pyrex does not have such a limit, or at least has a higher
one. Then you could generate the Pyrex code on the fly, and
maybe still get C performance.

Pyrex does not impose any limit on the depth of nesting of
any control structure (as long as your C compiler can handle
the generated code).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top