This object is solely for me to organize my thoughts, it probably is a horrific thing if seen by a theoretical computer scientist, and gets a lot of the terminalogy wrong. Type probably usually means a theoretical type, which I think is defined as the set of all possible instances.
#!/usr/bin/env python3 | |
from pathlib import Path | |
import ast | |
import tokenize | |
class FindFuncs(ast.NodeVisitor): | |
# Very dirtily adapted and stolen from NumPy tests... | |
def __init__(self, filename, include_attributes=True): |
Downloading both files and running the cells (takes a while) should give you drop downs with the NumPy namespace (dark green names should be the ones that end up in the main numpy namespace).
After clicking one of them, tab will go to the next, and 1, 2, 3 , and 4 will allow to fairly quickly choose how you feel about the function. I left many blank (at least the ones that are not part of the main namespace). Then you press "save" and after gathering a few of them, maybe we can get some nice result out of the data.
Unfortunately the Jupyter widgets are failry slow, although with the keyboard it was not an issue for me.
My take on the categories:
import operator | |
def normalize_index(index, ndim): | |
"""Does basic index normalization like numpy, disregards advanced indexing. | |
Parameters | |
---------- | |
index : tuple | |
Indexing tuple to normalize | |
ndim : int |
This table includes the promotion rules for the basic numeric types. The only suprising rule is that 8-byte integers are considered to cast "safely" to f8 (and complex), which also shows up in these promotion rules (If there was an int128, it would be allowed to safely cast to float128!):
i1 | u1 | i2 | u2 | i4 | u4 | i8 | u8 | f2 | f4 | f8 | f16 | c8 | c16 | c32 |
---|
""" | |
Simply run the script to try to guess some information about how numpy | |
is linked. | |
If there is something odd going on, run/import the script after | |
your real import of numpy. | |
All versions tested on Linux, MKL is confusing me a bit since both lower and | |
upper case versions exist. |
# | |
# A Map reduce made from ufuncs and with nditer, a C-Api version | |
# would be very similar (but cleaner in some cases). This still creates | |
# some unnecessary temporaries, which may or may not slow down things a | |
# a bit for no reason | |
# | |
# WARNING : Mostly untested and I am not sure I would use it except to | |
# get the idea of how to implement a specialized version maybe. | |