Home »
Public Forums »
archive »
Speedy Julia Set Fractals
Speedy Julia Set Fractals [message #67914] |
Sun, 06 September 2009 14:44 |
Caleb
Messages: 2 Registered: September 2009
|
Junior Member |
|
|
Hello!
I have a quick question about some fractal work I am doing. I know
that doing matrix multiplications and histograms can exponentiate
processes that are historically done with for loops. I have been
trying to think of a way to do this with a fractal program I just
wrote. Here is a snippet of the code that I want to speed up:
<code>
; Loop through and do calculations on each point:
FOR i = 0, x_size-1 DO BEGIN
FOR j = 0, y_size-1 DO BEGIN
; Initialize number of iterations:
num = 0
; Complex value of the current coordinate point:
z = COMPLEX(FLOAT(i-X_OFFSET)/(X_OFFSET*SCALE),FLOAT(j-Y_OFFSET) /
(Y_OFFSET*SCALE))
; Calculate value of F(z) at above z:
z1 = z^K + c
; Take magnitude of the above value (z1):
mag = ABS(z1^K + c)
; Do loop until mag is greater than threshold or max iterations
have been calculated:
WHILE ((mag LE THRESH) AND (num LT MAX_ITERATION)) DO BEGIN
; Re-Calculate value of F(z) at above z1:
z1 = z1^K + c
; Take magnitude of the above value (z1):
mag = ABS(z1^K + c)
; Increment iteration variable:
num++
ENDWHILE
; Value of matrix is set to iteration number:
grid(i,j) = num
ENDFOR
ENDFOR
</code>
My problem is that I have a while loop for every iteration of my
matrix which can run up to 256 iterations if need be. Can I speed of
these calculations without going to multiple cores?
Oh and if you need more of the code let me know and I'll post it.
Thanks!
Caleb Wherry
|
|
|
Current Time: Wed Oct 08 19:35:20 PDT 2025
Total time taken to generate the page: 0.00630 seconds