Pyrex newbie question

2006-06-04 Thread Philip Smith
Just starting to use pyrex on windows.

Using pyrex version 0.9.3.1.win32

Using Activestate Python 2.4.3.12

Using Mingw compiler

When I try to run the pyrex demo it fails with a message:

"undefined reference to '_imp__Py_NoneStruct' "

Anyone know why? 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple Polynomial Quadratic Sieve

2006-05-30 Thread Philip Smith
Whoops

Should have been

http://www.python.pwp.blueyonder.co.uk/


Thanks

Phil
"Philip Smith" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Just to announce that I have posted an experimental version of MPQS which 
> I am hoping those of a mathematical turn of mind would care to test, 
> comment on and maybe contribute to.
>
> There is work to do but it performs very well.
>
> The package is available via FTP at 
> http://www.pythonstuff.pwp.blueyonder.co.uk/
> account: python password: guest
>
> Thanks
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Multiple Polynomial Quadratic Sieve

2006-05-30 Thread Philip Smith
Just to announce that I have posted an experimental version of MPQS which I 
am hoping those of a mathematical turn of mind would care to test, comment 
on and maybe contribute to.

There is work to do but it performs very well.

The package is available via FTP at 
http://www.pythonstuff.pwp.blueyonder.co.uk/
account: python password: guest

Thanks 


-- 
http://mail.python.org/mailman/listinfo/python-list


Beware complexity

2005-03-12 Thread Philip Smith
I wonder if anyone has any thoughts not on where Python should go but where 
it should stop?

One of the faults with langauges like C++ was that so many new 
features/constructs were added that it became a nightmare right from the 
design stage of a piece of software deciding which of the almost infinite 
different ways to do the same thing to use.

Result: the development of various coding standards (essentially definitions 
of what 'safe subset' of the language you intended to use in all your 
projects) to 'cripple' the overly complex language.

Conventions on type conversion are just one example.  Without using strict 
coding conventions the richness of the language could, and often did, result 
in ambiguity.  In my experience too C++ has defeated its own object (eg 
portability) - I've given up in many cases trying to compile third party 
libraries because I don't have the time to collect every version of every 
compiler for every platform in existence which is what C++ seems to demand 
(particularly if you are trying to cross-compile Unix->Windows).

Nothing wrong with coding conventions of course unless you:

a)Want to read and understand other peoples code
b)Want your code to work with it

There probably isn't a language in existence that provably constrains a 
programmer to use one and only one 'top level' approach to code a particular 
'class' of problem but Python does seem to have a way of naturally 
'suggesting' this through its very simplicity.

It seems to me that from here on in the Python developers should be very 
careful about adding new features to a language which (subjectively) already 
seems capable of handling pretty much any 'class' of problem.  There is 
plenty of scope left of course for continuing to develop libraries and 
optimize performance.



-- 
http://mail.python.org/mailman/listinfo/python-list


Beware complexity

2005-03-12 Thread Philip Smith


-- 
http://mail.python.org/mailman/listinfo/python-list


Derived class and deepcopy

2005-02-16 Thread Philip Smith
Hi

If I derive a class (eg Matrix) from list I presume this implies the classic 
OOP 'is a' relation between the derived and super class.

I therefore presume I can use a derived class in any context that I can use 
the superclass.

In the given example I want to apply deepcopy() to the Matrix instance (on 
initialisation) to ensure that the list part is not affected by subsequent 
changes to the initialising list or Matrix but this gives me a string of 
errors (some of which imply I'm trying to copy the class rather than the 
instance).

Anyone got any thoughts on this

Phil 


-- 
http://mail.python.org/mailman/listinfo/python-list


lambda and for that matter goto not forgetting sugar

2005-02-10 Thread Philip Smith
I've read with interest the continuing debate about 'lambda' and its place 
in Python.

Just to say that personally I think its an elegant and useful construct for 
many types of programming task (particularly number theory/artificial 
intelligence/genetic algorithms)

I can't think why anyone would be proposing to do away with it.  Sometimes 
an anonymous function is just what you need and surely it just reflects the 
python philosophy of everything being an object (in this case a code 
object).

Mind you my particular programming interest is algorithmic programming, I 
have no idea whether Lambda is of any relevance to eg client server 
programming.

For that matter I would find implementing the classical algorithms far 
easier if python had 'goto' (I'll wait for the guffaws to subside before 
mentioning that no lesser guru than Donald Knuth writes his algorithms that 
way - naturally so because it reflects what the machine does at the base 
level).  Please don't suggest using try/except as an alternative as the 
ugliness and inappropriateness of that to achieve a simple 'goto' is utterly 
out of keeping with the 'cleanliness' which is Python's most appealing 
feature.

(And yes - I do like spaghetti but only to eat, not in my code).

Following on naturally from that last point I would also like to 'deprecate' 
the use of the expression 'syntactic sugar' on these pages.  All high level 
languages (Python included) are nothing but syntactic sugar designed to 
conceal the ugliness of what actually gets sent to the CPU to make it all 
happen.

