From e282628f4e74c778428d60a89edf966bb257c660 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Wed, 23 Sep 2020 22:34:42 +0200 Subject: [PATCH] Initial commit. --- mandelbrot.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 mandelbrot.py diff --git a/mandelbrot.py b/mandelbrot.py new file mode 100755 index 0000000..fa522eb --- /dev/null +++ b/mandelbrot.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +import torch, torchvision + +n = 1280 + +cr = torch.linspace(-2, 1, n).view(1, -1) +ci = torch.linspace(-1.5, 1.5, n).view(-1, 1) + +zr = torch.zeros(n, n) +zi = torch.zeros(n, n) + +for k in range(100): + zr, zi = zr**2 - zi**2 + cr, 2 * zr * zi + ci + +torchvision.utils.save_image(1-(1-zr**2 + zi**2).sign(), 'mandelbrot.png') -- 2.39.5