Prev: Why is Ada considered "too specialized" for scientific use
Next: Posix fortran and the gnu toolchain
From: Ian Bush on 8 Apr 2010 13:19 On 8 Apr, 14:13, Gordon Sande <Gordon.Sa...(a)EastLink.ca> wrote: > On 2010-04-08 00:08:46 -0300, Michael <ma...(a)athenavisual.com> said: > > > In thermodynamics we often have to evaluate expressions like the > > following: > > > Sum_i Sum_k (x_i * x_k * A_ik * (1-K_ik)) where A_ik=sqrt(A_i * A_k) > > > The indices i and k run from 1 to the number of components in a > > mixture. For a mixture of 200 components (very typical) we often have > > to do this calculation around 1000 times. If one writes two regular DO > > loops to perform the calculation the code is very slow. I am > > soliciting ideas as what is the optimal way to implement the sum shown > > here. > > In n-body calculations there is a similar formal structure of an interaction > between pairs. But the interaction is known to be small for many pairs so > they can be dropped. If you problem has similar structure then you could > use similar approximations. But you have not indicated that this might be > the case beyond indicating that your problem has a physical basis. > And even when you can't neglect the "small" terms, e.g. for the coulomb interaction, there are ways to reduce it to something like O(NlogN). See e.g. http://www.unc.edu/~perera/PAPERS/JChemPhys_1995_103_8577.pdf which may be adaptable to your situation. > > A_ik=sqrt(A_i*A_k)=sqrt(A_i)*sqrt(A_k) so one might want to use x_i*sqrt(A_i) > insted of your currect expression. That leaves K_ik as the great unkown that > you forgot to describe. Is it a strength of an interaction? Would it allow > terms to be ignored? ...? Exactly. The form of K_ik is crucial here, Ian
First
|
Prev
|
Pages: 1 2 Prev: Why is Ada considered "too specialized" for scientific use Next: Posix fortran and the gnu toolchain |