[Numpy-discussion] Errors with "**" for numpy.float16

2012-06-10 Thread Edward C. Jones
#! /usr/bin/env python3.2 import numpy for t in (numpy.float16, numpy.float32, numpy.float64, numpy.float128): two = t(2) print(t, two, two ** two, numpy.power(two, two)) """ I use up-to-date debian testing (wheezy), amd64 architecture. The python package is python3, version 3.2.3~rc1

[Numpy-discussion] Incorrect overflow warning message for float128

2012-06-09 Thread Edward C. Jones
I use up-to-date Debian testing (wheezy), amd64 architecture. From the docs for numpy.MachAr: maxexp int Smallest (positive) power of ibeta that causes overflow. On my machine, ibeta = 2 and maxexp = 16384. For float64, float32, and float16 things behave as expected. For float128, I get the m

Re: [Numpy-discussion] Are "min", "max" documented for scalars?

2012-06-07 Thread Edward C. Jones
Silly mistakes. If a and b are Python ints, Python floats, or non-complex numpy.number's, "max" returns, unchanged, the largrt of the two objects. There is no coercion to a common type. This useful behavior needs to be documented. ___ NumPy-Discus

[Numpy-discussion] Are "min", "max" documented for scalars?

2012-06-06 Thread Edward C. Jones
Python "max" and "min" have an interesting and _useful_ behavior when applied to numpy scalars and Python numbers. Here is a piece of pseudo-code: def max(a, b): if int(b) > int(a): return b else: return a The larger object is returned unchanged. If the two objects a

[Numpy-discussion] numpy.clip behavior at max and min of dtypes

2012-06-05 Thread Edward C. Jones
Can the following function be written using numpy.clip? In some other way? Does numpy.clip satisfy condition 4 below? Does numpy.clip satisfy some closely related condition? Define a function clipcast: output = clipcast(arr, dtype=None, out=None) 1. All arrays have int or float dtypes. 2.

[Numpy-discussion] Permuting sparse arrays

2012-01-25 Thread Edward C. Jones
I have a vector of bits where there are many more zeros than one. I store the array as a sorted list of the indexes where the bit is one. If the bit array is (0, 1, 0, 0, 0, 1, 1), it is stored as (1, 5, 6). If the bit array, b, has length n, and p is a random permutation of arange(n), then