Inner

Inner[f,list1,list2,g]

is a generalization of Dot in which f plays the role of multiplication and g of addition.

Details

  • Inner[f,{{a,b},{c,d}},{x,y},g]->{g[f[a,x],f[b,y]],g[f[c,x],f[d,y]]}.
  • Like Dot, Inner effectively contracts the last index of the first tensor with the first index of the second tensor. Applying Inner to a rank r tensor and a rank s tensor gives a rank tensor.
  • Inner[f,list1,list2] uses Plus for g.
  • Inner[f,list1,list2,g,n] contracts index n of the first tensor with the first index of the second tensor.
  • The heads of list1 and list2 must be the same, but need not necessarily be List. »

Examples

open allclose all

Basic Examples  (3)

Compute the "inner f" of two lists, with "plus operation" g:

Compute a generalized inner product of a matrix and a vector:

Use familiar operations:

Scope  (4)

Generalized inner product of two matrices:

Inner product of a matrix with a vector:

Inner product of a vector with a matrix:

Hermitian inner product of two vectors:

Check this is the same as using Dot and conjugating the second vector:

Generalizations & Extensions  (2)

Contract over the first index of the first matrix:

Inner works with heads other than List:

Applications  (4)

Boolean (inner) product:

Block matrix (inner) product:

The divergence of a vector field is an inner differentiation:

Applying the functions in a list to corresponding arguments:

Properties & Relations  (2)

This gives the scalar product of two vectors:

This does the same thing:

Combining the products with List gives the same result as MapThread:

Wolfram Research (1988), Inner, Wolfram Language function, https://reference.wolfram.com/language/ref/Inner.html.

Text

Wolfram Research (1988), Inner, Wolfram Language function, https://reference.wolfram.com/language/ref/Inner.html.

BibTeX

@misc{reference.wolfram_2020_inner, author="Wolfram Research", title="{Inner}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Inner.html}", note=[Accessed: 21-January-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_inner, organization={Wolfram Research}, title={Inner}, year={1988}, url={https://reference.wolfram.com/language/ref/Inner.html}, note=[Accessed: 21-January-2021 ]}

CMS

Wolfram Language. 1988. "Inner." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Inner.html.

APA

Wolfram Language. (1988). Inner. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Inner.html