Changeset 4457 for trunk/examples
- Timestamp:
- 08/30/08 10:22:29 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/threads/integration2d/integration2d.lgt
r4455 r4457 125 125 date is 2008/08/30, 126 126 comment is 'Multi-threading implementation of Recursive Gaussian Quadrature Methods for Numerical Integration for functions of two real variables.', 127 parameters is ['Threads'- 'Number of threads to use .']]).127 parameters is ['Threads'- 'Number of threads to use (1, 4, 9, 16, 25, ...).']]). 128 128 129 129 integrate(Function, A, B, C, D, NP, Epsilon, Integral) :- … … 144 144 ). 145 145 146 % split an interval into a list of intervals . -- doing a 1-dimensional split146 % split an interval into a list of intervals 147 147 split(Inf, Sup, N, Intervals):- 148 148 Width is (Sup - Inf) / N, … … 167 167 spawn(CDIntervals, Left, Right, Function, NP, Epsilon, [start(Function,Left,Right,Bottom,Top,NP,Epsilon,SubVolume)| Acc], Goals). 168 168 169 % wait for the threads to finish and then we willcollect the results summing as we go169 % wait for the threads to finish and then collect the results summing as we go 170 170 collect([], Integral, Integral). 171 171 collect([start(Function,Left,Right,Bottom,Top,NP,Epsilon,SubVolume)| Goals], Acc, Integral) :- … … 202 202 ). 203 203 204 quadrature(Function, A, B,C,D, Volume, NP, Epsilon, Integral) :-204 quadrature(Function, A, B, C, D, Volume, NP, Epsilon, Integral) :- 205 205 MiddleX is 0.5*(A+B), 206 206 MiddleY is 0.5*(C+D),
