Skip to content

Commit

Permalink
Some minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alinnman committed Apr 22, 2024
1 parent 4e34692 commit 87b7df1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
20 changes: 6 additions & 14 deletions mandeliter.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import sys
from libc.math cimport log as c_log, sin as c_sin, cos as c_cos, exp as c_exp
#from libc.complex cimport creal as c_real, cimag as c_imag
import cython

cdef int growthCounter = 0
Expand Down Expand Up @@ -33,7 +32,6 @@ cdef double complex colorValue (counter, colorFactor, offset, cs, cd, cx):
return ((c_log(c_counter)**c_cs)/cx)*1j*complex_exp(-1j*c_counter*c_colorFactor)/c_cd

cdef double complex colorCode (counter, useCache, colorFactor, offset, cs, cd, cx):
# global P.COLORSTEEPNESS
global colorCodeMap
retVal = 0
if useCache:
Expand Down Expand Up @@ -67,7 +65,7 @@ cdef reportGrowth (index, debug):

def growth (c, colorFactor, nrOfIterations, offset, cs, pe, cl, dl, debug, cd, index, cx) :

# This is the iteration used to find convergence, looping or divergence
# This is the iteration (inner loop) used to find convergence, looping or divergence
# Escape count can be calculated for divergence

# The code is optimized using Cython
Expand All @@ -88,18 +86,12 @@ def growth (c, colorFactor, nrOfIterations, offset, cs, pe, cl, dl, debug, cd, i
cdef double X1 = 0.0
cdef double X2 = 0.0

#if abs(cc) <= 0.25:
# # No need to iterate here. It will converge.
# reportGrowth ()
# return 0

while i < nrIt:
newResult = result*result + cc
X1 = newResult.real - result.real
X2 = newResult.imag - result.imag
newAbsDiffResult = X1*X1 + X2*X2
newAbsResult = newResult.real * newResult.real +\
newResult.imag * newResult.imag
newResult = result*result + cc
X1 = newResult.real - result.real
X2 = newResult.imag - result.imag
newAbsDiffResult = X1*X1 + X2*X2
newAbsResult = newResult.real*newResult.real + newResult.imag*newResult.imag
if newAbsDiffResult < conv_limit2:
# Convergence found
reportGrowth (index, debug)
Expand Down
2 changes: 2 additions & 0 deletions parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def parseArguments (args):
environ['NUMEXPR_NUM_THREADS'] = str(N_THREADS)
else:
N_THREADS = 1
# Eliminate screen session warnings
environ["XDG_SESSION_TYPE"] = "xcb"



Expand Down

0 comments on commit 87b7df1

Please sign in to comment.