MCPcopy Create free account
hub / github.com/dask/dask / dotmany

Function dotmany

dask/array/core.py:350–369  ·  view source on GitHub ↗

Dot product of many aligned chunks >>> x = np.array([[1, 2], [1, 2]]) >>> y = np.array([[10, 20], [10, 20]]) >>> dotmany([x, x, x], [y, y, y]) array([[ 90, 180], [ 90, 180]]) Optionally pass in functions to apply to the left and right chunks >>> dotmany([x, x, x

(A, B, leftfunc=None, rightfunc=None, **kwargs)

Source from the content-addressed store, hash-verified

348
349
350def dotmany(A, B, leftfunc=None, rightfunc=None, **kwargs):
351 """Dot product of many aligned chunks
352
353 >>> x = np.array([[1, 2], [1, 2]])
354 >>> y = np.array([[10, 20], [10, 20]])
355 >>> dotmany([x, x, x], [y, y, y])
356 array([[ 90, 180],
357 [ 90, 180]])
358
359 Optionally pass in functions to apply to the left and right chunks
360
361 >>> dotmany([x, x, x], [y, y, y], rightfunc=np.transpose)
362 array([[150, 150],
363 [150, 150]])
364 """
365 if leftfunc:
366 A = map(leftfunc, A)
367 if rightfunc:
368 B = map(rightfunc, B)
369 return sum(map(partial(np.dot, **kwargs), A, B))
370
371
372def _concatenate2(arrays, axes=None):

Callers

nothing calls this directly

Calls 1

sumFunction · 0.90

Tested by

no test coverage detected