projects
/
pytorch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
291a994
)
Initial commit.
author
Francois Fleuret
<francois@fleuret.org>
Wed, 23 Sep 2020 20:34:42 +0000
(22:34 +0200)
committer
Francois Fleuret
<francois@fleuret.org>
Wed, 23 Sep 2020 20:34:42 +0000
(22:34 +0200)
mandelbrot.py
[new file with mode: 0755]
patch
|
blob
diff --git a/mandelbrot.py
b/mandelbrot.py
new file mode 100755
(executable)
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')