progs/mandelbrot.scala
changeset 191 f78b18c4c886
parent 189 ff815ca0bbcf
child 195 fc3ac7b70a06
equal deleted inserted replaced
190:2f989951d147 191:f78b18c4c886
    95   
    95   
    96   // deltas for each grid step 
    96   // deltas for each grid step 
    97   val d_x = (end.re - start.re) / W
    97   val d_x = (end.re - start.re) / W
    98   val d_y = (end.im - start.im) / H
    98   val d_y = (end.im - start.im) / H
    99    
    99    
   100   for (y <- (0 until H)) {
   100   for (y <- (0 until H).par) {
   101     for (x <- (0 until W))) {
   101     for (x <- (0 until W).par) {
   102     
   102     
   103      val c = start + 
   103      val c = start + 
   104       (x * d_x + y * d_y * i)
   104       (x * d_x + y * d_y * i)
   105      val iters = iterations(c, max) 
   105      val iters = iterations(c, max) 
   106      val col = 
   106      val col = 
   160      mandelbrot(exc1 + delta * n, 
   160      mandelbrot(exc1 + delta * n, 
   161                 exc2 - delta * n, 1000))
   161                 exc2 - delta * n, 1000))
   162 */
   162 */
   163 
   163 
   164 
   164 
   165 // Larry's example
   165 // Larry Paulson's example
   166 // example 2
   166 val exl1 = -0.74364990 + 0.13188170 * i
   167 val exl1 = -0.74364990 + 0.13188204 * i
   167 val exl2 = -0.74291189 + 0.13261971 * i
   168 val exl2 = -0.74291189 + 0.13262005 * i
       
   169 
   168 
   170 time_needed(mandelbrot(exl1, exl2, 1000))
   169 time_needed(mandelbrot(exl1, exl2, 1000))
   171 
   170 
       
   171 
       
   172 // example by Jorgen Villadsen
       
   173 val exj1 = 0.10284 - 0.63275 * i
       
   174 val exj2 = 0.11084 - 0.64075 * i
       
   175 
       
   176 time_needed(mandelbrot(exj1, exj2, 1000))