Skip to content

Commit a41de3a

Browse files
committed
ENH: core: Start einsum function, add copyright notices to files
1 parent 27987d2 commit a41de3a

12 files changed

+930
-3
lines changed

THANKS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Roberto de Almeida for the buffered array iterator.
4747
Alan McIntyre for updating the NumPy test framework to use nose, improve
4848
the test coverage, and enhancing the test system documentation.
4949
Joe Harrington for administering the 2008 Documentation Sprint.
50+
Mark Wiebe for the new NumPy iterator, the float16 data type, improved
51+
low-level data type operations, and other NumPy core improvements.
5052

5153
NumPy is based on the Numeric (Jim Hugunin, Paul Dubois, Konrad
5254
Hinsen, and David Ascher) and NumArray (Perry Greenfield, J Todd

numpy/core/code_generators/genapi.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
join('multiarray', 'datetime.c'),
4747
join('multiarray', 'new_iterator.c.src'),
4848
join('multiarray', 'new_iterator_pywrap.c'),
49+
join('multiarray', 'einsum.c.src'),
4950
join('umath', 'ufunc_object.c'),
5051
join('umath', 'loops.c.src'),
5152
]

numpy/core/code_generators/numpy_api.py

+1
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@
300300
'PyArray_ResultType': 265,
301301
'PyArray_CanCastArrayTo': 266,
302302
'PyArray_CanCastTypeTo': 267,
303+
'PyArray_EinsteinSum': 268,
303304
}
304305

305306
ufunc_types_api = {

numpy/core/numeric.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'can_cast', 'promote_types', 'min_scalar_type', 'result_type',
77
'asarray', 'asanyarray', 'ascontiguousarray', 'asfortranarray',
88
'isfortran', 'empty_like', 'zeros_like',
9-
'correlate', 'convolve', 'inner', 'dot', 'outer', 'vdot',
9+
'correlate', 'convolve', 'inner', 'dot', 'einsum', 'outer', 'vdot',
1010
'alterdot', 'restoredot', 'roll', 'rollaxis', 'cross', 'tensordot',
1111
'array2string', 'get_printoptions', 'set_printoptions',
1212
'array_repr', 'array_str', 'set_string_function',
@@ -218,6 +218,7 @@ def extend_all(module):
218218
lexsort = multiarray.lexsort
219219
compare_chararrays = multiarray.compare_chararrays
220220
putmask = multiarray.putmask
221+
einsum = multiarray.einsum
221222

222223
def asarray(a, dtype=None, order=None):
223224
"""

numpy/core/setup.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ def generate_multiarray_templated_sources(ext, build_dir):
602602
sources = [join(local_dir, subpath, 'scalartypes.c.src'),
603603
join(local_dir, subpath, 'arraytypes.c.src'),
604604
join(local_dir, subpath, 'new_iterator.c.src'),
605-
join(local_dir, subpath, 'lowlevel_strided_loops.c.src')]
605+
join(local_dir, subpath, 'lowlevel_strided_loops.c.src'),
606+
join(local_dir, subpath, 'einsum.c.src')]
606607

607608
# numpy.distutils generate .c from .c.src in weird directories, we have
608609
# to add them there as they depend on the build_dir
@@ -771,7 +772,8 @@ def get_mathlib_info(*args):
771772
join('src', 'multiarray', 'new_iterator.c.src'),
772773
join('src', 'multiarray', 'lowlevel_strided_loops.c.src'),
773774
join('src', 'multiarray', 'dtype_transfer.c'),
774-
join('src', 'multiarray', 'new_iterator_pywrap.c')]
775+
join('src', 'multiarray', 'new_iterator_pywrap.c'),
776+
join('src', 'multiarray', 'einsum.c.src')]
775777

776778
if PYTHON_HAS_UNICODE_WIDE:
777779
multiarray_src.append(join('src', 'multiarray', 'ucsnarrow.c'))

numpy/core/src/multiarray/dtype_transfer.c

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
* This file contains low-level loops for data type transfers.
33
* In particular the function PyArray_GetDTypeTransferFunction is
44
* implemented here.
5+
*
6+
* Copyright (c) 2010 by Mark Wiebe ([email protected])
7+
* The Univerity of British Columbia
8+
*
9+
* See LICENSE.txt for the license.
10+
511
*/
612

713
#define PY_SSIZE_T_CLEAN

0 commit comments

Comments
 (0)