progs/mandelbrot.sc
changeset 493 244df77507c2
parent 491 e2ffe8642f55
equal deleted inserted replaced
492:4ffba2f72692 493:244df77507c2
     3 //
     3 //
     4 //   see https://en.wikipedia.org/wiki/Mandelbrot_set
     4 //   see https://en.wikipedia.org/wiki/Mandelbrot_set
     5 //
     5 //
     6 // You can run on the file one the commandline with
     6 // You can run on the file one the commandline with
     7 //
     7 //
     8 //   scala-cli mandelbrot.sc
     8 //   scala mandelbrot.sc
     9 //
     9 //
    10 //
    10 //
    11 //
    11 //
    12 // !! UPDATE ON TIMING: On my faster Mac-M1 machine
    12 // !! UPDATE ON TIMING: On my faster Mac-M1 machine
    13 // !! the times for the first example are ca. 4 secs for
    13 // !! the times for the first example are ca. 4 secs for
    14 // !! the sequential version and around 0.7 secs for the
    14 // !! the sequential version and around 0.7 secs for the
    15 // !! par-version.
    15 // !! par-version.
    16 
    16 
    17 // for parallel collections
    17 // for parallel collections
    18 //> using dep org.scala-lang.modules::scala-parallel-collections:1.0.4
    18 //> using dep org.scala-lang.modules::scala-parallel-collections:1.0.4
    19 import scala.language.implicitConversions
    19 import scala.language.implicitConversions.*
    20 import scala.collection.parallel.CollectionConverters.*
    20 import scala.collection.parallel.CollectionConverters.*
    21 
    21 
    22 // for graphics
    22 // for graphics
    23 import javax.swing.{JFrame, JPanel, WindowConstants}
    23 import javax.swing.{JFrame, JPanel, WindowConstants}
    24 import java.awt.{Color, Dimension, Graphics, Graphics2D}
    24 import java.awt.{Color, Dimension, Graphics, Graphics2D}
    25 import java.awt.image.BufferedImage
    25 import java.awt.image.BufferedImage
    26 
    26 
       
    27 // for implicits in comples numbers
       
    28 import scala.language.implicitConversions
    27 
    29 
    28 
    30 
    29 
    31 
    30 // complex numbers
    32 // complex numbers
    31 //   represents the complex number re + im * i
    33 //   represents the complex number re + im * i