Re: [python-uk] Fwd: It Will Never Work in Theory: live!

2022-03-04 Thread BELAHCENE Abdelkader
hi,
I receive a lot of email from the python-list, I want to disable it, when I
want to read the email, I want to go to he List.
Please How to disable  it.
Regards

Le jeu. 3 mars 2022 à 18:05, Steve Holden  a écrit :

> A communication from my good friend Greg Wilsin (instigator of the
> Software Carpentry workshops) which may be of use to some. It certainly
> looks like great value for money.
>
> Kind regards,
> Steve
>
>
> -- Forwarded message -
> From: Greg Wilson 
> Date: Tue, Mar 1, 2022 at 5:11 PM
> Subject: It Will Never Work in Theory: live!
> To: Steve Holden 
>
>
> Hi Steve,
>
> On April 27, It Will Never Work in Theory is running two sets of online
> lightning talks from leading software engineering researchers in which
> they’ll summarize actionable findings from their work for practitioners.
> Tickets are now on sale at https://neverworkintheory.org/, and all money
> raised will to go Books for Africa. I hope to see you there, and if you
> could help spread the word or help sponsor it by matching money raised
> from ticket sales, we'd be very grateful.
>
> Cheers,
>
> Greg
>
> ___
> python-uk mailing list
> python...@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: C is it always faster than nump?

2022-02-25 Thread BELAHCENE Abdelkader
Thanks every body,
I want to close the subject, but just a naive question:
Does numpy use  a* vectorization *for arrays?
I mean when I add 2 arrays ( or in sum function) how it is done,
in an other word
b=np.arange(100);
 t=np.sum(b)
is equivalent or not to
 s=0
for i in range(100): s +=b[i]
thanks a lot


Le sam. 26 févr. 2022 à 06:44, Dan Stromberg  a écrit :

>
> On Fri, Feb 25, 2022 at 8:12 AM BELAHCENE Abdelkader <
> abdelkader.belahc...@enst.dz> wrote:
>
>> Hi,
>> a lot of people think that C (or C++) is faster than python, yes I agree,
>> but I think that's not the case with numpy, I believe numpy is faster than
>> C, at least in some cases.
>>
>
> This is all "last time I heard".
>
> numpy is written, in significant part, in Fortran.
>
> Fortran, especially for matrix math with variable dimensions, can be
> faster than C.
>
> Fortran, (still last I heard) did not support pointers, which gives
> Fortran compilers the chance to exploit a very nice class of optimizations
> you can't use nearly as well in languages with pointers.
>
> I used to code C to be built with the "noalias" optimization, to get much
> of the speed of Fortran in C.  But it required using an error prone subset
> of C without good error detection.
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


C is it always faster than nump?

2022-02-25 Thread BELAHCENE Abdelkader
Hi,
a lot of people think that C (or C++) is faster than python, yes I agree,
but I think that's not the case with numpy, I believe numpy is faster than
C, at least in some cases.


*Is there another explanation ?Or where can find  a doc speaking  about the
subject?*Thanks a lot
Regards
Numpy implements vectorization for arrays, or I'm wrong. Anyway here is an
example Let's look at the following case:
Here is the result on my laptop i3:

Labs$ *python3 tempsExe.py  5*
  sum with Python: 1250025000 and NumPy 1250025000
  time used Python Sum: * 37.28 sec *
  time used  Numpy Sum:  *1.85 sec*

Labs$ *./tt5 *

*   CPU  time :7.521730*

*The value : 1250025000 *





















*This is the Python3 program :import timeit as itimport numpy as npimport
systry : n=eval(sys.argv[1])except: print ("needs integer as argument") ;
exit() a=range(1,n+1)b=np.array(a)def func1(): return sum(a)def
func2(): return np.sum(b)print(f"sum with Python: {func1()} and NumPy
{func2()} ")tm1=it.timeit(stmt=func1, number=n)print(f"time used Python
Sum: {round(tm1,2)} sec")tm2=it.timeit(stmt=func2, number=n)print(f"time
used  Numpy Sum: {round(tm2,2)} sec")*


















*and Here the C program:#include #include #include
long func1(int n){ long  r=0;for (int  i=1; i<=
n;i++) r+= i; return r;}int main(int argc, char* argv[]){
clock_t c0, c1; long v,count; int n;   if ( argc < 2)
{  printf("Please give an argument"); return
-1;  }n=atoi(argv[1]); c0 = clock();*




*   for (int j=0;j < n;j++) v=func1(n); c1 = clock(); printf
("\tCPU  time :%.2f sec", (float)(c1 - c0)/CLOCKS_PER_SEC);
printf("\n\tThe value : %ld\n",  v);}*
-- 
https://mail.python.org/mailman/listinfo/python-list