<commit_before>import numpy as np
import cphvbnp as cnp
import linalg as cla
import numpy.linalg as nla

def jacobi(A, b, tol=0.0005):
    # solve Ax=b via the Jacobi method
    x = cnp.ones(np.shape(b), dtype=b.dtype, cphvb=b.cphvb)
    D = cnp.diag(1/cnp.diag(A))
    R = cnp.diag(cnp.diag(A)) - A
    T = cla.dot(D,R)
    C = cla.dot(D,b)
    error = tol + 1
    while error > tol:
        xo = x
        x = cla.dot(T,x) + C
        error = nla.norm(x-xo)<commit_msg>more efficient version. without np.dot()<commit_after>import numpy as np
import cphvbnp as cnp
import linalg as cla
import numpy.linalg as nla

def jacobi(A, b, tol=0.0005):
    # solve Ax=b via the Jacobi method
    x = cnp.ones(np.shape(b), dtype=b.dtype, cphvb=b.cphvb)
    D = 1/cnp.diag(A)
    R = cnp.diag(cnp.diag(A)) - A
    T = D[:,np.newaxis]*R
    C = D*b
    error = tol + 1
    while error > tol:
        xo = x
        x = np.add.reduce(T*x,-1) + C
        error = nla.norm(x-xo)
{'fraction_non_alphanumeric': 0.1441908713692946, 'fraction_numerical': 0.015560165975103735, 'mean_word_length': 2.3859649122807016, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2615659', 'n_tokens_mistral': 435, 'n_tokens_neox': 429, 'n_words': 107}