Last active
March 16, 2017 21:26
-
-
Save Microno95/cde966e3dab255a56d502b220c346c69 to your computer and use it in GitHub Desktop.
Fractals_Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T16:47:16.819810", | |
| "end_time": "2017-03-16T16:47:17.634910" | |
| }, | |
| "collapsed": false, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "%pylab notebook\n%load_ext cython\nimport sympy as smp\nfrom scipy.special import lambertw\nfrom tqdm import tqdm_notebook\nfrom time import perf_counter", | |
| "execution_count": 1, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "text": "Populating the interactive namespace from numpy and matplotlib\n", | |
| "name": "stdout" | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T17:26:55.202286", | |
| "end_time": "2017-03-16T17:26:55.208375" | |
| }, | |
| "collapsed": false, | |
| "trusted": true, | |
| "scrolled": false | |
| }, | |
| "cell_type": "code", | |
| "source": "%%cython -a\n\nimport cython\nimport numpy as np\ncimport numpy as np\nDTYPE = np.float64\nctypedef np.float64_t DTYPE_t\n\n@cython.boundscheck(False)\n@cython.wraparound(False)\n@cython.profile(False)\n@cython.optimize.unpack_method_calls(False)\ncdef np.ndarray[np.complex128_t, ndim=2] f(np.ndarray[np.complex128_t, ndim=2] _x, np.ndarray[np.complex128_t, ndim=2] z):\n # Iteration function used to compute successive iterations of the fractal set\n return z**_x\n\n@cython.boundscheck(False)\n@cython.wraparound(False)\n@cython.profile(False)\n@cython.optimize.unpack_method_calls(False)\n@cython.initializedcheck(False)\ndef fractalVals(np.ndarray[DTYPE_t, ndim=2] zRe, np.ndarray[DTYPE_t, ndim=2] zIm, np.int32_t iterations, np.complex128_t z_0=1):\n \n # Iterations controls the total number of iterations used to compute the set\n # z_0 is a control parameter that allows one to vary the initial state by some complex number\n # Which then can create effects like swirling the original fractal pattern\n \n assert zRe.dtype == DTYPE and zIm.dtype == DTYPE\n cdef np.ndarray[np.complex128_t, ndim=2] z = z_0*np.array(zRe, dtype=np.complex128) + 1j*np.array(zIm, dtype=np.complex128)\n cdef np.ndarray[np.complex128_t, ndim=2] X_n = z_0*(zRe + 1j*zIm)\n cdef np.ndarray[np.complex128_t, ndim=2] temp_n = zRe + 1j*zIm\n cdef np.ndarray[DTYPE_t, ndim=2] resArray = np.zeros((zRe.shape[0], zIm.shape[1]), dtype=DTYPE)\n cdef np.int32_t n = 0\n \n for i in range(iterations):\n X_n = f(X_n, z)\n temp_n = f(f(temp_n, z), z)\n n += 2\n resArray[np.abs(temp_n - X_n) < 5e-15] = (n - i)\n # Checks for divergence by checking if values are no longer finite (don't fit into 64-bit floats or are nans)\n resArray[np.logical_and(np.logical_not(np.isfinite(X_n)), resArray == 0)] = -(i + 1)\n resArray[resArray >= iterations - 1] = -iterations + 1\n return resArray", | |
| "execution_count": 14, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "data": { | |
| "text/plain": "<IPython.core.display.HTML object>", | |
| "text/html": "<!DOCTYPE html>\n<!-- Generated by Cython 0.25.2 -->\n<html>\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <title>Cython: _cython_magic_0b7d2e9dada1313c8a1bfd8400920a02.pyx</title>\n <style type=\"text/css\">\n \nbody.cython { font-family: courier; font-size: 12; }\n\n.cython.tag { }\n.cython.line { margin: 0em }\n.cython.code { font-size: 9; color: #444444; display: none; margin: 0px 0px 0px 8px; border-left: 8px none; }\n\n.cython.line .run { background-color: #B0FFB0; }\n.cython.line .mis { background-color: #FFB0B0; }\n.cython.code.run { border-left: 8px solid #B0FFB0; }\n.cython.code.mis { border-left: 8px solid #FFB0B0; }\n\n.cython.code .py_c_api { color: red; }\n.cython.code .py_macro_api { color: #FF7000; }\n.cython.code .pyx_c_api { color: #FF3000; }\n.cython.code .pyx_macro_api { color: #FF7000; }\n.cython.code .refnanny { color: #FFA000; }\n.cython.code .trace { color: #FFA000; }\n.cython.code .error_goto { color: #FFA000; }\n\n.cython.code .coerce { color: #008000; border: 1px dotted #008000 }\n.cython.code .py_attr { color: #FF0000; font-weight: bold; }\n.cython.code .c_attr { color: #0000FF; }\n.cython.code .py_call { color: #FF0000; font-weight: bold; }\n.cython.code .c_call { color: #0000FF; }\n\n.cython.score-0 {background-color: #FFFFff;}\n.cython.score-1 {background-color: #FFFFe7;}\n.cython.score-2 {background-color: #FFFFd4;}\n.cython.score-3 {background-color: #FFFFc4;}\n.cython.score-4 {background-color: #FFFFb6;}\n.cython.score-5 {background-color: #FFFFaa;}\n.cython.score-6 {background-color: #FFFF9f;}\n.cython.score-7 {background-color: #FFFF96;}\n.cython.score-8 {background-color: #FFFF8d;}\n.cython.score-9 {background-color: #FFFF86;}\n.cython.score-10 {background-color: #FFFF7f;}\n.cython.score-11 {background-color: #FFFF79;}\n.cython.score-12 {background-color: #FFFF73;}\n.cython.score-13 {background-color: #FFFF6e;}\n.cython.score-14 {background-color: #FFFF6a;}\n.cython.score-15 {background-color: #FFFF66;}\n.cython.score-16 {background-color: #FFFF62;}\n.cython.score-17 {background-color: #FFFF5e;}\n.cython.score-18 {background-color: #FFFF5b;}\n.cython.score-19 {background-color: #FFFF57;}\n.cython.score-20 {background-color: #FFFF55;}\n.cython.score-21 {background-color: #FFFF52;}\n.cython.score-22 {background-color: #FFFF4f;}\n.cython.score-23 {background-color: #FFFF4d;}\n.cython.score-24 {background-color: #FFFF4b;}\n.cython.score-25 {background-color: #FFFF48;}\n.cython.score-26 {background-color: #FFFF46;}\n.cython.score-27 {background-color: #FFFF44;}\n.cython.score-28 {background-color: #FFFF43;}\n.cython.score-29 {background-color: #FFFF41;}\n.cython.score-30 {background-color: #FFFF3f;}\n.cython.score-31 {background-color: #FFFF3e;}\n.cython.score-32 {background-color: #FFFF3c;}\n.cython.score-33 {background-color: #FFFF3b;}\n.cython.score-34 {background-color: #FFFF39;}\n.cython.score-35 {background-color: #FFFF38;}\n.cython.score-36 {background-color: #FFFF37;}\n.cython.score-37 {background-color: #FFFF36;}\n.cython.score-38 {background-color: #FFFF35;}\n.cython.score-39 {background-color: #FFFF34;}\n.cython.score-40 {background-color: #FFFF33;}\n.cython.score-41 {background-color: #FFFF32;}\n.cython.score-42 {background-color: #FFFF31;}\n.cython.score-43 {background-color: #FFFF30;}\n.cython.score-44 {background-color: #FFFF2f;}\n.cython.score-45 {background-color: #FFFF2e;}\n.cython.score-46 {background-color: #FFFF2d;}\n.cython.score-47 {background-color: #FFFF2c;}\n.cython.score-48 {background-color: #FFFF2b;}\n.cython.score-49 {background-color: #FFFF2b;}\n.cython.score-50 {background-color: #FFFF2a;}\n.cython.score-51 {background-color: #FFFF29;}\n.cython.score-52 {background-color: #FFFF29;}\n.cython.score-53 {background-color: #FFFF28;}\n.cython.score-54 {background-color: #FFFF27;}\n.cython.score-55 {background-color: #FFFF27;}\n.cython.score-56 {background-color: #FFFF26;}\n.cython.score-57 {background-color: #FFFF26;}\n.cython.score-58 {background-color: #FFFF25;}\n.cython.score-59 {background-color: #FFFF24;}\n.cython.score-60 {background-color: #FFFF24;}\n.cython.score-61 {background-color: #FFFF23;}\n.cython.score-62 {background-color: #FFFF23;}\n.cython.score-63 {background-color: #FFFF22;}\n.cython.score-64 {background-color: #FFFF22;}\n.cython.score-65 {background-color: #FFFF22;}\n.cython.score-66 {background-color: #FFFF21;}\n.cython.score-67 {background-color: #FFFF21;}\n.cython.score-68 {background-color: #FFFF20;}\n.cython.score-69 {background-color: #FFFF20;}\n.cython.score-70 {background-color: #FFFF1f;}\n.cython.score-71 {background-color: #FFFF1f;}\n.cython.score-72 {background-color: #FFFF1f;}\n.cython.score-73 {background-color: #FFFF1e;}\n.cython.score-74 {background-color: #FFFF1e;}\n.cython.score-75 {background-color: #FFFF1e;}\n.cython.score-76 {background-color: #FFFF1d;}\n.cython.score-77 {background-color: #FFFF1d;}\n.cython.score-78 {background-color: #FFFF1c;}\n.cython.score-79 {background-color: #FFFF1c;}\n.cython.score-80 {background-color: #FFFF1c;}\n.cython.score-81 {background-color: #FFFF1c;}\n.cython.score-82 {background-color: #FFFF1b;}\n.cython.score-83 {background-color: #FFFF1b;}\n.cython.score-84 {background-color: #FFFF1b;}\n.cython.score-85 {background-color: #FFFF1a;}\n.cython.score-86 {background-color: #FFFF1a;}\n.cython.score-87 {background-color: #FFFF1a;}\n.cython.score-88 {background-color: #FFFF1a;}\n.cython.score-89 {background-color: #FFFF19;}\n.cython.score-90 {background-color: #FFFF19;}\n.cython.score-91 {background-color: #FFFF19;}\n.cython.score-92 {background-color: #FFFF19;}\n.cython.score-93 {background-color: #FFFF18;}\n.cython.score-94 {background-color: #FFFF18;}\n.cython.score-95 {background-color: #FFFF18;}\n.cython.score-96 {background-color: #FFFF18;}\n.cython.score-97 {background-color: #FFFF17;}\n.cython.score-98 {background-color: #FFFF17;}\n.cython.score-99 {background-color: #FFFF17;}\n.cython.score-100 {background-color: #FFFF17;}\n.cython.score-101 {background-color: #FFFF16;}\n.cython.score-102 {background-color: #FFFF16;}\n.cython.score-103 {background-color: #FFFF16;}\n.cython.score-104 {background-color: #FFFF16;}\n.cython.score-105 {background-color: #FFFF16;}\n.cython.score-106 {background-color: #FFFF15;}\n.cython.score-107 {background-color: #FFFF15;}\n.cython.score-108 {background-color: #FFFF15;}\n.cython.score-109 {background-color: #FFFF15;}\n.cython.score-110 {background-color: #FFFF15;}\n.cython.score-111 {background-color: #FFFF15;}\n.cython.score-112 {background-color: #FFFF14;}\n.cython.score-113 {background-color: #FFFF14;}\n.cython.score-114 {background-color: #FFFF14;}\n.cython.score-115 {background-color: #FFFF14;}\n.cython.score-116 {background-color: #FFFF14;}\n.cython.score-117 {background-color: #FFFF14;}\n.cython.score-118 {background-color: #FFFF13;}\n.cython.score-119 {background-color: #FFFF13;}\n.cython.score-120 {background-color: #FFFF13;}\n.cython.score-121 {background-color: #FFFF13;}\n.cython.score-122 {background-color: #FFFF13;}\n.cython.score-123 {background-color: #FFFF13;}\n.cython.score-124 {background-color: #FFFF13;}\n.cython.score-125 {background-color: #FFFF12;}\n.cython.score-126 {background-color: #FFFF12;}\n.cython.score-127 {background-color: #FFFF12;}\n.cython.score-128 {background-color: #FFFF12;}\n.cython.score-129 {background-color: #FFFF12;}\n.cython.score-130 {background-color: #FFFF12;}\n.cython.score-131 {background-color: #FFFF12;}\n.cython.score-132 {background-color: #FFFF11;}\n.cython.score-133 {background-color: #FFFF11;}\n.cython.score-134 {background-color: #FFFF11;}\n.cython.score-135 {background-color: #FFFF11;}\n.cython.score-136 {background-color: #FFFF11;}\n.cython.score-137 {background-color: #FFFF11;}\n.cython.score-138 {background-color: #FFFF11;}\n.cython.score-139 {background-color: #FFFF11;}\n.cython.score-140 {background-color: #FFFF11;}\n.cython.score-141 {background-color: #FFFF10;}\n.cython.score-142 {background-color: #FFFF10;}\n.cython.score-143 {background-color: #FFFF10;}\n.cython.score-144 {background-color: #FFFF10;}\n.cython.score-145 {background-color: #FFFF10;}\n.cython.score-146 {background-color: #FFFF10;}\n.cython.score-147 {background-color: #FFFF10;}\n.cython.score-148 {background-color: #FFFF10;}\n.cython.score-149 {background-color: #FFFF10;}\n.cython.score-150 {background-color: #FFFF0f;}\n.cython.score-151 {background-color: #FFFF0f;}\n.cython.score-152 {background-color: #FFFF0f;}\n.cython.score-153 {background-color: #FFFF0f;}\n.cython.score-154 {background-color: #FFFF0f;}\n.cython.score-155 {background-color: #FFFF0f;}\n.cython.score-156 {background-color: #FFFF0f;}\n.cython.score-157 {background-color: #FFFF0f;}\n.cython.score-158 {background-color: #FFFF0f;}\n.cython.score-159 {background-color: #FFFF0f;}\n.cython.score-160 {background-color: #FFFF0f;}\n.cython.score-161 {background-color: #FFFF0e;}\n.cython.score-162 {background-color: #FFFF0e;}\n.cython.score-163 {background-color: #FFFF0e;}\n.cython.score-164 {background-color: #FFFF0e;}\n.cython.score-165 {background-color: #FFFF0e;}\n.cython.score-166 {background-color: #FFFF0e;}\n.cython.score-167 {background-color: #FFFF0e;}\n.cython.score-168 {background-color: #FFFF0e;}\n.cython.score-169 {background-color: #FFFF0e;}\n.cython.score-170 {background-color: #FFFF0e;}\n.cython.score-171 {background-color: #FFFF0e;}\n.cython.score-172 {background-color: #FFFF0e;}\n.cython.score-173 {background-color: #FFFF0d;}\n.cython.score-174 {background-color: #FFFF0d;}\n.cython.score-175 {background-color: #FFFF0d;}\n.cython.score-176 {background-color: #FFFF0d;}\n.cython.score-177 {background-color: #FFFF0d;}\n.cython.score-178 {background-color: #FFFF0d;}\n.cython.score-179 {background-color: #FFFF0d;}\n.cython.score-180 {background-color: #FFFF0d;}\n.cython.score-181 {background-color: #FFFF0d;}\n.cython.score-182 {background-color: #FFFF0d;}\n.cython.score-183 {background-color: #FFFF0d;}\n.cython.score-184 {background-color: #FFFF0d;}\n.cython.score-185 {background-color: #FFFF0d;}\n.cython.score-186 {background-color: #FFFF0d;}\n.cython.score-187 {background-color: #FFFF0c;}\n.cython.score-188 {background-color: #FFFF0c;}\n.cython.score-189 {background-color: #FFFF0c;}\n.cython.score-190 {background-color: #FFFF0c;}\n.cython.score-191 {background-color: #FFFF0c;}\n.cython.score-192 {background-color: #FFFF0c;}\n.cython.score-193 {background-color: #FFFF0c;}\n.cython.score-194 {background-color: #FFFF0c;}\n.cython.score-195 {background-color: #FFFF0c;}\n.cython.score-196 {background-color: #FFFF0c;}\n.cython.score-197 {background-color: #FFFF0c;}\n.cython.score-198 {background-color: #FFFF0c;}\n.cython.score-199 {background-color: #FFFF0c;}\n.cython.score-200 {background-color: #FFFF0c;}\n.cython.score-201 {background-color: #FFFF0c;}\n.cython.score-202 {background-color: #FFFF0c;}\n.cython.score-203 {background-color: #FFFF0b;}\n.cython.score-204 {background-color: #FFFF0b;}\n.cython.score-205 {background-color: #FFFF0b;}\n.cython.score-206 {background-color: #FFFF0b;}\n.cython.score-207 {background-color: #FFFF0b;}\n.cython.score-208 {background-color: #FFFF0b;}\n.cython.score-209 {background-color: #FFFF0b;}\n.cython.score-210 {background-color: #FFFF0b;}\n.cython.score-211 {background-color: #FFFF0b;}\n.cython.score-212 {background-color: #FFFF0b;}\n.cython.score-213 {background-color: #FFFF0b;}\n.cython.score-214 {background-color: #FFFF0b;}\n.cython.score-215 {background-color: #FFFF0b;}\n.cython.score-216 {background-color: #FFFF0b;}\n.cython.score-217 {background-color: #FFFF0b;}\n.cython.score-218 {background-color: #FFFF0b;}\n.cython.score-219 {background-color: #FFFF0b;}\n.cython.score-220 {background-color: #FFFF0b;}\n.cython.score-221 {background-color: #FFFF0b;}\n.cython.score-222 {background-color: #FFFF0a;}\n.cython.score-223 {background-color: #FFFF0a;}\n.cython.score-224 {background-color: #FFFF0a;}\n.cython.score-225 {background-color: #FFFF0a;}\n.cython.score-226 {background-color: #FFFF0a;}\n.cython.score-227 {background-color: #FFFF0a;}\n.cython.score-228 {background-color: #FFFF0a;}\n.cython.score-229 {background-color: #FFFF0a;}\n.cython.score-230 {background-color: #FFFF0a;}\n.cython.score-231 {background-color: #FFFF0a;}\n.cython.score-232 {background-color: #FFFF0a;}\n.cython.score-233 {background-color: #FFFF0a;}\n.cython.score-234 {background-color: #FFFF0a;}\n.cython.score-235 {background-color: #FFFF0a;}\n.cython.score-236 {background-color: #FFFF0a;}\n.cython.score-237 {background-color: #FFFF0a;}\n.cython.score-238 {background-color: #FFFF0a;}\n.cython.score-239 {background-color: #FFFF0a;}\n.cython.score-240 {background-color: #FFFF0a;}\n.cython.score-241 {background-color: #FFFF0a;}\n.cython.score-242 {background-color: #FFFF0a;}\n.cython.score-243 {background-color: #FFFF0a;}\n.cython.score-244 {background-color: #FFFF0a;}\n.cython.score-245 {background-color: #FFFF0a;}\n.cython.score-246 {background-color: #FFFF09;}\n.cython.score-247 {background-color: #FFFF09;}\n.cython.score-248 {background-color: #FFFF09;}\n.cython.score-249 {background-color: #FFFF09;}\n.cython.score-250 {background-color: #FFFF09;}\n.cython.score-251 {background-color: #FFFF09;}\n.cython.score-252 {background-color: #FFFF09;}\n.cython.score-253 {background-color: #FFFF09;}\n.cython.score-254 {background-color: #FFFF09;}\n.cython .hll { background-color: #ffffcc }\n.cython { background: #f8f8f8; }\n.cython .c { color: #408080; font-style: italic } /* Comment */\n.cython .err { border: 1px solid #FF0000 } /* Error */\n.cython .k { color: #008000; font-weight: bold } /* Keyword */\n.cython .o { color: #666666 } /* Operator */\n.cython .ch { color: #408080; font-style: italic } /* Comment.Hashbang */\n.cython .cm { color: #408080; font-style: italic } /* Comment.Multiline */\n.cython .cp { color: #BC7A00 } /* Comment.Preproc */\n.cython .cpf { color: #408080; font-style: italic } /* Comment.PreprocFile */\n.cython .c1 { color: #408080; font-style: italic } /* Comment.Single */\n.cython .cs { color: #408080; font-style: italic } /* Comment.Special */\n.cython .gd { color: #A00000 } /* Generic.Deleted */\n.cython .ge { font-style: italic } /* Generic.Emph */\n.cython .gr { color: #FF0000 } /* Generic.Error */\n.cython .gh { color: #000080; font-weight: bold } /* Generic.Heading */\n.cython .gi { color: #00A000 } /* Generic.Inserted */\n.cython .go { color: #888888 } /* Generic.Output */\n.cython .gp { color: #000080; font-weight: bold } /* Generic.Prompt */\n.cython .gs { font-weight: bold } /* Generic.Strong */\n.cython .gu { color: #800080; font-weight: bold } /* Generic.Subheading */\n.cython .gt { color: #0044DD } /* Generic.Traceback */\n.cython .kc { color: #008000; font-weight: bold } /* Keyword.Constant */\n.cython .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */\n.cython .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */\n.cython .kp { color: #008000 } /* Keyword.Pseudo */\n.cython .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */\n.cython .kt { color: #B00040 } /* Keyword.Type */\n.cython .m { color: #666666 } /* Literal.Number */\n.cython .s { color: #BA2121 } /* Literal.String */\n.cython .na { color: #7D9029 } /* Name.Attribute */\n.cython .nb { color: #008000 } /* Name.Builtin */\n.cython .nc { color: #0000FF; font-weight: bold } /* Name.Class */\n.cython .no { color: #880000 } /* Name.Constant */\n.cython .nd { color: #AA22FF } /* Name.Decorator */\n.cython .ni { color: #999999; font-weight: bold } /* Name.Entity */\n.cython .ne { color: #D2413A; font-weight: bold } /* Name.Exception */\n.cython .nf { color: #0000FF } /* Name.Function */\n.cython .nl { color: #A0A000 } /* Name.Label */\n.cython .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */\n.cython .nt { color: #008000; font-weight: bold } /* Name.Tag */\n.cython .nv { color: #19177C } /* Name.Variable */\n.cython .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */\n.cython .w { color: #bbbbbb } /* Text.Whitespace */\n.cython .mb { color: #666666 } /* Literal.Number.Bin */\n.cython .mf { color: #666666 } /* Literal.Number.Float */\n.cython .mh { color: #666666 } /* Literal.Number.Hex */\n.cython .mi { color: #666666 } /* Literal.Number.Integer */\n.cython .mo { color: #666666 } /* Literal.Number.Oct */\n.cython .sb { color: #BA2121 } /* Literal.String.Backtick */\n.cython .sc { color: #BA2121 } /* Literal.String.Char */\n.cython .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */\n.cython .s2 { color: #BA2121 } /* Literal.String.Double */\n.cython .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */\n.cython .sh { color: #BA2121 } /* Literal.String.Heredoc */\n.cython .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */\n.cython .sx { color: #008000 } /* Literal.String.Other */\n.cython .sr { color: #BB6688 } /* Literal.String.Regex */\n.cython .s1 { color: #BA2121 } /* Literal.String.Single */\n.cython .ss { color: #19177C } /* Literal.String.Symbol */\n.cython .bp { color: #008000 } /* Name.Builtin.Pseudo */\n.cython .vc { color: #19177C } /* Name.Variable.Class */\n.cython .vg { color: #19177C } /* Name.Variable.Global */\n.cython .vi { color: #19177C } /* Name.Variable.Instance */\n.cython .il { color: #666666 } /* Literal.Number.Integer.Long */\n </style>\n <script>\n function toggleDiv(id) {\n theDiv = id.nextElementSibling\n if (theDiv.style.display != 'block') theDiv.style.display = 'block';\n else theDiv.style.display = 'none';\n }\n </script>\n</head>\n<body class=\"cython\">\n<p><span style=\"border-bottom: solid 1px grey;\">Generated by Cython 0.25.2</span></p>\n<p>\n <span style=\"background-color: #FFFF00\">Yellow lines</span> hint at Python interaction.<br />\n Click on a line that starts with a \"<code>+</code>\" to see the C code that Cython generated for it.\n</p>\n<div class=\"cython\"><pre class=\"cython line score-0\"> <span class=\"\">01</span>: </pre>\n<pre class=\"cython line score-11\" onclick='toggleDiv(this)'>+<span class=\"\">02</span>: <span class=\"k\">import</span> <span class=\"nn\">cython</span></pre>\n<pre class='cython code score-11 '> __pyx_t_2 = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n</pre><pre class=\"cython line score-8\" onclick='toggleDiv(this)'>+<span class=\"\">03</span>: <span class=\"k\">import</span> <span class=\"nn\">numpy</span> <span class=\"k\">as</span> <span class=\"nn\">np</span></pre>\n<pre class='cython code score-8 '> __pyx_t_1 = <span class='pyx_c_api'>__Pyx_Import</span>(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;\n</pre><pre class=\"cython line score-0\"> <span class=\"\">04</span>: <span class=\"k\">cimport</span> <span class=\"nn\">numpy</span> <span class=\"k\">as</span> <span class=\"nn\">np</span></pre>\n<pre class=\"cython line score-11\" onclick='toggleDiv(this)'>+<span class=\"\">05</span>: <span class=\"n\">DTYPE</span> <span class=\"o\">=</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">float64</span></pre>\n<pre class='cython code score-11 '> __pyx_t_1 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);\n __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_1); __pyx_t_1 = 0;\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n</pre><pre class=\"cython line score-0\"> <span class=\"\">06</span>: <span class=\"k\">ctypedef</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">float64_t</span> <span class=\"n\">DTYPE_t</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">07</span>: </pre>\n<pre class=\"cython line score-0\"> <span class=\"\">08</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">boundscheck</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">09</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">wraparound</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">10</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">profile</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">11</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">optimize</span><span class=\"o\">.</span><span class=\"n\">unpack_method_calls</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-19\" onclick='toggleDiv(this)'>+<span class=\"\">12</span>: <span class=\"k\">cdef</span> <span class=\"kt\">np</span>.<span class=\"kt\">ndarray</span>[<span class=\"kt\">np</span>.<span class=\"nf\">complex128_t</span><span class=\"p\">,</span> <span class=\"nf\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">f</span><span class=\"p\">(</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">ndarray</span><span class=\"p\">[</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">complex128_t</span><span class=\"p\">,</span> <span class=\"n\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">_x</span><span class=\"p\">,</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">ndarray</span><span class=\"p\">[</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">complex128_t</span><span class=\"p\">,</span> <span class=\"n\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">z</span><span class=\"p\">):</span></pre>\n<pre class='cython code score-19 '>static PyArrayObject *__pyx_f_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_f(PyArrayObject *__pyx_v__x, PyArrayObject *__pyx_v_z) {\n __Pyx_LocalBuf_ND __pyx_pybuffernd__x;\n __Pyx_Buffer __pyx_pybuffer__x;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_z;\n __Pyx_Buffer __pyx_pybuffer_z;\n PyArrayObject *__pyx_r = NULL;\n <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"f\", 0);\n __pyx_pybuffer__x.pybuffer.buf = NULL;\n __pyx_pybuffer__x.refcount = 0;\n __pyx_pybuffernd__x.data = NULL;\n __pyx_pybuffernd__x.rcbuffer = &__pyx_pybuffer__x;\n __pyx_pybuffer_z.pybuffer.buf = NULL;\n __pyx_pybuffer_z.refcount = 0;\n __pyx_pybuffernd_z.data = NULL;\n __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd__x.rcbuffer->pybuffer, (PyObject*)__pyx_v__x, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 12, __pyx_L1_error)\n }\n __pyx_pybuffernd__x.diminfo[0].strides = __pyx_pybuffernd__x.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__x.diminfo[0].shape = __pyx_pybuffernd__x.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd__x.diminfo[1].strides = __pyx_pybuffernd__x.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd__x.diminfo[1].shape = __pyx_pybuffernd__x.rcbuffer->pybuffer.shape[1];\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_v_z, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 12, __pyx_L1_error)\n }\n __pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_z.diminfo[1].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_z.diminfo[1].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[1];\n/* … */\n /* function exit code */\n __pyx_L1_error:;\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_1);\n { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;\n __Pyx_PyThreadState_declare\n __Pyx_PyThreadState_assign\n <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_type, &__pyx_value, &__pyx_tb);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd__x.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_z.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_type, __pyx_value, __pyx_tb);}\n <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02.f\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n __pyx_r = 0;\n goto __pyx_L2;\n __pyx_L0:;\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd__x.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_z.rcbuffer->pybuffer);\n __pyx_L2:;\n <span class='refnanny'>__Pyx_XGIVEREF</span>((PyObject *)__pyx_r);\n <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n return __pyx_r;\n}\n</pre><pre class=\"cython line score-0\"> <span class=\"\">13</span>: <span class=\"c\"># Iteration function used to compute successive iterations of the fractal set</span></pre>\n<pre class=\"cython line score-8\" onclick='toggleDiv(this)'>+<span class=\"\">14</span>: <span class=\"k\">return</span> <span class=\"n\">z</span><span class=\"o\">**</span><span class=\"n\">_x</span></pre>\n<pre class='cython code score-8 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(((PyObject *)__pyx_r));\n __pyx_t_1 = <span class='py_c_api'>PyNumber_Power</span>(((PyObject *)__pyx_v_z), ((PyObject *)__pyx_v__x), Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_1);\n if (!(likely(((__pyx_t_1) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 14, __pyx_L1_error)\n __pyx_r = ((PyArrayObject *)__pyx_t_1);\n __pyx_t_1 = 0;\n goto __pyx_L0;\n</pre><pre class=\"cython line score-0\"> <span class=\"\">15</span>: </pre>\n<pre class=\"cython line score-0\"> <span class=\"\">16</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">boundscheck</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">17</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">wraparound</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">18</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">profile</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">19</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">optimize</span><span class=\"o\">.</span><span class=\"n\">unpack_method_calls</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">20</span>: <span class=\"nd\">@cython</span><span class=\"o\">.</span><span class=\"n\">initializedcheck</span><span class=\"p\">(</span><span class=\"bp\">False</span><span class=\"p\">)</span></pre>\n<pre class=\"cython line score-119\" onclick='toggleDiv(this)'>+<span class=\"\">21</span>: <span class=\"k\">def</span> <span class=\"nf\">fractalVals</span><span class=\"p\">(</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">ndarray</span><span class=\"p\">[</span><span class=\"n\">DTYPE_t</span><span class=\"p\">,</span> <span class=\"n\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">zRe</span><span class=\"p\">,</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">ndarray</span><span class=\"p\">[</span><span class=\"n\">DTYPE_t</span><span class=\"p\">,</span> <span class=\"n\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">zIm</span><span class=\"p\">,</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">int32_t</span> <span class=\"n\">iterations</span><span class=\"p\">,</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">complex128_t</span> <span class=\"n\">z_0</span><span class=\"o\">=</span><span class=\"mf\">1</span><span class=\"p\">):</span></pre>\n<pre class='cython code score-119 '>/* Python wrapper */\nstatic PyObject *__pyx_pw_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_1fractalVals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/\nstatic PyMethodDef __pyx_mdef_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_1fractalVals = {\"fractalVals\", (PyCFunction)__pyx_pw_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_1fractalVals, METH_VARARGS|METH_KEYWORDS, 0};\nstatic PyObject *__pyx_pw_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_1fractalVals(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {\n PyArrayObject *__pyx_v_zRe = 0;\n PyArrayObject *__pyx_v_zIm = 0;\n __pyx_t_5numpy_int32_t __pyx_v_iterations;\n __pyx_t_double_complex __pyx_v_z_0;\n PyObject *__pyx_r = 0;\n <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"fractalVals (wrapper)\", 0);\n {\n static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_zRe,&__pyx_n_s_zIm,&__pyx_n_s_iterations,&__pyx_n_s_z_0,0};\n PyObject* values[4] = {0,0,0,0};\n if (unlikely(__pyx_kwds)) {\n Py_ssize_t kw_args;\n const Py_ssize_t pos_args = <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args);\n switch (pos_args) {\n case 4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3);\n case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2);\n case 2: values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1);\n case 1: values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0);\n case 0: break;\n default: goto __pyx_L5_argtuple_error;\n }\n kw_args = <span class='py_c_api'>PyDict_Size</span>(__pyx_kwds);\n switch (pos_args) {\n case 0:\n if (likely((values[0] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_zRe)) != 0)) kw_args--;\n else goto __pyx_L5_argtuple_error;\n case 1:\n if (likely((values[1] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_zIm)) != 0)) kw_args--;\n else {\n <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"fractalVals\", 0, 3, 4, 1); __PYX_ERR(0, 21, __pyx_L3_error)\n }\n case 2:\n if (likely((values[2] = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_iterations)) != 0)) kw_args--;\n else {\n <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"fractalVals\", 0, 3, 4, 2); __PYX_ERR(0, 21, __pyx_L3_error)\n }\n case 3:\n if (kw_args > 0) {\n PyObject* value = <span class='py_c_api'>PyDict_GetItem</span>(__pyx_kwds, __pyx_n_s_z_0);\n if (value) { values[3] = value; kw_args--; }\n }\n }\n if (unlikely(kw_args > 0)) {\n if (unlikely(<span class='pyx_c_api'>__Pyx_ParseOptionalKeywords</span>(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, \"fractalVals\") < 0)) __PYX_ERR(0, 21, __pyx_L3_error)\n }\n } else {\n switch (<span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)) {\n case 4: values[3] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 3);\n case 3: values[2] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 2);\n values[1] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 1);\n values[0] = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_args, 0);\n break;\n default: goto __pyx_L5_argtuple_error;\n }\n }\n __pyx_v_zRe = ((PyArrayObject *)values[0]);\n __pyx_v_zIm = ((PyArrayObject *)values[1]);\n __pyx_v_iterations = __Pyx_PyInt_As_npy_int32(values[2]); if (unlikely((__pyx_v_iterations == ((npy_int32)-1)) && <span class='py_c_api'>PyErr_Occurred</span>())) __PYX_ERR(0, 21, __pyx_L3_error)\n if (values[3]) {\n __pyx_v_z_0 = <span class='pyx_c_api'>__Pyx_PyComplex_As___pyx_t_double_complex</span>(values[3]); if (unlikely(<span class='py_c_api'>PyErr_Occurred</span>())) __PYX_ERR(0, 21, __pyx_L3_error)\n } else {\n __pyx_v_z_0 = __pyx_k_;\n }\n }\n goto __pyx_L4_argument_unpacking_done;\n __pyx_L5_argtuple_error:;\n <span class='pyx_c_api'>__Pyx_RaiseArgtupleInvalid</span>(\"fractalVals\", 0, 3, 4, <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_args)); __PYX_ERR(0, 21, __pyx_L3_error)\n __pyx_L3_error:;\n <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02.fractalVals\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n return NULL;\n __pyx_L4_argument_unpacking_done:;\n if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_zRe), __pyx_ptype_5numpy_ndarray, 1, \"zRe\", 0))) __PYX_ERR(0, 21, __pyx_L1_error)\n if (unlikely(!<span class='pyx_c_api'>__Pyx_ArgTypeTest</span>(((PyObject *)__pyx_v_zIm), __pyx_ptype_5numpy_ndarray, 1, \"zIm\", 0))) __PYX_ERR(0, 21, __pyx_L1_error)\n __pyx_r = __pyx_pf_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_fractalVals(__pyx_self, __pyx_v_zRe, __pyx_v_zIm, __pyx_v_iterations, __pyx_v_z_0);\n\n /* function exit code */\n goto __pyx_L0;\n __pyx_L1_error:;\n __pyx_r = NULL;\n __pyx_L0:;\n <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n return __pyx_r;\n}\n\nstatic PyObject *__pyx_pf_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_fractalVals(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_zRe, PyArrayObject *__pyx_v_zIm, __pyx_t_5numpy_int32_t __pyx_v_iterations, __pyx_t_double_complex __pyx_v_z_0) {\n PyArrayObject *__pyx_v_z = 0;\n PyArrayObject *__pyx_v_X_n = 0;\n PyArrayObject *__pyx_v_temp_n = 0;\n PyArrayObject *__pyx_v_resArray = 0;\n __pyx_t_5numpy_int32_t __pyx_v_n;\n PyObject *__pyx_v_i = NULL;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_X_n;\n __Pyx_Buffer __pyx_pybuffer_X_n;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_resArray;\n __Pyx_Buffer __pyx_pybuffer_resArray;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_temp_n;\n __Pyx_Buffer __pyx_pybuffer_temp_n;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_z;\n __Pyx_Buffer __pyx_pybuffer_z;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_zIm;\n __Pyx_Buffer __pyx_pybuffer_zIm;\n __Pyx_LocalBuf_ND __pyx_pybuffernd_zRe;\n __Pyx_Buffer __pyx_pybuffer_zRe;\n PyObject *__pyx_r = NULL;\n <span class='refnanny'>__Pyx_RefNannyDeclarations</span>\n <span class='refnanny'>__Pyx_RefNannySetupContext</span>(\"fractalVals\", 0);\n __pyx_pybuffer_z.pybuffer.buf = NULL;\n __pyx_pybuffer_z.refcount = 0;\n __pyx_pybuffernd_z.data = NULL;\n __pyx_pybuffernd_z.rcbuffer = &__pyx_pybuffer_z;\n __pyx_pybuffer_X_n.pybuffer.buf = NULL;\n __pyx_pybuffer_X_n.refcount = 0;\n __pyx_pybuffernd_X_n.data = NULL;\n __pyx_pybuffernd_X_n.rcbuffer = &__pyx_pybuffer_X_n;\n __pyx_pybuffer_temp_n.pybuffer.buf = NULL;\n __pyx_pybuffer_temp_n.refcount = 0;\n __pyx_pybuffernd_temp_n.data = NULL;\n __pyx_pybuffernd_temp_n.rcbuffer = &__pyx_pybuffer_temp_n;\n __pyx_pybuffer_resArray.pybuffer.buf = NULL;\n __pyx_pybuffer_resArray.refcount = 0;\n __pyx_pybuffernd_resArray.data = NULL;\n __pyx_pybuffernd_resArray.rcbuffer = &__pyx_pybuffer_resArray;\n __pyx_pybuffer_zRe.pybuffer.buf = NULL;\n __pyx_pybuffer_zRe.refcount = 0;\n __pyx_pybuffernd_zRe.data = NULL;\n __pyx_pybuffernd_zRe.rcbuffer = &__pyx_pybuffer_zRe;\n __pyx_pybuffer_zIm.pybuffer.buf = NULL;\n __pyx_pybuffer_zIm.refcount = 0;\n __pyx_pybuffernd_zIm.data = NULL;\n __pyx_pybuffernd_zIm.rcbuffer = &__pyx_pybuffer_zIm;\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_zRe.rcbuffer->pybuffer, (PyObject*)__pyx_v_zRe, &__Pyx_TypeInfo_nn___pyx_t_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 21, __pyx_L1_error)\n }\n __pyx_pybuffernd_zRe.diminfo[0].strides = __pyx_pybuffernd_zRe.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zRe.diminfo[0].shape = __pyx_pybuffernd_zRe.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_zRe.diminfo[1].strides = __pyx_pybuffernd_zRe.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_zRe.diminfo[1].shape = __pyx_pybuffernd_zRe.rcbuffer->pybuffer.shape[1];\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_zIm.rcbuffer->pybuffer, (PyObject*)__pyx_v_zIm, &__Pyx_TypeInfo_nn___pyx_t_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 21, __pyx_L1_error)\n }\n __pyx_pybuffernd_zIm.diminfo[0].strides = __pyx_pybuffernd_zIm.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_zIm.diminfo[0].shape = __pyx_pybuffernd_zIm.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_zIm.diminfo[1].strides = __pyx_pybuffernd_zIm.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_zIm.diminfo[1].shape = __pyx_pybuffernd_zIm.rcbuffer->pybuffer.shape[1];\n/* … */\n /* function exit code */\n __pyx_L1_error:;\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_2);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_3);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_7);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_8);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_t_9);\n { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;\n __Pyx_PyThreadState_declare\n __Pyx_PyThreadState_assign\n <span class='pyx_c_api'>__Pyx_ErrFetch</span>(&__pyx_type, &__pyx_value, &__pyx_tb);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_X_n.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_resArray.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_temp_n.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_z.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_zIm.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_zRe.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_ErrRestore</span>(__pyx_type, __pyx_value, __pyx_tb);}\n <span class='pyx_c_api'>__Pyx_AddTraceback</span>(\"_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02.fractalVals\", __pyx_clineno, __pyx_lineno, __pyx_filename);\n __pyx_r = NULL;\n goto __pyx_L2;\n __pyx_L0:;\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_X_n.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_resArray.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_temp_n.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_z.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_zIm.rcbuffer->pybuffer);\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_zRe.rcbuffer->pybuffer);\n __pyx_L2:;\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_z);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_X_n);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_temp_n);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>((PyObject *)__pyx_v_resArray);\n <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_v_i);\n <span class='refnanny'>__Pyx_XGIVEREF</span>(__pyx_r);\n <span class='refnanny'>__Pyx_RefNannyFinishContext</span>();\n return __pyx_r;\n}\n/* … */\n __pyx_k_ = __pyx_t_double_complex_from_parts(1, 0);\n/* … */\n __pyx_tuple__11 = <span class='py_c_api'>PyTuple_Pack</span>(10, __pyx_n_s_zRe, __pyx_n_s_zIm, __pyx_n_s_iterations, __pyx_n_s_z_0, __pyx_n_s_z, __pyx_n_s_X_n, __pyx_n_s_temp_n, __pyx_n_s_resArray, __pyx_n_s_n, __pyx_n_s_i); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 21, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_tuple__11);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_tuple__11);\n __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_1fractalVals, NULL, __pyx_n_s_cython_magic_0b7d2e9dada1313c8a); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_d, __pyx_n_s_fractalVals, __pyx_t_2) < 0) __PYX_ERR(0, 21, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n</pre><pre class=\"cython line score-0\"> <span class=\"\">22</span>: </pre>\n<pre class=\"cython line score-0\"> <span class=\"\">23</span>: <span class=\"c\"># Iterations controls the total number of iterations used to compute the set</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">24</span>: <span class=\"c\"># z_0 is a control parameter that allows one to vary the initial state by some complex number</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">25</span>: <span class=\"c\"># Which then can create effects like swirling the original fractal pattern</span></pre>\n<pre class=\"cython line score-0\"> <span class=\"\">26</span>: </pre>\n<pre class=\"cython line score-33\" onclick='toggleDiv(this)'>+<span class=\"\">27</span>: <span class=\"k\">assert</span> <span class=\"n\">zRe</span><span class=\"o\">.</span><span class=\"n\">dtype</span> <span class=\"o\">==</span> <span class=\"n\">DTYPE</span> <span class=\"ow\">and</span> <span class=\"n\">zIm</span><span class=\"o\">.</span><span class=\"n\">dtype</span> <span class=\"o\">==</span> <span class=\"n\">DTYPE</span></pre>\n<pre class='cython code score-33 '> #ifndef CYTHON_WITHOUT_ASSERTIONS\n if (unlikely(!Py_OptimizeFlag)) {\n __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_zRe), __pyx_n_s_dtype); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n __pyx_t_4 = <span class='py_c_api'>PyObject_RichCompare</span>(__pyx_t_2, __pyx_t_3, Py_EQ); <span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_IsTrue</span>(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n if (__pyx_t_5) {\n } else {\n __pyx_t_1 = __pyx_t_5;\n goto __pyx_L3_bool_binop_done;\n }\n __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(((PyObject *)__pyx_v_zIm), __pyx_n_s_dtype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n __pyx_t_2 = <span class='py_c_api'>PyObject_RichCompare</span>(__pyx_t_4, __pyx_t_3, Py_EQ); <span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n __pyx_t_5 = <span class='pyx_c_api'>__Pyx_PyObject_IsTrue</span>(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 27, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n __pyx_t_1 = __pyx_t_5;\n __pyx_L3_bool_binop_done:;\n if (unlikely(!__pyx_t_1)) {\n <span class='py_c_api'>PyErr_SetNone</span>(PyExc_AssertionError);\n __PYX_ERR(0, 27, __pyx_L1_error)\n }\n }\n #endif\n</pre><pre class=\"cython line score-102\" onclick='toggleDiv(this)'>+<span class=\"\">28</span>: <span class=\"k\">cdef</span> <span class=\"kt\">np</span>.<span class=\"kt\">ndarray</span>[<span class=\"kt\">np</span>.<span class=\"nf\">complex128_t</span><span class=\"p\">,</span> <span class=\"nf\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">z</span> <span class=\"o\">=</span> <span class=\"n\">z_0</span><span class=\"o\">*</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">array</span><span class=\"p\">(</span><span class=\"n\">zRe</span><span class=\"p\">,</span> <span class=\"n\">dtype</span><span class=\"o\">=</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">complex128</span><span class=\"p\">)</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"n\">j</span><span class=\"o\">*</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">array</span><span class=\"p\">(</span><span class=\"n\">zIm</span><span class=\"p\">,</span> <span class=\"n\">dtype</span><span class=\"o\">=</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">complex128</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-102 '> __pyx_t_2 = __pyx_<span class='py_c_api'>PyComplex_FromComplex</span>(__pyx_v_z_0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n __pyx_t_3 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n __pyx_t_3 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_zRe));\n <span class='refnanny'>__Pyx_GIVEREF</span>(((PyObject *)__pyx_v_zRe));\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_3, 0, ((PyObject *)__pyx_v_zRe));\n __pyx_t_6 = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_7 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n __pyx_t_8 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_7, __pyx_n_s_complex128); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_8) < 0) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n __pyx_t_8 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_4, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n __pyx_t_8 = <span class='py_c_api'>PyComplex_FromDoubles</span>(0.0, 1.0); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n __pyx_t_2 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_zIm));\n <span class='refnanny'>__Pyx_GIVEREF</span>(((PyObject *)__pyx_v_zIm));\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, ((PyObject *)__pyx_v_zIm));\n __pyx_t_4 = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n __pyx_t_7 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_7, __pyx_n_s_complex128); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_7); __pyx_t_7 = 0;\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_3, __pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n __pyx_t_4 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_8, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n __pyx_t_9 = <span class='py_c_api'>PyNumber_Add</span>(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 28, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n if (!(likely(((__pyx_t_9) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 28, __pyx_L1_error)\n __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_z.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {\n __pyx_v_z = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_pybuffernd_z.rcbuffer->pybuffer.buf = NULL;\n __PYX_ERR(0, 28, __pyx_L1_error)\n } else {__pyx_pybuffernd_z.diminfo[0].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_z.diminfo[0].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_z.diminfo[1].strides = __pyx_pybuffernd_z.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_z.diminfo[1].shape = __pyx_pybuffernd_z.rcbuffer->pybuffer.shape[1];\n }\n }\n __pyx_t_10 = 0;\n __pyx_v_z = ((PyArrayObject *)__pyx_t_9);\n __pyx_t_9 = 0;\n</pre><pre class=\"cython line score-34\" onclick='toggleDiv(this)'>+<span class=\"\">29</span>: <span class=\"k\">cdef</span> <span class=\"kt\">np</span>.<span class=\"kt\">ndarray</span>[<span class=\"kt\">np</span>.<span class=\"nf\">complex128_t</span><span class=\"p\">,</span> <span class=\"nf\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">X_n</span> <span class=\"o\">=</span> <span class=\"n\">z_0</span><span class=\"o\">*</span><span class=\"p\">(</span><span class=\"n\">zRe</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"n\">j</span><span class=\"o\">*</span><span class=\"n\">zIm</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-34 '> __pyx_t_9 = __pyx_<span class='py_c_api'>PyComplex_FromComplex</span>(__pyx_v_z_0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 29, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n __pyx_t_4 = <span class='py_c_api'>PyComplex_FromDoubles</span>(0.0, 1.0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n __pyx_t_6 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_4, ((PyObject *)__pyx_v_zIm)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 29, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n __pyx_t_4 = <span class='py_c_api'>PyNumber_Add</span>(((PyObject *)__pyx_v_zRe), __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 29, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 29, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n if (!(likely(((__pyx_t_6) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 29, __pyx_L1_error)\n __pyx_t_11 = ((PyArrayObject *)__pyx_t_6);\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_X_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {\n __pyx_v_X_n = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_pybuffernd_X_n.rcbuffer->pybuffer.buf = NULL;\n __PYX_ERR(0, 29, __pyx_L1_error)\n } else {__pyx_pybuffernd_X_n.diminfo[0].strides = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_n.diminfo[0].shape = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X_n.diminfo[1].strides = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X_n.diminfo[1].shape = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.shape[1];\n }\n }\n __pyx_t_11 = 0;\n __pyx_v_X_n = ((PyArrayObject *)__pyx_t_6);\n __pyx_t_6 = 0;\n</pre><pre class=\"cython line score-22\" onclick='toggleDiv(this)'>+<span class=\"\">30</span>: <span class=\"k\">cdef</span> <span class=\"kt\">np</span>.<span class=\"kt\">ndarray</span>[<span class=\"kt\">np</span>.<span class=\"nf\">complex128_t</span><span class=\"p\">,</span> <span class=\"nf\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">temp_n</span> <span class=\"o\">=</span> <span class=\"n\">zRe</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"n\">j</span><span class=\"o\">*</span><span class=\"n\">zIm</span></pre>\n<pre class='cython code score-22 '> __pyx_t_6 = <span class='py_c_api'>PyComplex_FromDoubles</span>(0.0, 1.0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_4 = <span class='py_c_api'>PyNumber_Multiply</span>(__pyx_t_6, ((PyObject *)__pyx_v_zIm)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 30, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='py_c_api'>PyNumber_Add</span>(((PyObject *)__pyx_v_zRe), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n if (!(likely(((__pyx_t_6) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 30, __pyx_L1_error)\n __pyx_t_12 = ((PyArrayObject *)__pyx_t_6);\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_temp_n.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {\n __pyx_v_temp_n = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.buf = NULL;\n __PYX_ERR(0, 30, __pyx_L1_error)\n } else {__pyx_pybuffernd_temp_n.diminfo[0].strides = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp_n.diminfo[0].shape = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_temp_n.diminfo[1].strides = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_temp_n.diminfo[1].shape = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.shape[1];\n }\n }\n __pyx_t_12 = 0;\n __pyx_v_temp_n = ((PyArrayObject *)__pyx_t_6);\n __pyx_t_6 = 0;\n</pre><pre class=\"cython line score-45\" onclick='toggleDiv(this)'>+<span class=\"\">31</span>: <span class=\"k\">cdef</span> <span class=\"kt\">np</span>.<span class=\"kt\">ndarray</span>[<span class=\"nf\">DTYPE_t</span><span class=\"p\">,</span> <span class=\"nf\">ndim</span><span class=\"o\">=</span><span class=\"mf\">2</span><span class=\"p\">]</span> <span class=\"n\">resArray</span> <span class=\"o\">=</span> <span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">zeros</span><span class=\"p\">((</span><span class=\"n\">zRe</span><span class=\"o\">.</span><span class=\"n\">shape</span><span class=\"p\">[</span><span class=\"mf\">0</span><span class=\"p\">],</span> <span class=\"n\">zIm</span><span class=\"o\">.</span><span class=\"n\">shape</span><span class=\"p\">[</span><span class=\"mf\">1</span><span class=\"p\">]),</span> <span class=\"n\">dtype</span><span class=\"o\">=</span><span class=\"n\">DTYPE</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-45 '> __pyx_t_6 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyInt_From_Py_intptr_t</span>((__pyx_v_zRe->dimensions[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyInt_From_Py_intptr_t</span>((__pyx_v_zIm->dimensions[1])); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n __pyx_t_8 = <span class='py_c_api'>PyTuple_New</span>(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_6);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_8, 0, __pyx_t_6);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_9);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_8, 1, __pyx_t_9);\n __pyx_t_6 = 0;\n __pyx_t_9 = 0;\n __pyx_t_9 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_8);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_9, 0, __pyx_t_8);\n __pyx_t_8 = 0;\n __pyx_t_8 = <span class='py_c_api'>PyDict_New</span>(); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n if (<span class='py_c_api'>PyDict_SetItem</span>(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_4, __pyx_t_9, __pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n if (!(likely(((__pyx_t_6) == Py_None) || likely(<span class='pyx_c_api'>__Pyx_TypeTest</span>(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 31, __pyx_L1_error)\n __pyx_t_13 = ((PyArrayObject *)__pyx_t_6);\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_resArray.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {\n __pyx_v_resArray = ((PyArrayObject *)Py_None); <span class='pyx_macro_api'>__Pyx_INCREF</span>(Py_None); __pyx_pybuffernd_resArray.rcbuffer->pybuffer.buf = NULL;\n __PYX_ERR(0, 31, __pyx_L1_error)\n } else {__pyx_pybuffernd_resArray.diminfo[0].strides = __pyx_pybuffernd_resArray.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_resArray.diminfo[0].shape = __pyx_pybuffernd_resArray.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_resArray.diminfo[1].strides = __pyx_pybuffernd_resArray.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_resArray.diminfo[1].shape = __pyx_pybuffernd_resArray.rcbuffer->pybuffer.shape[1];\n }\n }\n __pyx_t_13 = 0;\n __pyx_v_resArray = ((PyArrayObject *)__pyx_t_6);\n __pyx_t_6 = 0;\n</pre><pre class=\"cython line score-0\" onclick='toggleDiv(this)'>+<span class=\"\">32</span>: <span class=\"k\">cdef</span> <span class=\"kt\">np</span>.<span class=\"kt\">int32_t</span> <span class=\"nf\">n</span> <span class=\"o\">=</span> <span class=\"mf\">0</span></pre>\n<pre class='cython code score-0 '> __pyx_v_n = 0;\n</pre><pre class=\"cython line score-0\"> <span class=\"\">33</span>: </pre>\n<pre class=\"cython line score-56\" onclick='toggleDiv(this)'>+<span class=\"\">34</span>: <span class=\"k\">for</span> <span class=\"n\">i</span> <span class=\"ow\">in</span> <span class=\"nb\">range</span><span class=\"p\">(</span><span class=\"n\">iterations</span><span class=\"p\">):</span></pre>\n<pre class='cython code score-56 '> __pyx_t_6 = __Pyx_PyInt_From_npy_int32(__pyx_v_iterations); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_8 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 34, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_6);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_8, 0, __pyx_t_6);\n __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_builtin_range, __pyx_t_8, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_6)) || <span class='py_c_api'>PyTuple_CheckExact</span>(__pyx_t_6)) {\n __pyx_t_8 = __pyx_t_6; <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_8); __pyx_t_14 = 0;\n __pyx_t_15 = NULL;\n } else {\n __pyx_t_14 = -1; __pyx_t_8 = <span class='py_c_api'>PyObject_GetIter</span>(__pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 34, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n __pyx_t_15 = Py_TYPE(__pyx_t_8)->tp_iternext; if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 34, __pyx_L1_error)\n }\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n for (;;) {\n if (likely(!__pyx_t_15)) {\n if (likely(<span class='py_c_api'>PyList_CheckExact</span>(__pyx_t_8))) {\n if (__pyx_t_14 >= <span class='py_macro_api'>PyList_GET_SIZE</span>(__pyx_t_8)) break;\n #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS\n __pyx_t_6 = <span class='py_macro_api'>PyList_GET_ITEM</span>(__pyx_t_8, __pyx_t_14); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_6); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 34, __pyx_L1_error)\n #else\n __pyx_t_6 = <span class='py_macro_api'>PySequence_ITEM</span>(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n #endif\n } else {\n if (__pyx_t_14 >= <span class='py_macro_api'>PyTuple_GET_SIZE</span>(__pyx_t_8)) break;\n #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS\n __pyx_t_6 = <span class='py_macro_api'>PyTuple_GET_ITEM</span>(__pyx_t_8, __pyx_t_14); <span class='pyx_macro_api'>__Pyx_INCREF</span>(__pyx_t_6); __pyx_t_14++; if (unlikely(0 < 0)) __PYX_ERR(0, 34, __pyx_L1_error)\n #else\n __pyx_t_6 = <span class='py_macro_api'>PySequence_ITEM</span>(__pyx_t_8, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n #endif\n }\n } else {\n __pyx_t_6 = __pyx_t_15(__pyx_t_8);\n if (unlikely(!__pyx_t_6)) {\n PyObject* exc_type = <span class='py_c_api'>PyErr_Occurred</span>();\n if (exc_type) {\n if (likely(exc_type == PyExc_StopIteration || <span class='py_c_api'>PyErr_GivenExceptionMatches</span>(exc_type, PyExc_StopIteration))) <span class='py_c_api'>PyErr_Clear</span>();\n else __PYX_ERR(0, 34, __pyx_L1_error)\n }\n break;\n }\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n }\n <span class='pyx_macro_api'>__Pyx_XDECREF_SET</span>(__pyx_v_i, __pyx_t_6);\n __pyx_t_6 = 0;\n/* … */\n }\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n</pre><pre class=\"cython line score-19\" onclick='toggleDiv(this)'>+<span class=\"\">35</span>: <span class=\"n\">X_n</span> <span class=\"o\">=</span> <span class=\"n\">f</span><span class=\"p\">(</span><span class=\"n\">X_n</span><span class=\"p\">,</span> <span class=\"n\">z</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-19 '> __pyx_t_6 = ((PyObject *)__pyx_f_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_f(((PyArrayObject *)__pyx_v_X_n), ((PyArrayObject *)__pyx_v_z))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_X_n.rcbuffer->pybuffer);\n __pyx_t_16 = <span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_X_n.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_6), &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);\n if (unlikely(__pyx_t_16 < 0)) {\n <span class='py_c_api'>PyErr_Fetch</span>(&__pyx_t_17, &__pyx_t_18, &__pyx_t_19);\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_X_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_X_n, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {\n Py_XDECREF(__pyx_t_17); Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_19);\n <span class='pyx_c_api'>__Pyx_RaiseBufferFallbackError</span>();\n } else {\n <span class='py_c_api'>PyErr_Restore</span>(__pyx_t_17, __pyx_t_18, __pyx_t_19);\n }\n }\n __pyx_pybuffernd_X_n.diminfo[0].strides = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X_n.diminfo[0].shape = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X_n.diminfo[1].strides = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X_n.diminfo[1].shape = __pyx_pybuffernd_X_n.rcbuffer->pybuffer.shape[1];\n if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 35, __pyx_L1_error)\n }\n <span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_v_X_n, ((PyArrayObject *)__pyx_t_6));\n __pyx_t_6 = 0;\n</pre><pre class=\"cython line score-20\" onclick='toggleDiv(this)'>+<span class=\"\">36</span>: <span class=\"n\">temp_n</span> <span class=\"o\">=</span> <span class=\"n\">f</span><span class=\"p\">(</span><span class=\"n\">f</span><span class=\"p\">(</span><span class=\"n\">temp_n</span><span class=\"p\">,</span> <span class=\"n\">z</span><span class=\"p\">),</span> <span class=\"n\">z</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-20 '> __pyx_t_6 = ((PyObject *)__pyx_f_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_f(((PyArrayObject *)__pyx_v_temp_n), ((PyArrayObject *)__pyx_v_z))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_9 = ((PyObject *)__pyx_f_46_cython_magic_0b7d2e9dada1313c8a1bfd8400920a02_f(((PyArrayObject *)__pyx_t_6), ((PyArrayObject *)__pyx_v_z))); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 36, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n {\n __Pyx_BufFmt_StackElem __pyx_stack[1];\n <span class='pyx_c_api'>__Pyx_SafeReleaseBuffer</span>(&__pyx_pybuffernd_temp_n.rcbuffer->pybuffer);\n __pyx_t_16 = <span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_temp_n.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_9), &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack);\n if (unlikely(__pyx_t_16 < 0)) {\n <span class='py_c_api'>PyErr_Fetch</span>(&__pyx_t_19, &__pyx_t_18, &__pyx_t_17);\n if (unlikely(<span class='pyx_c_api'>__Pyx_GetBufferAndValidate</span>(&__pyx_pybuffernd_temp_n.rcbuffer->pybuffer, (PyObject*)__pyx_v_temp_n, &__Pyx_TypeInfo___pyx_t_double_complex, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {\n Py_XDECREF(__pyx_t_19); Py_XDECREF(__pyx_t_18); Py_XDECREF(__pyx_t_17);\n <span class='pyx_c_api'>__Pyx_RaiseBufferFallbackError</span>();\n } else {\n <span class='py_c_api'>PyErr_Restore</span>(__pyx_t_19, __pyx_t_18, __pyx_t_17);\n }\n }\n __pyx_pybuffernd_temp_n.diminfo[0].strides = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_temp_n.diminfo[0].shape = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_temp_n.diminfo[1].strides = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_temp_n.diminfo[1].shape = __pyx_pybuffernd_temp_n.rcbuffer->pybuffer.shape[1];\n if (unlikely(__pyx_t_16 < 0)) __PYX_ERR(0, 36, __pyx_L1_error)\n }\n <span class='pyx_macro_api'>__Pyx_DECREF_SET</span>(__pyx_v_temp_n, ((PyArrayObject *)__pyx_t_9));\n __pyx_t_9 = 0;\n</pre><pre class=\"cython line score-0\" onclick='toggleDiv(this)'>+<span class=\"\">37</span>: <span class=\"n\">n</span> <span class=\"o\">+=</span> <span class=\"mf\">2</span></pre>\n<pre class='cython code score-0 '> __pyx_v_n = (__pyx_v_n + 2);\n</pre><pre class=\"cython line score-39\" onclick='toggleDiv(this)'>+<span class=\"\">38</span>: <span class=\"n\">resArray</span><span class=\"p\">[</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">abs</span><span class=\"p\">(</span><span class=\"n\">temp_n</span> <span class=\"o\">-</span> <span class=\"n\">X_n</span><span class=\"p\">)</span> <span class=\"o\"><</span> <span class=\"mf\">5e-15</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"p\">(</span><span class=\"n\">n</span> <span class=\"o\">-</span> <span class=\"n\">i</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-39 '> __pyx_t_9 = __Pyx_PyInt_From_npy_int32(__pyx_v_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n __pyx_t_6 = <span class='py_c_api'>PyNumber_Subtract</span>(__pyx_t_9, __pyx_v_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n __pyx_t_9 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_9, __pyx_n_s_abs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n __pyx_t_9 = <span class='py_c_api'>PyNumber_Subtract</span>(((PyObject *)__pyx_v_temp_n), ((PyObject *)__pyx_v_X_n)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n __pyx_t_2 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_9);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_2, 0, __pyx_t_9);\n __pyx_t_9 = 0;\n __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n __pyx_t_2 = <span class='py_c_api'>PyObject_RichCompare</span>(__pyx_t_9, __pyx_float_5eneg_15, Py_LT); <span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n if (unlikely(<span class='py_c_api'>PyObject_SetItem</span>(((PyObject *)__pyx_v_resArray), __pyx_t_2, __pyx_t_6) < 0)) __PYX_ERR(0, 38, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n</pre><pre class=\"cython line score-0\"> <span class=\"\">39</span>: <span class=\"c\"># Checks for divergence by checking if values are no longer finite (don't fit into 64-bit floats or are nans)</span></pre>\n<pre class=\"cython line score-67\" onclick='toggleDiv(this)'>+<span class=\"\">40</span>: <span class=\"n\">resArray</span><span class=\"p\">[</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">logical_and</span><span class=\"p\">(</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">logical_not</span><span class=\"p\">(</span><span class=\"n\">np</span><span class=\"o\">.</span><span class=\"n\">isfinite</span><span class=\"p\">(</span><span class=\"n\">X_n</span><span class=\"p\">)),</span> <span class=\"n\">resArray</span> <span class=\"o\">==</span> <span class=\"mf\">0</span><span class=\"p\">)]</span> <span class=\"o\">=</span> <span class=\"o\">-</span><span class=\"p\">(</span><span class=\"n\">i</span> <span class=\"o\">+</span> <span class=\"mf\">1</span><span class=\"p\">)</span></pre>\n<pre class='cython code score-67 '> __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyInt_AddObjC</span>(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_2 = <span class='py_c_api'>PyNumber_Negative</span>(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_9 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_6, __pyx_n_s_logical_and); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_9);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_4 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_6, __pyx_n_s_logical_not); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_GetModuleGlobalName</span>(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n __pyx_t_3 = <span class='pyx_c_api'>__Pyx_PyObject_GetAttrStr</span>(__pyx_t_6, __pyx_n_s_isfinite); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_3);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_X_n));\n <span class='refnanny'>__Pyx_GIVEREF</span>(((PyObject *)__pyx_v_X_n));\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_6, 0, ((PyObject *)__pyx_v_X_n));\n __pyx_t_7 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_3); __pyx_t_3 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='py_c_api'>PyTuple_New</span>(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_7);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_6, 0, __pyx_t_7);\n __pyx_t_7 = 0;\n __pyx_t_7 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_7);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n __pyx_t_6 = <span class='py_c_api'>PyObject_RichCompare</span>(((PyObject *)__pyx_v_resArray), __pyx_int_0, Py_EQ); <span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n __pyx_t_4 = <span class='py_c_api'>PyTuple_New</span>(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_4);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_7);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_4, 0, __pyx_t_7);\n <span class='refnanny'>__Pyx_GIVEREF</span>(__pyx_t_6);\n <span class='py_macro_api'>PyTuple_SET_ITEM</span>(__pyx_t_4, 1, __pyx_t_6);\n __pyx_t_7 = 0;\n __pyx_t_6 = 0;\n __pyx_t_6 = <span class='pyx_c_api'>__Pyx_PyObject_Call</span>(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_6);\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_9); __pyx_t_9 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_4); __pyx_t_4 = 0;\n if (unlikely(<span class='py_c_api'>PyObject_SetItem</span>(((PyObject *)__pyx_v_resArray), __pyx_t_6, __pyx_t_2) < 0)) __PYX_ERR(0, 40, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n</pre><pre class=\"cython line score-17\" onclick='toggleDiv(this)'>+<span class=\"\">41</span>: <span class=\"n\">resArray</span><span class=\"p\">[</span><span class=\"n\">resArray</span> <span class=\"o\">>=</span> <span class=\"n\">iterations</span> <span class=\"o\">-</span> <span class=\"mf\">1</span><span class=\"p\">]</span> <span class=\"o\">=</span> <span class=\"o\">-</span><span class=\"n\">iterations</span> <span class=\"o\">+</span> <span class=\"mf\">1</span></pre>\n<pre class='cython code score-17 '> __pyx_t_8 = <span class='pyx_c_api'>__Pyx_PyInt_From_long</span>(((-__pyx_v_iterations) + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 41, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_8);\n __pyx_t_2 = <span class='pyx_c_api'>__Pyx_PyInt_From_long</span>((__pyx_v_iterations - 1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error)\n <span class='refnanny'>__Pyx_GOTREF</span>(__pyx_t_2);\n __pyx_t_6 = <span class='py_c_api'>PyObject_RichCompare</span>(((PyObject *)__pyx_v_resArray), __pyx_t_2, Py_GE); <span class='refnanny'>__Pyx_XGOTREF</span>(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_2); __pyx_t_2 = 0;\n if (unlikely(<span class='py_c_api'>PyObject_SetItem</span>(((PyObject *)__pyx_v_resArray), __pyx_t_6, __pyx_t_8) < 0)) __PYX_ERR(0, 41, __pyx_L1_error)\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_6); __pyx_t_6 = 0;\n <span class='pyx_macro_api'>__Pyx_DECREF</span>(__pyx_t_8); __pyx_t_8 = 0;\n</pre><pre class=\"cython line score-2\" onclick='toggleDiv(this)'>+<span class=\"\">42</span>: <span class=\"k\">return</span> <span class=\"n\">resArray</span></pre>\n<pre class='cython code score-2 '> <span class='pyx_macro_api'>__Pyx_XDECREF</span>(__pyx_r);\n <span class='pyx_macro_api'>__Pyx_INCREF</span>(((PyObject *)__pyx_v_resArray));\n __pyx_r = ((PyObject *)__pyx_v_resArray);\n goto __pyx_L0;\n</pre></div></body></html>" | |
| }, | |
| "metadata": {}, | |
| "execution_count": 14 | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T17:26:55.405923", | |
| "end_time": "2017-03-16T17:26:55.423219" | |
| }, | |
| "collapsed": false, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "def fractalSet(axes, event=None, iterations=32, cbar=None, resolution=384):\n if (event is not None and event.button == 1):\n Rez = np.linspace(*axes.get_xlim(), resolution)\n Imz = np.linspace(*axes.get_ylim()[::-1], resolution)\n else:\n Rez = np.linspace(-10, 10, resolution)\n Imz = np.linspace(-10, 10, resolution)\n plt.cla()\n t0 = perf_counter()\n a = fractalVals(Rez[:, None], Imz[None, :], iterations=iterations)\n axes.set_title(\"Time to Compute: {:.2e}s\\n Iterations: {:.2e}\".format(perf_counter() - t0, iterations))\n img = axes.imshow(a.T, vmin=-iterations, vmax=iterations, \n extent=[Rez.min(), Rez.max(), Imz.min(), Imz.max()], \n interpolation='none', cmap='magma')\n if (cbar is None):\n cbar = axes.get_figure().colorbar(img)\n return img, cbar\n\ndef dimensionEstimate(iterations=64):\n # Estimates dimension by iteratively computing the total number\n # of non-diverged pixels and comparing it to the total number of pixels along an axis\n # Basically box counting...\n i = 4\n while i <= 2048:\n Rez = np.linspace(-1.05, 0.65, i)\n Imz = np.linspace(-0.8, 0.8, i)\n a = fractalVals(Rez[:, None], Imz[None, :], iterations=iterations)\n print(np.log((a>0).sum())/np.log(i))\n i *= 2", | |
| "execution_count": 15, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T17:26:55.570854", | |
| "end_time": "2017-03-16T17:26:57.623291" | |
| }, | |
| "collapsed": false, | |
| "trusted": true, | |
| "scrolled": false | |
| }, | |
| "cell_type": "code", | |
| "source": "fig = figure(0, figsize=(10,10))\nax = gca()\nim, cbar = fractalSet(ax)\ncid = fig.canvas.mpl_connect('button_release_event', lambda event: fractalSet(ax, event=event, cbar=cbar))\nax.set_xlabel(\"Re(z)\")\nax.set_ylabel(\"Im(z)\")", | |
| "execution_count": 16, | |
| "outputs": [ | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/plain": "<IPython.core.display.Javascript object>", | |
| "application/javascript": "/* Put everything inside the global mpl namespace */\nwindow.mpl = {};\n\n\nmpl.get_websocket_type = function() {\n if (typeof(WebSocket) !== 'undefined') {\n return WebSocket;\n } else if (typeof(MozWebSocket) !== 'undefined') {\n return MozWebSocket;\n } else {\n alert('Your browser does not have WebSocket support.' +\n 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n 'Firefox 4 and 5 are also supported but you ' +\n 'have to enable WebSockets in about:config.');\n };\n}\n\nmpl.figure = function(figure_id, websocket, ondownload, parent_element) {\n this.id = figure_id;\n\n this.ws = websocket;\n\n this.supports_binary = (this.ws.binaryType != undefined);\n\n if (!this.supports_binary) {\n var warnings = document.getElementById(\"mpl-warnings\");\n if (warnings) {\n warnings.style.display = 'block';\n warnings.textContent = (\n \"This browser does not support binary websocket messages. \" +\n \"Performance may be slow.\");\n }\n }\n\n this.imageObj = new Image();\n\n this.context = undefined;\n this.message = undefined;\n this.canvas = undefined;\n this.rubberband_canvas = undefined;\n this.rubberband_context = undefined;\n this.format_dropdown = undefined;\n\n this.image_mode = 'full';\n\n this.root = $('<div/>');\n this._root_extra_style(this.root)\n this.root.attr('style', 'display: inline-block');\n\n $(parent_element).append(this.root);\n\n this._init_header(this);\n this._init_canvas(this);\n this._init_toolbar(this);\n\n var fig = this;\n\n this.waiting = false;\n\n this.ws.onopen = function () {\n fig.send_message(\"supports_binary\", {value: fig.supports_binary});\n fig.send_message(\"send_image_mode\", {});\n if (mpl.ratio != 1) {\n fig.send_message(\"set_dpi_ratio\", {'dpi_ratio': mpl.ratio});\n }\n fig.send_message(\"refresh\", {});\n }\n\n this.imageObj.onload = function() {\n if (fig.image_mode == 'full') {\n // Full images could contain transparency (where diff images\n // almost always do), so we need to clear the canvas so that\n // there is no ghosting.\n fig.context.clearRect(0, 0, fig.canvas.width, fig.canvas.height);\n }\n fig.context.drawImage(fig.imageObj, 0, 0);\n };\n\n this.imageObj.onunload = function() {\n this.ws.close();\n }\n\n this.ws.onmessage = this._make_on_message_function(this);\n\n this.ondownload = ondownload;\n}\n\nmpl.figure.prototype._init_header = function() {\n var titlebar = $(\n '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ' +\n 'ui-helper-clearfix\"/>');\n var titletext = $(\n '<div class=\"ui-dialog-title\" style=\"width: 100%; ' +\n 'text-align: center; padding: 3px;\"/>');\n titlebar.append(titletext)\n this.root.append(titlebar);\n this.header = titletext[0];\n}\n\n\n\nmpl.figure.prototype._canvas_extra_style = function(canvas_div) {\n\n}\n\n\nmpl.figure.prototype._root_extra_style = function(canvas_div) {\n\n}\n\nmpl.figure.prototype._init_canvas = function() {\n var fig = this;\n\n var canvas_div = $('<div/>');\n\n canvas_div.attr('style', 'position: relative; clear: both; outline: 0');\n\n function canvas_keyboard_event(event) {\n return fig.key_event(event, event['data']);\n }\n\n canvas_div.keydown('key_press', canvas_keyboard_event);\n canvas_div.keyup('key_release', canvas_keyboard_event);\n this.canvas_div = canvas_div\n this._canvas_extra_style(canvas_div)\n this.root.append(canvas_div);\n\n var canvas = $('<canvas/>');\n canvas.addClass('mpl-canvas');\n canvas.attr('style', \"left: 0; top: 0; z-index: 0; outline: 0\")\n\n this.canvas = canvas[0];\n this.context = canvas[0].getContext(\"2d\");\n\n var backingStore = this.context.backingStorePixelRatio ||\n\tthis.context.webkitBackingStorePixelRatio ||\n\tthis.context.mozBackingStorePixelRatio ||\n\tthis.context.msBackingStorePixelRatio ||\n\tthis.context.oBackingStorePixelRatio ||\n\tthis.context.backingStorePixelRatio || 1;\n\n mpl.ratio = (window.devicePixelRatio || 1) / backingStore;\n\n var rubberband = $('<canvas/>');\n rubberband.attr('style', \"position: absolute; left: 0; top: 0; z-index: 1;\")\n\n var pass_mouse_events = true;\n\n canvas_div.resizable({\n start: function(event, ui) {\n pass_mouse_events = false;\n },\n resize: function(event, ui) {\n fig.request_resize(ui.size.width, ui.size.height);\n },\n stop: function(event, ui) {\n pass_mouse_events = true;\n fig.request_resize(ui.size.width, ui.size.height);\n },\n });\n\n function mouse_event_fn(event) {\n if (pass_mouse_events)\n return fig.mouse_event(event, event['data']);\n }\n\n rubberband.mousedown('button_press', mouse_event_fn);\n rubberband.mouseup('button_release', mouse_event_fn);\n // Throttle sequential mouse events to 1 every 20ms.\n rubberband.mousemove('motion_notify', mouse_event_fn);\n\n rubberband.mouseenter('figure_enter', mouse_event_fn);\n rubberband.mouseleave('figure_leave', mouse_event_fn);\n\n canvas_div.on(\"wheel\", function (event) {\n event = event.originalEvent;\n event['data'] = 'scroll'\n if (event.deltaY < 0) {\n event.step = 1;\n } else {\n event.step = -1;\n }\n mouse_event_fn(event);\n });\n\n canvas_div.append(canvas);\n canvas_div.append(rubberband);\n\n this.rubberband = rubberband;\n this.rubberband_canvas = rubberband[0];\n this.rubberband_context = rubberband[0].getContext(\"2d\");\n this.rubberband_context.strokeStyle = \"#000000\";\n\n this._resize_canvas = function(width, height) {\n // Keep the size of the canvas, canvas container, and rubber band\n // canvas in synch.\n canvas_div.css('width', width)\n canvas_div.css('height', height)\n\n canvas.attr('width', width * mpl.ratio);\n canvas.attr('height', height * mpl.ratio);\n canvas.attr('style', 'width: ' + width + 'px; height: ' + height + 'px;');\n\n rubberband.attr('width', width);\n rubberband.attr('height', height);\n }\n\n // Set the figure to an initial 600x600px, this will subsequently be updated\n // upon first draw.\n this._resize_canvas(600, 600);\n\n // Disable right mouse context menu.\n $(this.rubberband_canvas).bind(\"contextmenu\",function(e){\n return false;\n });\n\n function set_focus () {\n canvas.focus();\n canvas_div.focus();\n }\n\n window.setTimeout(set_focus, 100);\n}\n\nmpl.figure.prototype._init_toolbar = function() {\n var fig = this;\n\n var nav_element = $('<div/>')\n nav_element.attr('style', 'width: 100%');\n this.root.append(nav_element);\n\n // Define a callback function for later on.\n function toolbar_event(event) {\n return fig.toolbar_button_onclick(event['data']);\n }\n function toolbar_mouse_event(event) {\n return fig.toolbar_button_onmouseover(event['data']);\n }\n\n for(var toolbar_ind in mpl.toolbar_items) {\n var name = mpl.toolbar_items[toolbar_ind][0];\n var tooltip = mpl.toolbar_items[toolbar_ind][1];\n var image = mpl.toolbar_items[toolbar_ind][2];\n var method_name = mpl.toolbar_items[toolbar_ind][3];\n\n if (!name) {\n // put a spacer in here.\n continue;\n }\n var button = $('<button/>');\n button.addClass('ui-button ui-widget ui-state-default ui-corner-all ' +\n 'ui-button-icon-only');\n button.attr('role', 'button');\n button.attr('aria-disabled', 'false');\n button.click(method_name, toolbar_event);\n button.mouseover(tooltip, toolbar_mouse_event);\n\n var icon_img = $('<span/>');\n icon_img.addClass('ui-button-icon-primary ui-icon');\n icon_img.addClass(image);\n icon_img.addClass('ui-corner-all');\n\n var tooltip_span = $('<span/>');\n tooltip_span.addClass('ui-button-text');\n tooltip_span.html(tooltip);\n\n button.append(icon_img);\n button.append(tooltip_span);\n\n nav_element.append(button);\n }\n\n var fmt_picker_span = $('<span/>');\n\n var fmt_picker = $('<select/>');\n fmt_picker.addClass('mpl-toolbar-option ui-widget ui-widget-content');\n fmt_picker_span.append(fmt_picker);\n nav_element.append(fmt_picker_span);\n this.format_dropdown = fmt_picker[0];\n\n for (var ind in mpl.extensions) {\n var fmt = mpl.extensions[ind];\n var option = $(\n '<option/>', {selected: fmt === mpl.default_extension}).html(fmt);\n fmt_picker.append(option)\n }\n\n // Add hover states to the ui-buttons\n $( \".ui-button\" ).hover(\n function() { $(this).addClass(\"ui-state-hover\");},\n function() { $(this).removeClass(\"ui-state-hover\");}\n );\n\n var status_bar = $('<span class=\"mpl-message\"/>');\n nav_element.append(status_bar);\n this.message = status_bar[0];\n}\n\nmpl.figure.prototype.request_resize = function(x_pixels, y_pixels) {\n // Request matplotlib to resize the figure. Matplotlib will then trigger a resize in the client,\n // which will in turn request a refresh of the image.\n this.send_message('resize', {'width': x_pixels, 'height': y_pixels});\n}\n\nmpl.figure.prototype.send_message = function(type, properties) {\n properties['type'] = type;\n properties['figure_id'] = this.id;\n this.ws.send(JSON.stringify(properties));\n}\n\nmpl.figure.prototype.send_draw_message = function() {\n if (!this.waiting) {\n this.waiting = true;\n this.ws.send(JSON.stringify({type: \"draw\", figure_id: this.id}));\n }\n}\n\n\nmpl.figure.prototype.handle_save = function(fig, msg) {\n var format_dropdown = fig.format_dropdown;\n var format = format_dropdown.options[format_dropdown.selectedIndex].value;\n fig.ondownload(fig, format);\n}\n\n\nmpl.figure.prototype.handle_resize = function(fig, msg) {\n var size = msg['size'];\n if (size[0] != fig.canvas.width || size[1] != fig.canvas.height) {\n fig._resize_canvas(size[0], size[1]);\n fig.send_message(\"refresh\", {});\n };\n}\n\nmpl.figure.prototype.handle_rubberband = function(fig, msg) {\n var x0 = msg['x0'] / mpl.ratio;\n var y0 = (fig.canvas.height - msg['y0']) / mpl.ratio;\n var x1 = msg['x1'] / mpl.ratio;\n var y1 = (fig.canvas.height - msg['y1']) / mpl.ratio;\n x0 = Math.floor(x0) + 0.5;\n y0 = Math.floor(y0) + 0.5;\n x1 = Math.floor(x1) + 0.5;\n y1 = Math.floor(y1) + 0.5;\n var min_x = Math.min(x0, x1);\n var min_y = Math.min(y0, y1);\n var width = Math.abs(x1 - x0);\n var height = Math.abs(y1 - y0);\n\n fig.rubberband_context.clearRect(\n 0, 0, fig.canvas.width, fig.canvas.height);\n\n fig.rubberband_context.strokeRect(min_x, min_y, width, height);\n}\n\nmpl.figure.prototype.handle_figure_label = function(fig, msg) {\n // Updates the figure title.\n fig.header.textContent = msg['label'];\n}\n\nmpl.figure.prototype.handle_cursor = function(fig, msg) {\n var cursor = msg['cursor'];\n switch(cursor)\n {\n case 0:\n cursor = 'pointer';\n break;\n case 1:\n cursor = 'default';\n break;\n case 2:\n cursor = 'crosshair';\n break;\n case 3:\n cursor = 'move';\n break;\n }\n fig.rubberband_canvas.style.cursor = cursor;\n}\n\nmpl.figure.prototype.handle_message = function(fig, msg) {\n fig.message.textContent = msg['message'];\n}\n\nmpl.figure.prototype.handle_draw = function(fig, msg) {\n // Request the server to send over a new figure.\n fig.send_draw_message();\n}\n\nmpl.figure.prototype.handle_image_mode = function(fig, msg) {\n fig.image_mode = msg['mode'];\n}\n\nmpl.figure.prototype.updated_canvas_event = function() {\n // Called whenever the canvas gets updated.\n this.send_message(\"ack\", {});\n}\n\n// A function to construct a web socket function for onmessage handling.\n// Called in the figure constructor.\nmpl.figure.prototype._make_on_message_function = function(fig) {\n return function socket_on_message(evt) {\n if (evt.data instanceof Blob) {\n /* FIXME: We get \"Resource interpreted as Image but\n * transferred with MIME type text/plain:\" errors on\n * Chrome. But how to set the MIME type? It doesn't seem\n * to be part of the websocket stream */\n evt.data.type = \"image/png\";\n\n /* Free the memory for the previous frames */\n if (fig.imageObj.src) {\n (window.URL || window.webkitURL).revokeObjectURL(\n fig.imageObj.src);\n }\n\n fig.imageObj.src = (window.URL || window.webkitURL).createObjectURL(\n evt.data);\n fig.updated_canvas_event();\n fig.waiting = false;\n return;\n }\n else if (typeof evt.data === 'string' && evt.data.slice(0, 21) == \"data:image/png;base64\") {\n fig.imageObj.src = evt.data;\n fig.updated_canvas_event();\n fig.waiting = false;\n return;\n }\n\n var msg = JSON.parse(evt.data);\n var msg_type = msg['type'];\n\n // Call the \"handle_{type}\" callback, which takes\n // the figure and JSON message as its only arguments.\n try {\n var callback = fig[\"handle_\" + msg_type];\n } catch (e) {\n console.log(\"No handler for the '\" + msg_type + \"' message type: \", msg);\n return;\n }\n\n if (callback) {\n try {\n // console.log(\"Handling '\" + msg_type + \"' message: \", msg);\n callback(fig, msg);\n } catch (e) {\n console.log(\"Exception inside the 'handler_\" + msg_type + \"' callback:\", e, e.stack, msg);\n }\n }\n };\n}\n\n// from http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas\nmpl.findpos = function(e) {\n //this section is from http://www.quirksmode.org/js/events_properties.html\n var targ;\n if (!e)\n e = window.event;\n if (e.target)\n targ = e.target;\n else if (e.srcElement)\n targ = e.srcElement;\n if (targ.nodeType == 3) // defeat Safari bug\n targ = targ.parentNode;\n\n // jQuery normalizes the pageX and pageY\n // pageX,Y are the mouse positions relative to the document\n // offset() returns the position of the element relative to the document\n var x = e.pageX - $(targ).offset().left;\n var y = e.pageY - $(targ).offset().top;\n\n return {\"x\": x, \"y\": y};\n};\n\n/*\n * return a copy of an object with only non-object keys\n * we need this to avoid circular references\n * http://stackoverflow.com/a/24161582/3208463\n */\nfunction simpleKeys (original) {\n return Object.keys(original).reduce(function (obj, key) {\n if (typeof original[key] !== 'object')\n obj[key] = original[key]\n return obj;\n }, {});\n}\n\nmpl.figure.prototype.mouse_event = function(event, name) {\n var canvas_pos = mpl.findpos(event)\n\n if (name === 'button_press')\n {\n this.canvas.focus();\n this.canvas_div.focus();\n }\n\n var x = canvas_pos.x * mpl.ratio;\n var y = canvas_pos.y * mpl.ratio;\n\n this.send_message(name, {x: x, y: y, button: event.button,\n step: event.step,\n guiEvent: simpleKeys(event)});\n\n /* This prevents the web browser from automatically changing to\n * the text insertion cursor when the button is pressed. We want\n * to control all of the cursor setting manually through the\n * 'cursor' event from matplotlib */\n event.preventDefault();\n return false;\n}\n\nmpl.figure.prototype._key_event_extra = function(event, name) {\n // Handle any extra behaviour associated with a key event\n}\n\nmpl.figure.prototype.key_event = function(event, name) {\n\n // Prevent repeat events\n if (name == 'key_press')\n {\n if (event.which === this._key)\n return;\n else\n this._key = event.which;\n }\n if (name == 'key_release')\n this._key = null;\n\n var value = '';\n if (event.ctrlKey && event.which != 17)\n value += \"ctrl+\";\n if (event.altKey && event.which != 18)\n value += \"alt+\";\n if (event.shiftKey && event.which != 16)\n value += \"shift+\";\n\n value += 'k';\n value += event.which.toString();\n\n this._key_event_extra(event, name);\n\n this.send_message(name, {key: value,\n guiEvent: simpleKeys(event)});\n return false;\n}\n\nmpl.figure.prototype.toolbar_button_onclick = function(name) {\n if (name == 'download') {\n this.handle_save(this, null);\n } else {\n this.send_message(\"toolbar_button\", {name: name});\n }\n};\n\nmpl.figure.prototype.toolbar_button_onmouseover = function(tooltip) {\n this.message.textContent = tooltip;\n};\nmpl.toolbar_items = [[\"Home\", \"Reset original view\", \"fa fa-home icon-home\", \"home\"], [\"Back\", \"Back to previous view\", \"fa fa-arrow-left icon-arrow-left\", \"back\"], [\"Forward\", \"Forward to next view\", \"fa fa-arrow-right icon-arrow-right\", \"forward\"], [\"\", \"\", \"\", \"\"], [\"Pan\", \"Pan axes with left mouse, zoom with right\", \"fa fa-arrows icon-move\", \"pan\"], [\"Zoom\", \"Zoom to rectangle\", \"fa fa-square-o icon-check-empty\", \"zoom\"], [\"\", \"\", \"\", \"\"], [\"Download\", \"Download plot\", \"fa fa-floppy-o icon-save\", \"download\"]];\n\nmpl.extensions = [\"eps\", \"jpeg\", \"pdf\", \"png\", \"ps\", \"raw\", \"svg\", \"tif\"];\n\nmpl.default_extension = \"png\";var comm_websocket_adapter = function(comm) {\n // Create a \"websocket\"-like object which calls the given IPython comm\n // object with the appropriate methods. Currently this is a non binary\n // socket, so there is still some room for performance tuning.\n var ws = {};\n\n ws.close = function() {\n comm.close()\n };\n ws.send = function(m) {\n //console.log('sending', m);\n comm.send(m);\n };\n // Register the callback with on_msg.\n comm.on_msg(function(msg) {\n //console.log('receiving', msg['content']['data'], msg);\n // Pass the mpl event to the overriden (by mpl) onmessage function.\n ws.onmessage(msg['content']['data'])\n });\n return ws;\n}\n\nmpl.mpl_figure_comm = function(comm, msg) {\n // This is the function which gets called when the mpl process\n // starts-up an IPython Comm through the \"matplotlib\" channel.\n\n var id = msg.content.data.id;\n // Get hold of the div created by the display call when the Comm\n // socket was opened in Python.\n var element = $(\"#\" + id);\n var ws_proxy = comm_websocket_adapter(comm)\n\n function ondownload(figure, format) {\n window.open(figure.imageObj.src);\n }\n\n var fig = new mpl.figure(id, ws_proxy,\n ondownload,\n element.get(0));\n\n // Call onopen now - mpl needs it, as it is assuming we've passed it a real\n // web socket which is closed, not our websocket->open comm proxy.\n ws_proxy.onopen();\n\n fig.parent_element = element.get(0);\n fig.cell_info = mpl.find_output_cell(\"<div id='\" + id + \"'></div>\");\n if (!fig.cell_info) {\n console.error(\"Failed to find cell for figure\", id, fig);\n return;\n }\n\n var output_index = fig.cell_info[2]\n var cell = fig.cell_info[0];\n\n};\n\nmpl.figure.prototype.handle_close = function(fig, msg) {\n var width = fig.canvas.width/mpl.ratio\n fig.root.unbind('remove')\n\n // Update the output cell to use the data from the current canvas.\n fig.push_to_output();\n var dataURL = fig.canvas.toDataURL();\n // Re-enable the keyboard manager in IPython - without this line, in FF,\n // the notebook keyboard shortcuts fail.\n IPython.keyboard_manager.enable()\n $(fig.parent_element).html('<img src=\"' + dataURL + '\" width=\"' + width + '\">');\n fig.close_ws(fig, msg);\n}\n\nmpl.figure.prototype.close_ws = function(fig, msg){\n fig.send_message('closing', msg);\n // fig.ws.close()\n}\n\nmpl.figure.prototype.push_to_output = function(remove_interactive) {\n // Turn the data on the canvas into data in the output cell.\n var width = this.canvas.width/mpl.ratio\n var dataURL = this.canvas.toDataURL();\n this.cell_info[1]['text/html'] = '<img src=\"' + dataURL + '\" width=\"' + width + '\">';\n}\n\nmpl.figure.prototype.updated_canvas_event = function() {\n // Tell IPython that the notebook contents must change.\n IPython.notebook.set_dirty(true);\n this.send_message(\"ack\", {});\n var fig = this;\n // Wait a second, then push the new image to the DOM so\n // that it is saved nicely (might be nice to debounce this).\n setTimeout(function () { fig.push_to_output() }, 1000);\n}\n\nmpl.figure.prototype._init_toolbar = function() {\n var fig = this;\n\n var nav_element = $('<div/>')\n nav_element.attr('style', 'width: 100%');\n this.root.append(nav_element);\n\n // Define a callback function for later on.\n function toolbar_event(event) {\n return fig.toolbar_button_onclick(event['data']);\n }\n function toolbar_mouse_event(event) {\n return fig.toolbar_button_onmouseover(event['data']);\n }\n\n for(var toolbar_ind in mpl.toolbar_items){\n var name = mpl.toolbar_items[toolbar_ind][0];\n var tooltip = mpl.toolbar_items[toolbar_ind][1];\n var image = mpl.toolbar_items[toolbar_ind][2];\n var method_name = mpl.toolbar_items[toolbar_ind][3];\n\n if (!name) { continue; };\n\n var button = $('<button class=\"btn btn-default\" href=\"#\" title=\"' + name + '\"><i class=\"fa ' + image + ' fa-lg\"></i></button>');\n button.click(method_name, toolbar_event);\n button.mouseover(tooltip, toolbar_mouse_event);\n nav_element.append(button);\n }\n\n // Add the status bar.\n var status_bar = $('<span class=\"mpl-message\" style=\"text-align:right; float: right;\"/>');\n nav_element.append(status_bar);\n this.message = status_bar[0];\n\n // Add the close button to the window.\n var buttongrp = $('<div class=\"btn-group inline pull-right\"></div>');\n var button = $('<button class=\"btn btn-mini btn-primary\" href=\"#\" title=\"Stop Interaction\"><i class=\"fa fa-power-off icon-remove icon-large\"></i></button>');\n button.click(function (evt) { fig.handle_close(fig, {}); } );\n button.mouseover('Stop Interaction', toolbar_mouse_event);\n buttongrp.append(button);\n var titlebar = this.root.find($('.ui-dialog-titlebar'));\n titlebar.prepend(buttongrp);\n}\n\nmpl.figure.prototype._root_extra_style = function(el){\n var fig = this\n el.on(\"remove\", function(){\n\tfig.close_ws(fig, {});\n });\n}\n\nmpl.figure.prototype._canvas_extra_style = function(el){\n // this is important to make the div 'focusable\n el.attr('tabindex', 0)\n // reach out to IPython and tell the keyboard manager to turn it's self\n // off when our div gets focus\n\n // location in version 3\n if (IPython.notebook.keyboard_manager) {\n IPython.notebook.keyboard_manager.register_events(el);\n }\n else {\n // location in version 2\n IPython.keyboard_manager.register_events(el);\n }\n\n}\n\nmpl.figure.prototype._key_event_extra = function(event, name) {\n var manager = IPython.notebook.keyboard_manager;\n if (!manager)\n manager = IPython.keyboard_manager;\n\n // Check for shift+enter\n if (event.shiftKey && event.which == 13) {\n this.canvas_div.blur();\n // select the cell after this one\n var index = IPython.notebook.find_cell_index(this.cell_info[0]);\n IPython.notebook.select(index + 1);\n }\n}\n\nmpl.figure.prototype.handle_save = function(fig, msg) {\n fig.ondownload(fig, null);\n}\n\n\nmpl.find_output_cell = function(html_output) {\n // Return the cell and output element which can be found *uniquely* in the notebook.\n // Note - this is a bit hacky, but it is done because the \"notebook_saving.Notebook\"\n // IPython event is triggered only after the cells have been serialised, which for\n // our purposes (turning an active figure into a static one), is too late.\n var cells = IPython.notebook.get_cells();\n var ncells = cells.length;\n for (var i=0; i<ncells; i++) {\n var cell = cells[i];\n if (cell.cell_type === 'code'){\n for (var j=0; j<cell.output_area.outputs.length; j++) {\n var data = cell.output_area.outputs[j];\n if (data.data) {\n // IPython >= 3 moved mimebundle to data attribute of output\n data = data.data;\n }\n if (data['text/html'] == html_output) {\n return [cell, data, j];\n }\n }\n }\n }\n}\n\n// Register the function which deals with the matplotlib target/channel.\n// The kernel may be null if the page has been refreshed.\nif (IPython.notebook.kernel != null) {\n IPython.notebook.kernel.comm_manager.register_target('matplotlib', mpl.mpl_figure_comm);\n}\n" | |
| }, | |
| "metadata": {} | |
| }, | |
| { | |
| "output_type": "display_data", | |
| "data": { | |
| "text/plain": "<IPython.core.display.HTML object>", | |
| "text/html": "<div id='fe120e6f-4ad3-4983-837e-6b4a9de454a6'></div>" | |
| }, | |
| "metadata": {} | |
| }, | |
| { | |
| "output_type": "stream", | |
| "text": "/anaconda3/envs/General/lib/python3.5/site-packages/ipykernel/__main__.py:10: RuntimeWarning: overflow encountered in power\n/anaconda3/envs/General/lib/python3.5/site-packages/ipykernel/__main__.py:10: RuntimeWarning: invalid value encountered in power\n/anaconda3/envs/General/lib/python3.5/site-packages/ipykernel/__main__.py:10: RuntimeWarning: invalid value encountered in subtract\n/anaconda3/envs/General/lib/python3.5/site-packages/ipykernel/__main__.py:10: RuntimeWarning: invalid value encountered in less\n", | |
| "name": "stderr" | |
| }, | |
| { | |
| "output_type": "execute_result", | |
| "data": { | |
| "text/plain": "<matplotlib.text.Text at 0x7f19e3c37f60>" | |
| }, | |
| "metadata": {}, | |
| "execution_count": 16 | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T17:26:57.768214", | |
| "end_time": "2017-03-16T17:26:57.772066" | |
| }, | |
| "collapsed": false, | |
| "trusted": true, | |
| "scrolled": true | |
| }, | |
| "cell_type": "code", | |
| "source": "ax.set_xlabel(\"Im(z)\")\nax.set_xlabel(\"Re(z)\")", | |
| "execution_count": 17, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "data": { | |
| "text/plain": "<matplotlib.text.Text at 0x7f19e39dba20>" | |
| }, | |
| "metadata": {}, | |
| "execution_count": 17 | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T15:44:22.434585", | |
| "end_time": "2017-03-16T15:44:22.437068" | |
| }, | |
| "collapsed": true, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "test = np.ones((4,4), dtype=np.complex128)", | |
| "execution_count": 6, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2017-03-16T15:44:41.425821", | |
| "end_time": "2017-03-16T15:44:41.430105" | |
| }, | |
| "collapsed": false, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "f(test, 1+1j).shape", | |
| "execution_count": 8, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "data": { | |
| "text/plain": "(4, 4)" | |
| }, | |
| "metadata": {}, | |
| "execution_count": 8 | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "trusted": true, | |
| "collapsed": true | |
| }, | |
| "cell_type": "code", | |
| "source": "", | |
| "execution_count": null, | |
| "outputs": [] | |
| } | |
| ], | |
| "metadata": { | |
| "gist": { | |
| "id": "cde966e3dab255a56d502b220c346c69", | |
| "data": { | |
| "description": "Fractals_Test", | |
| "public": true | |
| } | |
| }, | |
| "_draft": { | |
| "nbviewer_url": "https://gist.github.com/cde966e3dab255a56d502b220c346c69" | |
| }, | |
| "language_info": { | |
| "nbconvert_exporter": "python", | |
| "name": "python", | |
| "version": "3.5.2", | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "pygments_lexer": "ipython3", | |
| "mimetype": "text/x-python", | |
| "file_extension": ".py" | |
| }, | |
| "kernelspec": { | |
| "name": "conda-env-General-py", | |
| "display_name": "Python [conda env:General]", | |
| "language": "python" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment