Cython using this code? using % Cython does not work
quarta-feira, 23 de março de 2016 11:26:16 UTC-3, [email protected] escreveu: indeed, using RDF time is reduced: > > %time > > x = srange(1,10,*RDF(0.000001)*) > > for k in range(1,len(x)): > > if abs(sin(x[k])*x[k]^2 + cos(x[k])*x[k]^2 + x[k] + cos(sin(x[k]))^2) > < 0.0001: > > > print("Valor(y):",sin(x[k])*x[k]^2+cos(x[k])*x[k]^2+x[k]+cos(sin(x[k]))^2," > . Raiz(x): ",x[k]) > > print("fim") > > out: 33.17s > > > Em quarta-feira, 23 de março de 2016 09:47:11 UTC-3, Jeroen Demeyer > escreveu: >> >> Arithmetic in RR is slower than arithmetic with native C types. If you >> use RDF instead of RR, Sage will be faster than numpy, especially if you >> use methods instead of global functions: >> >> sage: import numpy as np >> sage: np1 = np.float64('1'); RR1 = 1.0; RDF1 = RDF(1) >> sage: timeit('np.sin(np1)', number=10000, repeat=20) >> 10000 loops, best of 20: 812 ns per loop >> sage: timeit('sin(RR1)', number=10000, repeat=20) >> 10000 loops, best of 20: 3.85 µs per loop >> sage: timeit('sin(RDF1)', number=10000, repeat=20) >> 10000 loops, best of 20: 620 ns per loop >> sage: timeit('RDF1.sin()', number=10000, repeat=20) >> 10000 loops, best of 20: 151 ns per loop >> >> -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