On a positive note though - I have found this newsgroup an invaluable aid to 
learning Python over the last few weeks and the response to queries has been 
as quick as it has been informative.

I've decided I like Python - in fact I think of it more as syntactic maple 
syrup than sugar.

Competition:  Has anyone found anything you can't do in the language?

regards to all

Phil 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multiple constructors

2005-02-06 Thread Philip Smith
Thanks to all of you

Some useful ideas in there, even if some of them stretch my current 
knowledge of the language.

C++ to Python is a steep 'unlearning' curve...

Phil

"Philip Smith" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Call this a C++ programmers hang-up if you like.
>
> I don't seem to be able to define multiple versions of __init__ in my 
> matrix class (ie to initialise either from a list of values or from 2 
> dimensions (rows/columns)).
>
> Even if Python couldn't resolve the __init__ to use on the basis of 
> argument types surely it could do so on the basis of argument numbers???
>
> At any rate - any suggestions how I code this
>
> Thanks
>
> Phil
> 


-- 
http://mail.python.org/mailman/listinfo/python-list


Multiple constructors

2005-02-05 Thread Philip Smith
Call this a C++ programmers hang-up if you like.

I don't seem to be able to define multiple versions of __init__ in my matrix 
class (ie to initialise either from a list of values or from 2 dimensions 
(rows/columns)).

Even if Python couldn't resolve the __init__ to use on the basis of argument 
types surely it could do so on the basis of argument numbers???

At any rate - any suggestions how I code this

Thanks

Phil 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Elliptic Code

2005-01-28 Thread Philip Smith
Quite so - but thanks for your help in any case

"Paul Rubin"  wrote in message 
news:[EMAIL PROTECTED]
> Nick Craig-Wood <[EMAIL PROTECTED]> writes:
>> >  I understand the algorithm quite well but how to code the 
>> > multiplication
>> >  stage most efficiently in python eludes me.
>>
>> You might want to look at
>>
>>   http://gmpy.sourceforge.net/
>>
>> It has very fast multiplication up to any size you like!
>
> I think he's talking about point multiplication on the elliptic curve
> group, not integer multiplication. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Elliptic Code

2005-01-28 Thread Philip Smith
thanks for the suggestion

I understand the algorithm quite well but how to code the multiplication 
stage most efficiently in python eludes me.

William Stein's code is obviously not high performance because in the region 
where ecm should do well (30-40 dec digits) my python implementation of the 
rho algorithm blows it away.  In terms of factoring implementations 
generally (in python) I think nzmath's mpqs is brilliant - and it has such a 
small footprint I can run it in 10 threads at once.

anyway - I'll have a look at MIRACL (I have the library but have never used 
it yet.

Phil

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> "Philip Smith" <[EMAIL PROTECTED]> writes:
>> Does anyone have/know of a python implementation of the elliptic curve
>> factoring algorithm (lenstra) which is both:
>>
>> simply and cleanly coded
>> functional
>
> It's not in Python but take a look at Mike Scott's C++ implementation
> in MIRACL,
>
>   http://indigo.ie/~mscott/
>
> It's the simplest and most direct implementation I know of, just the
> bare essentials.  It could probably be translated into Python pretty
> straightforwardly.
>
>> I'm aware of William Stein's code (from elementary number theory
>> book) but I don't understand his coding style and the algorithm
>> doesn't seem to work efficiently.
>
> A high performance implementation means complicated code, e.g. Peter
> Montgomery has done a few of those.  If it's for instructional
> purposes I think the MIRACL version is far more understandable even if
> it's slower.
>
> If you mean you don't understand the algorithm, try Neal Koblitz's
> book "A Course in Number Theory and Cryptography".  It has no code but
> it explains the algorithm in a pretty accessible way. 


-- 
http://mail.python.org/mailman/listinfo/python-list


Elliptic Code

2005-01-28 Thread Philip Smith
Hi

Does anyone have/know of a python implementation of the elliptic curve 
factoring algorithm (lenstra) which is both:

simply and cleanly coded
functional

I'm aware of William Stein's code (from elementary number theory book) but I 
don't understand his coding style and the algorithm doesn't seem to work 
efficiently.

For that matter has anyone come across any useable math/number theory 
packages apart from nzmath or aladim?

Thanks

Phil 


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Help with Threading

2005-01-25 Thread Philip Smith

<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I use threading.Thread as outlined in this recipe:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65448
>Thanks 


-- 
http://mail.python.org/mailman/listinfo/python-list


Help with Threading

2005-01-23 Thread Philip Smith
Hi

I am fairly new to Python threading and my needs are simple(!)

I want to establish a number of threads each of which work on the same 
computationally intensive problem in different ways.

I am using the thread module rather than the threading module.

My problem is I can't see how (when one thread completes) to ensure that the 
other threads terminate immediately.

Appreciate some simple advice

Phil 


-- 
http://mail.python.org/mailman/listinfo/python-list