Re: Arbitrarily Many Nested Loops



Ilya Zakharevich wrote:
[A complimentary Cc of this posting was sent to
A. Sinan Unur
<1usa@xxxxxxxxxxxxxxxxxxx>], who wrote in article <Xns9795CB63AB7DAasu1cornelledu@xxxxxxxxx>:
You need to work a little on explaining the problem and algorithm.
Neither the code snippet above nor your verbal description makes any
sense to me
I'm afraid the problem is on your side. The explanation-by-code looks
absolutely clear to me.
I was definitely a bt lacadaisical in my proofreading efforts. What I
*should* have written was:
But that's obviously messy and more imprtantly I'd like to be able to
decide at run time how many nested levels I'll need.

Possibly that's vaguely more clear.


Looks like there is a multi-dimensional array of unknown-in-advance
dimension. It is known that it is "rectangular"; the sizes are stored
in another vector (one size per dimension).
You got it exactly. :-)

[OT Description - I'm using this to create a binomial-style probability
distribution where the success probability differs between trials. For
example. If I flip n different coins, each one biased to a known
extent, m(i) times each what would the probability be of flipping x
heads?]

One wants a CONVENIENT way to run through the elements of this array.
The way I'd put it would be that I want a way to run through the
elements of the array without having to resort to copy-and-paste.

One hint to OP: since you do not know the dimension at compile
time, you cannot be sure that the index of 1st,2nd,3rd etc
dimensions is $k, $l, $m etc. So the only solution is to have the
running index to be an array too: $I[0], $I[1], $I[3] etc.
Most definitely . I had just posted the first kludge I came up with.

This more or less immediately suggests a possible solution...
I have to admit, I don't really see the possible solution you have in
mind here ...

P.S. One could also use Math::Pari's forvec(); might be a little bit
heavy-weight solution, but maybe then you will find some use for
other functions in Math::Pari too. ;-)
Self-promote much? ;-)

.



Relevant Pages

  • Re: Spectrum, Markov, Large Deviations, and PI
    ... The connection of Probability-Statistics with volume and Lebesgue ... elementary or even first upper division probability or statistics ... Volume, area, and length in Euclidean ... capacity dimension on closed bounded (that is ...
    (sci.stat.math)
  • Re: Sci-Fi Noein - "Shrodingers Sand Box"
    ... the physics sound more complicated than it really was. ... we would need a complicated set of probability functions for our particles. ... dimension they want to reach. ...
    (rec.arts.anime.misc)
  • Re: Black Hole Bouncing vs Evaporation vs Control
    ... statistics, randomized decision rules are key in statistical decision ... words about Probability as a dimension after writing the new equation: ... It is typical to regard Probability as dimensionless because of the ...
    (sci.physics)
  • Re: Dimensional Analysis Via PI Versus Factor/Cluster/Scaling/PCA
    ... >danger and decision to move toward ... Mathematical sociology and mathematical psychology should now ... for not assigning a dimension to probability is the "relative freq- ... a number divided by a number which has no dimension. ...
    (sci.stat.math)
  • Re: how to compare the Gaussian probability of data with different dimensions?
    ... the covariance matrix could be singula and I have to deduce the ... dimension by projecting the data to a lower dimension to calculate ... how can I compare the probability ... want to add extra weight to the prior proobability of a singular model ...
    (sci.stat.math)