<commit_before>""" Coarse Ricci flow for a point cloud. """
import numpy as np
import numexpr as ne
# treat some numpy warnings as errors?
np.seterr(all="print")  # divide='raise', invalid='raise')

#
#   simulation parameters
#
runs = 100000  # how many iterations
show = 1000  # how frequently we show the result
eta = 0.0005  # factor of Ricci that is added to distance squared
threshold = 0.15 #clustering threshold
upperthreshold = 1.5 # won't try to cluster if distances in ambiguity interva (threshold, upperthreshold)
# 'min' rescales the distance squared function so minimum is 1.
# 'L1' rescales it so the sum of distance squared stays the same
#   (perhaps this is a misgnomer and it should be 'L2' but whatever)
rescale = 'L1'
t = 0.1  # should not be integer to avaoid division problems
noise = 0.2  # noise coefficient
CLIP = 60  # value at which we clip distance function

np.set_printoptions(precision=2,suppress = True)


import data
from tools import metricize
from tools import is_clustered
from Laplacian import Laplacian
from Ricci import coarseRicci


# sqdist = data.onedimensionpair(2, 3, noise)
# sqdist = data.cyclegraph(6, noise)
#sqdist = data.closefarsimplices(3, 0.1, 3)

sqdist, pointset = data.twodimensionpair(15, 12, noise)
twodim=True

metricize(sqdist)
L = Laplacian(sqdist, t)
Ricci = coarseRicci(L, sqdist)

print 'initial distance'
print sqdist
print 'initial Ricci'
print Ricci


Joe = (sqdist>threshold)&(sqdist<upperthreshold)
print Joe
print (sqdist<upperthreshold)

print (sqdist>threshold)

print Joe.any()
print Joe.all()


ne.evaluate("sqdist-eta*Ricci", out=sqdist)

initial_L1 = sqdist.sum()
<commit_msg>removed some test garbage<commit_after>""" Coarse Ricci flow for a point cloud. """
import numpy as np
import numexpr as ne
# treat some numpy warnings as errors?
np.seterr(all="print")  # divide='raise', invalid='raise')

#
#   simulation parameters
#
runs = 100000  # how many iterations
show = 1000  # how frequently we show the result
eta = 0.0002 # factor of Ricci that is added to distance squared
threshold = 0.15 #clustering threshold
upperthreshold = 1.5 # won't try to cluster if distances in ambiguity interva (threshold, upperthreshold)
# 'min' rescales the distance squared function so minimum is 1.
# 'L1' rescales it so the sum of distance squared stays the same
#   (perhaps this is a misgnomer and it should be 'L2' but whatever)
rescale = 'L1'
t = 0.1  # should not be integer to avaoid division problems
noise = 0.4 # noise coefficient
CLIP = 60  # value at which we clip distance function

np.set_printoptions(precision=2,suppress = True)


import data
from tools import metricize
from tools import is_clustered
from Laplacian import Laplacian
from Ricci import coarseRicci


# sqdist = data.onedimensionpair(2, 3, noise)
# sqdist = data.cyclegraph(6, noise)
#sqdist = data.closefarsimplices(3, 0.1, 3)

sqdist, pointset = data.twodimensionpair(25, 32, noise)
twodim=True

metricize(sqdist)
L = Laplacian(sqdist, t)
Ricci = coarseRicci(L, sqdist)

print 'initial distance'
print sqdist
print 'initial Ricci'
print Ricci


ne.evaluate("sqdist-eta*Ricci", out=sqdist)

initial_L1 = sqdist.sum()

{'fraction_non_alphanumeric': 0.08970309538850284, 'fraction_numerical': 0.027163613392293114, 'mean_word_length': 4.853974121996303, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3258657', 'n_tokens_mistral': 1109, 'n_tokens_neox': 985, 'n_words': 385}