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

2022-03-05 Thread BELAHCENE Abdelkader
thanks a lot
regards

Le ven. 4 mars 2022 à 23:54, Alex Willmer  a écrit :

> Each email from this list has a link to the listinfo page at the bottom,
> https://mail.python.org/mailman/listinfo/python-uk. This is true of all
> python.org mailing lists.
>
> Follow the instructions there to change your options, or unsubscribe.
>
> On Fri, 4 Mar 2022 at 20:52, BELAHCENE Abdelkader <
> abdelkader.belahc...@enst.dz> wrote:
>
>> 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
>>
> ___
> python-uk mailing list
> python-uk@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>
___
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk


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-uk@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>
___
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk


Re: [python-uk] C is it faster than numpy

2022-02-25 Thread BELAHCENE Abdelkader
Thanks,
But the different is very significant!!!
so?

Le ven. 25 févr. 2022 à 10:58, Edward Hartley  a
écrit :

>
> Hi,
> Simply check the original Numpy aka Numerical Python docs where it’s
> comprehensively explained that the library is implemented in C with a thin
> Python wrapper. The docs were written circa ‘98 by the original library
> author. The library was optimised over a long period before being released.
> I’ve seen similar results when replacing an optimised Fortran library with
> C/C++ the key is the effort given to optimisation, and care with avoiding
> unnecessary memory allocation.
> I’ll dig out the reference when I’ve tracked it down.
> Best of Luck
> Ed Hartley
>
> On 25 Feb 2022, at 09:42, Giorgio Zoppi  wrote:
>
> 
> Well,
> numpy is written in C :) Maybe your C is not the numpy equivalent?
> Best Regards,
> Giorgio
>
> Il giorno ven 25 feb 2022 alle ore 09:03 BELAHCENE Abdelkader <
> abdelkader.belahc...@enst.dz> ha scritto:
>
>> 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.521730The value : 1250025000 *
>> 
>>
>> This is the Python3 program :
>>
>> import timeit as it
>> import numpy as np
>> import sys
>> try :
>> 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);
>> }
>> ___
>> python-uk mailing list
>> python-uk@python.org
>> https://mail.python.org/mailman/listinfo/python-uk
>>
>
>
> --
> Life is a chess game - Anonymous.
> ___
> python-uk mailing list
> python-uk@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>
> ___
> python-uk mailing list
> python-uk@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>
___
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk


Re: [python-uk] C is it faster than numpy

2022-02-25 Thread BELAHCENE Abdelkader
Hi,
What do you mean?
the python and C programs are not equivalent?


Le ven. 25 févr. 2022 à 10:42, Giorgio Zoppi  a
écrit :

> Well,
> numpy is written in C :) Maybe your C is not the numpy equivalent?
> Best Regards,
> Giorgio
>
> Il giorno ven 25 feb 2022 alle ore 09:03 BELAHCENE Abdelkader <
> abdelkader.belahc...@enst.dz> ha scritto:
>
>> 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.521730The value : 1250025000 *
>> 
>>
>> This is the Python3 program :
>>
>> import timeit as it
>> import numpy as np
>> import sys
>> try :
>> 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);
>> }
>> ___
>> python-uk mailing list
>> python-uk@python.org
>> https://mail.python.org/mailman/listinfo/python-uk
>>
>
>
> --
> Life is a chess game - Anonymous.
> ___
> python-uk mailing list
> python-uk@python.org
> https://mail.python.org/mailman/listinfo/python-uk
>
___
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk


[python-uk] C is it faster than numpy

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.521730The value : 1250025000 *


This is the Python3 program :

import timeit as it
import numpy as np
import sys
try :
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);
}
___
python-uk mailing list
python-uk@python.org
https://mail.python.org/mailman/listinfo/python-uk