, cdecimal uses a Number Theory Transform for multiplication of very large
numbers. It has been a while since I looked so I could be wrong.
casevh
--
https://mail.python.org/mailman/listinfo/python-list
the transcendental function available in the MPFR library. I
did a quick performance test of sqrt() and ln() at around 1000 decimal digits.
gmpy2 was about ~200 times faster than the corresponding functions in decimal.
casevh
--
https://mail.python.org/mailman/listinfo/python-list
.mpz(x)
Python 3.x performs true division by default. When integer division involves
an mpz, the result will be an mpfr with the precision of the current context.
Does this help?
casevh
--
https://mail.python.org/mailman/listinfo/python-list
I'm pleased to announce the release of GMPY2 2.0.0. GMPY2 provides access to
the GMP/MPIR, MPFR, and MPC arbitrary precision arithmetic libraries.
Highlights
--
* Support for correctly rounded arbitrary precision real arithmetic, including
trigonometric, logarithmic, exponential, and
on performance.
gmpy will be faster than Python as the numbers get larger. The cutover varies
depending on the platform, but usually occurs between 50 and 100 digits.
casevh
--gv
--
http://mail.python.org/mailman/listinfo/python-list
On Thursday, October 25, 2012 7:56:25 AM UTC-7, Charles Hixson wrote:
In Python3 is there any good way to count the number of on bits in an
integer (after an operation)?
You may want to look at gmpy2[1] and the popcount() function.
Alternatively, is there any VERY light-weight
:
http://readthedocs.org/docs/gmpy2/en/latest/
Please test this release and report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/
release, I will document the name
changes. import gmpy2 as gmpy; gmpy.scan0=gmpy.bit_scan0; etc should work
just fine.
If you encounter problems with the alpha release, please open an issue on
gmpy's site.
Thanks,
casevh
On Sunday, March 25, 2012 9:59:56 PM UTC-7, Mensanator wrote:
OK, GMPY
a
binary installer with python setup.py bdist-wininst.
There may be a cleaner way to build PyCrypto, but these steps worked for me.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
and then adapt/modify the process for
PyCrypto.
MPIR home page: www.mpir.org
gmpy source: gmpy.googlecode.com/files/gmpy-1.15.zip
doesn't even MinGW install PyCrypto for me?
Thanks for all suggestions,
Alec Taylor
Hope these comments help...
casevh
--
http://mail.python.org/mailman/listinfo/python-list
or something similar.
There is also another library http://pypi.python.org/pypi/bitarray
which resembles numpy's bit array.
Hope it helps,
S.Nizamov
You can also use gmpy or gmpy2.
a=gmpy2.mpz(123)
bin(a)
'0b011'
gmpy2.hamdist(a,0)
6
casevh
--
http://mail.python.org/mailman
) and
(1.21)?
casevh
jmf
--
http://mail.python.org/mailman/listinfo/python-list
that operations with mutable integers should be much faster.
With agressive caching of deleted objects, the object creation
overhead is very low. So the big win for mutable integers is reduced
to avoiding memory copies.)
casevh
To be clear, this is nothing you should consider when writing fast code
converge to pi^2/6 from below and since the sum(1/k^2) is between
the two partial sums, it must also converge to pi^2/6.
Try calculating sum(1/k^2) for k in range(1, 2**n) and compare that
with the upper and lower sums. I verified it with several values up to
n=20.
casevh
--
http://mail.python.org
mailing
list.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
consistent
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/
an exception
* more complete coverage for MPFR
* many function names were changed to be more consistent
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-list
critical code with
older versions of gmpy, I'd recommend upgrading to 1.14.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
/3.2/lib/python3.2/site-packages/_pcapmodule.so
^D- Hide quoted text -
- Show quoted text -
This is a change in the C-API in 3.2. See http://bugs.python.org/issue5630
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 27, 4:00 am, m...@distorted.org.uk (Mark Wooding) wrote:
casevh cas...@gmail.com writes:
I coded a quick matrix inversion function and measured running times
using GMPY2 rational and floating point types. For the floating point
tests, I used a precision of 1000 bits. With floating
On Nov 27, 3:08 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Fri, 26 Nov 2010 19:21:47 -0800, casevh wrote:
On Nov 26, 2:11 pm, Steven D'Aprano steve
+comp.lang.pyt...@pearwood.info wrote:
On Fri, 26 Nov 2010 12:54:12 -0800, John Nagle wrote:
For ordinary number
at http://code.google.com/p/gmpy/
casevh
Disclaimer: I'm the current maintainer of GMPY.
--
http://mail.python.org/mailman/listinfo/python-list
matrix
using rationals would take a month or longer and require much more
memory. But the rational solution would be exact.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
performance improvements.
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/
performance improvements.
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-list
of the mpq rational type
to match previous versions of GMPY (prior to 1.10)
and to match Python's Fraction type. Properties
to access the numerator and denominator were
added.
Binary installers for Python 3.2 are available.
Please report any issues!
casevh
--
http://mail.python.org/mailman
of the VS 2008 amd64 compiler. I've used it compile MPIR and
GMPY successfully. The GMPY source includes a text file describing the
build process using the SDK tools.
casevh
Also, VS2010 should work as well - doesn't it?
Remember Python on Windows will still require VS2008 for a long time
Microsoft's SDK compilers
using MPIR 2.1.1. Detailed instructions are included if you
want to compile your own binary.
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org
Microsoft's SDK compilers
using MPIR 2.1.1. Detailed instructions are included if you
want to compile your own binary.
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python-list
to make sure that no part of the existing Python installation
on Fedora Core is overwritten by an altinstall of 2.6.
John Nagle
It's placed in the directory specified by --prefix. If --prefix is not
specified, /usr/local is used by default.
casevh
--
http
On Mar 8, 10:39 pm, casevh cas...@gmail.com wrote:
[also replying to Geremy since the OP's message doesn't appear...]
On Mar 8, 11:05 am, geremy condra debat...@gmail.com wrote:
On Mon, Mar 8, 2010 at 2:15 AM, Fahad Ahmad miracles...@hotmail.com wrote:
Thanks Geremy,
That has been
There still is a 98 digit unfactored composite:
60252507174568243758911151187828438446814447653986842279796823262165159406500174226172705680274911
Factoring this remaining composite using ECM may not be practical.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 2, 10:03 pm, Mensanator mensana...@aol.com wrote:
On Feb 2, 12:45 am, casevh cas...@gmail.com wrote:
Everyone,
I'm pleased to annouce the final release of GMPY 1.11.
GMPY is a wrapper for the MPIR or GMP multiple-precision
arithmetic library. GMPY 1.11 is available for download
On Feb 3, 10:22 am, Mensanator mensana...@aol.com wrote:
On Feb 3, 10:37 am, casevh cas...@gmail.com wrote:
On Feb 2, 10:03 pm, Mensanator mensana...@aol.com wrote:
On Feb 2, 12:45 am, casevh cas...@gmail.com wrote:
Everyone,
I'm pleased to annouce the final release of GMPY
and use code
optimized for the CPU at runtime. The 64-bit Windows installers were
compiled Microsoft's SDK compilers using MPRI 1.3.1. Detailed
instructions are included if you want to compile your own binary.
Please report any issues!
casevh
--
http://mail.python.org/mailman/listinfo/python
://bugs.python.org/issue6377.
I applied the patch to my local copy of Python 3.1 and it seems to
work.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
binomial coefficients and
factorials. If you are floating point approximations, check out mpmath
(http://code.google.com/p/mpmath/).
casevh
--
http://mail.python.org/mailman/listinfo/python-list
is using math.ceil and math.floor.
import math
100*math.ceil(1234.5678/100)
1300
100*math.floor(1234.5678/100)
1200
100*math.ceil(-1234.5678/100)
-1200
100*math.floor(-1234.5678/100)
-1300
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 12, 9:03 pm, Dave WB3DWE wrote:
On Sun, 10 Jan 2010 22:08:20 -0800 (PST), casevh cas...@gmail.com
wrote:
On Jan 10, 8:16 pm, Dave WB3DWE wrote:
On Sat, 9 Jan 2010 16:48:52 -0800 (PST), casevh cas...@gmail.com
wrote:
On Jan 9, 3:10 pm, pdlem...@earthlink.net wrote:
On Sat
On Jan 10, 8:16 pm, Dave WB3DWE wrote:
On Sat, 9 Jan 2010 16:48:52 -0800 (PST), casevh cas...@gmail.com
wrote:
On Jan 9, 3:10 pm, pdlem...@earthlink.net wrote:
On Sat, 9 Jan 2010 13:27:07 -0800 (PST), casevh cas...@gmail.com
wrote:
1) Try the commands again. Make sure all the ./configure
On Jan 9, 10:06 am, Dave WB3DWE wrote:
On Jan 6 I inquired how to fix the 3.1.1 interactive terminal
in Ubuntu Linux. Left arrow yields ^[[D , etc.
casevh helped by suggesting libreadline5-dev be installed.
Did so with Synaptic Package Manager.
The behavior of the Python 3.3.1 terminal
On Jan 9, 3:10 pm, pdlem...@earthlink.net wrote:
On Sat, 9 Jan 2010 13:27:07 -0800 (PST), casevh cas...@gmail.com
wrote:
Did you recompile Python 3.1.1 after installing libreadline5-dev?
(From the Python 3.1.1 directory. Your options to configure may vary.)
make distclean
./configure
reference before stuffing the
object into the cache (even though it will look like there is a memory
leak when running under a debug build)?
Thanks in advance for any comments,
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 8, 2:59 am, Diez B. Roggisch de...@nospam.web.de wrote:
casevh schrieb:
I'm working with a C extension that needs to rapidly create and delete
objects. I came up with an approach to cache objects that are being
deleted and resurrect them instead of creating new objects
On Jan 8, 9:19 am, Diez B. Roggisch de...@nospam.web.de wrote:
casevh schrieb:
On Jan 8, 2:59 am, Diez B. Roggisch de...@nospam.web.de wrote:
casevh schrieb:
I'm working with a C extension that needs to rapidly create and delete
objects. I came up with an approach to cache objects
On Jan 8, 8:56 am, Antoine Pitrou solip...@pitrou.net wrote:
Le Fri, 08 Jan 2010 08:39:17 -0800, casevh a écrit :
Thanks for the reply. I realized that I missed one detail. The objects
are created by the extension but are deleted by Python. I don't know
that an object is no longer needed
compiled the source code, you will also need to install
libreadline5-dev via Synaptic or apt-get.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
number of bits on a
64-bit platform is limited to 2**37 or 41 billion decimal digits. A
number this size requires 16GB of RAM. A future version of GMP (5.x)
is supposed to remove that limit and also work well with disk-based
storage.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
? (gmpy.gmp_limbsize())
For best performance with large numbers, GMPY should be compiled as a
64-bit application. If Python and gmp are not compiled in 64-bit mode,
you probably will want to compile both of them from source or find 64-
bit versions.
casevh
--
http://mail.python.org/mailman
};
if (!PyArg_ParseTupleAndKeywords(args, kwrds, |CC, kwlist, a,
b))
return NULL;
return Py_BuildValue((CC), a, b);
}
The default values seem to remain as 'A' and 'B'.
foo()
('A', 'B')
foo(b='b')
('A', 'b')
foo()
('A', 'B')
foo('a')
('a', 'B')
foo('a', b='b')
('a', 'b')
foo()
('A', 'B')
casevh
On Dec 18, 10:28 am, Joachim Dahl dahl.joac...@gmail.com wrote:
My mistake seems to be that I declared
char a, b;
instead of
int a, b;
Thank you for sorting this out.
Joachim
I think you need to initialize them, too.
--
http://mail.python.org/mailman/listinfo/python-list
. I plan to add a new
mutable integer type in the next release of GMPY. If you want to
experiment with mutable integers now, GMPY can be compiled with
mutable version of the standard 'mpz' type. Please see the file
mutable_mpz.txt for more information.
Please report any issues!
casevh
--
http
) to parse a single character from a
byte-string and uses C (uppercase c) to parse a single character
from a Unicode string. I don't think there is an easy way to accept a
character from both.
HTH,
casevh
--
http://mail.python.org/mailman/listinfo/python-list
. It appears to be a bug in Python. The format code 'C' is missing
in the switch statement in skipitem() in getargs.c. I added case
'C': /* int */ after case 'c': /* char */ and then example worked
for me.
I'll open a bug report.
casevh
On Nov 30, 10:19 pm, casevh cas...@gmail.com wrote:
On Nov 30, 1
. I plan to add a new
mutable integer type in the next release of GMPY. If you want to
experiment with mutable integers now, GMPY can be compiled with
mutable version of the standard 'mpz' type. Please see the file
mutable_mpz.txt for more information.
Please report any issues!
casevh
--
http
numeric protocols, and
false otherwise. This function always succeeds.
What do they mean: always succeeds ?
That it will always return true or false; it won't raise an error.
(2) It seems PyNumber_check(py_val) returns true when passed an instance!
Please advise.
--
Elias
casevh
--
http
,
casevh
--
http://mail.python.org/mailman/listinfo/python-list
fractional exponent, inexact-root
Warning: Completely untested fix ahead!
What happens if you change turtle.py to use
nhops=1+int((math.sqrt(diffsq)/(3*math.pow(1.1, self._speed)
*self._speed))
casevh
--
http://mail.python.org/mailman/listinfo/python-list
automatically so I think the
revised calculation for nhops should work with either any numerical
type that supports __float__.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 24, 3:28 pm, superpollo u...@example.net wrote:
is there a pythonic and synthetic way (maybe some standard module) to
pack an integer (maybe a *VERY* big one) into a string? like this:
number = 252509952
hex(number)
'0xf0cff00'
so i would like a string like
. The time
includes conversion from a string. If the numbers are already Python
longs, it can check 800,000 per second. Checking a billion is not
unreasonable.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
GMPY 1.10 beta is now available. This version fixes an issue where
very large objects would be cached for reuse instead of being freed.
Source code and Windows installers may be found at
http://code.google.com/p/gmpy/downloads/list
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 8, 5:03 pm, Mensanator mensana...@aol.com wrote:
On Jul 7, 12:47 am, Mensanator mensana...@aol.com wrote:
On Jul 7, 12:16 am, casevh cas...@gmail.com wrote:
I discovered a serious bug with comparisons and have posted alpha2
which fixes that bug and adds Unicode support
!
casevh
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations/
!
casevh
--
http://mail.python.org/mailman/listinfo/python-list
I discovered a serious bug with comparisons and have posted alpha2
which fixes that bug and adds Unicode support for Python 2.x
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 28, 5:39 pm, Li Wang li.wan...@gmail.com wrote:
2009/4/29 Tim Chase python.l...@tim.thechases.com:
I want to concatenate two bits string together: say we have '1001' and
'111' which are represented in integer. I want to concatenate them to
'100' (also in integer form), my method
On Apr 21, 12:11 am, Paul Rubin http://phr...@nospam.invalid wrote:
casevh cas...@gmail.com writes:
Python 3.1 is significantly faster than Python 2.x on 64-bit
platforms. The following times are for multiplication with 2, 30 and
300 decimal digits.
Could you test pow(a,b,c) where a,b,c
On Apr 21, 5:47 am, Paul Rubin http://phr...@nospam.invalid wrote:
casevh cas...@gmail.com writes:
Could you test pow(a,b,c) where a,b,c are each 300 decimal digits?
$ py25 -m timeit -s a=long('23'*150);b=long('47'*150);m=long
('79'*150) c=pow(a,b,m)
10 loops, best of 3: 52.7 msec per
is an LGPLv2 fork of GMP and is significantly
faster than GMP 4.2.x. The newly released GMP 4.3.0 is about 10%
faster yet.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
to
the site-packages directory.
casevh
--
http://mail.python.org/mailman/listinfo/python-announce-list
Support the Python Software Foundation:
http://www.python.org/psf/donations.html
to represent its argument in binary:
Any tips on how to get this in 2.5.2 as that's the production version
I'm stuck with.
Cheers,
Jon.
If performance does become an issue, the newly released gmpy 1.04
includes bit_length().
casevh
--
http://mail.python.org/mailman/listinfo/python-list
function. I think it will do
exactly what you want.
http://code.google.com/p/gmpy/
casevh
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 1, 1:04 pm, Mensanator mensana...@aol.com wrote:
On Feb 1, 2:27 am, casevh cas...@gmail.com wrote:
On Jan 31, 9:36 pm, Tim Roberts t.robe...@cqu.edu.au wrote:
Actually, all I'm interested in is whether the 100 digit numbers have an
exact integral root, or not. At the moment
On Feb 1, 10:02 pm, Mensanator mensana...@aol.com wrote:
On Feb 1, 8:20 pm, casevh cas...@gmail.com wrote:
On Feb 1, 1:04 pm, Mensanator mensana...@aol.com wrote:
On Feb 1, 2:27 am, casevh cas...@gmail.com wrote:
On Jan 31, 9:36 pm, Tim Roberts t.robe...@cqu.edu.au wrote
?
I've added it for you.
Thanks
Martin
Thanks for reporting the issue.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
the decimal module:
from decimal import *
t=Decimal('1.23456')
t
Decimal(1.23456)
getcontext().prec = 5
+t
Decimal(1.2346)
Thanks for the feedback.
--
Ethan
casevh
--
http://mail.python.org/mailman/listinfo/python-list
/
site.py, look for the line prefixes.insert(0, '/usr/local') and
comment it out. That should do it.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
on Python 2.6. A new version and Windows binaries
were released shortly after 2.6b1 was released.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
Hi everyone,
I'm happy to announce that GMPY v1.03 has been released.
It is available at: http://code.google.com/p/gmpy/
What is GMPY?
==
GMPY is a C-coded Python extension module that wraps the GMP library
to
provide to Python code fast multiprecision arithmetic (integer,
No, I do not know that. Define desperate.
Does Python support the extended Euclidean algorithm
and other number theory functions?
No.
How fast does Python multiply?
Python uses the Karatsuba algorithm which O(n^1.585). Division is
still O(n^2).
Not that the latter is particularly
not a Python problem. That is just the behavior for floating-
point arithmetic.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
)
--
Michael Press
GMPY provides the interface between Python and GMP. It is available at
http://code.google.com/p/gmpy/downloads/list
casevh
--
http://mail.python.org/mailman/listinfo/python-list
-point-calculations-so-inaccurate
casevh
--
http://mail.python.org/mailman/listinfo/python-list
language. It includes support for MPFR, a
multiple-precision floating point library based on GMP. www.sagemath.org
casevh
--
http://mail.python.org/mailman/listinfo/python-list
)
casevh
--
http://mail.python.org/mailman/listinfo/python-list
as a binary number. If you really need
decimal numbers, use the Decimal class.
See http://docs.python.org/tut/node16.html.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
by the
numerator and denominator was bounded. IIRC, a use case was matrix
inversion.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
, Decimal, and Rational
arithmetic. They all have there appropriate problem domains.
And sometimes you just need unlimited precision, radix-6, fixed-point
arithmetic
casevh
--
http://mail.python.org/mailman/listinfo/python-list
casevh
--
http://mail.python.org/mailman/listinfo/python-list
-
for s in f:
print s
-
casevh
--
http://mail.python.org/mailman/listinfo/python-list
()
if __name__ == '__main__':
write_file(loops=150)
read_file()
casevh
--
http://mail.python.org/mailman/listinfo/python-list
.
Decimal was intended to solve a different class of problems. It
provides predictable arithmetic using decimal floating point.
IEEE-754 provides predictable arithmetic using binary floating
point.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
performance. I'm more curious about the original script. Either the
test was against the loopback address, or he has a very impressive
netork to sustain 1.8Gbit/s.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
releases of Python and
GMP, so I consider it stable.
Actually, gmpy is being maitained even if SourceForge isn't up to
date.
I got my gmpy 1.04a for Python 2.5 Windows binary from
http://home.comcast.net/~casevh
I haven't used the rationals all that much, but been very
happy with them when I
and 1.03 as CVS updates only. I think he
may have made an announcement that 1.02 included alpha support for
Python 2.5. 1.04a is 1.03 with one additional fix. I don't think there
has been an official release, though.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
be happy to
point everyone to a real release.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
Alex's most recent SVN version on Linux without any
problems. I'll make Windows binaries next.
casevh
--
http://mail.python.org/mailman/listinfo/python-list
elapsed:, round(clock() - start_time, 2), s
print len(pi)
casevh
--
http://mail.python.org/mailman/listinfo/python-list
Yes, this gmpy sounds good for calc things like that.
But not available on my machine.
ImportError: No module named gmpy
What type of machine?
The home page for gmpy is http://sourceforge.net/projects/gmpy/
I have Windows versions available at http://home.comcast.net/~casevh/
casevh
1 - 100 of 156 matches
Mail list logo