#! /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
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
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
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
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.
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