<commit_before>import theano
from theano import tensor
import numpy
import linear_cg
import scipy.linalg
import time

def test_linear_cg():
    rng = numpy.random.RandomState([1,2,3])
    n = 5
    M = rng.randn(2*n,n)
    M = numpy.dot(M.T,M)
    b = rng.randn(n)
    c = rng.randn()
    x = theano.shared(rng.randn(n))
    f = 0.5 * tensor.dot(x,tensor.dot(M,x)) - tensor.dot(b,x) + c
    sol = linear_cg.linear_cg(f,[x])

    fn_sol = theano.function([], sol)

    start = time.time()
    sol  = fn_sol()[0]
    my_lcg = time.time() -start

    eval_f = theano.function([],f)<commit_msg>make test use floatX.<commit_after>import theano
from theano import tensor, config
import numpy
import linear_cg
import scipy.linalg
import time

def test_linear_cg():
    rng = numpy.random.RandomState([1,2,3])
    n = 5
    M = rng.randn(2*n,n)
    M = numpy.dot(M.T,M).astype(config.floatX)
    b = rng.randn(n).astype(config.floatX)
    c = rng.randn(1).astype(config.floatX)[0]
    x = theano.shared(rng.randn(n).astype(config.floatX))
    f = 0.5 * tensor.dot(x,tensor.dot(M,x)) - tensor.dot(b,x) + c
    sol = linear_cg.linear_cg(f,[x])

    fn_sol = theano.function([], sol)

    start = time.time()
    sol  = fn_sol()[0]
    my_lcg = time.time() -start

    eval_f = theano.function([],f)
{'fraction_non_alphanumeric': 0.16459627329192547, 'fraction_numerical': 0.013975155279503106, 'mean_word_length': 3.185064935064935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4809763', 'n_tokens_mistral': 549, 'n_tokens_neox': 535, 'n_words': 101}