nums.numpy.inner

nums.numpy.inner(a, b)[source]

Inner product of two arrays.

This docstring was copied from numpy.inner.

Some inconsistencies with the NumS version may exist.

Ordinary inner product of vectors for 1-D arrays (without complex conjugation), in higher dimensions a sum product over the last axes.

Parameters
  • a (BlockArray) – If a and b are nonscalar, their last dimensions must match.

  • b (BlockArray) – If a and b are nonscalar, their last dimensions must match.

Returns

outout.shape = a.shape[:-1] + b.shape[:-1]

Return type

BlockArray

Raises

ValueError – If the last dimension of a and b has different size.

See also

tensordot

Sum products over arbitrary axes.

dot

Generalised matrix product, using second last dimension of b.

Notes

Only single-axis inputs supported.

Examples

The doctests shown below are copied from NumPy. They won’t show the correct result until you operate get().

Ordinary inner product for vectors:

>>> a = nps.array([1,2,3])  
>>> b = nps.array([0,1,0])  
>>> nps.inner(a, b).get() 
array(2)