Inner
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 all close allBasic Examples (3)
Compute the "inner f" of two lists, with "plus operation" g:
Inner[f, {a, b}, {x, y}, g]Compute a generalized inner product of a matrix and a vector:
Inner[f, {{a, b}, {c, d}}, {x, y}, g]Inner[Times, {a, b}, {x, y}, Plus]Inner[Power, {a, b, c}, {x, y, z}, Times]Scope (4)
Generalized inner product of two matrices:
Inner[f, {{a, b}, {c, d}}, {{u, v}, {w, x}}, g]Inner product of a matrix with a vector:
Inner[f, {{a, b}, {c, d}}, {s, t}, g]Inner product of a vector with a matrix:
Inner[f, {x, y}, {{a, b}, {c, d}}, g]Hermitian inner product of two vectors:
a = {1 + I, 3 - I, -5 + 7I};
b = {-2, -3 - I, 6I};Inner[#1Conjugate[#2]&, a, b]Check this is the same as using Dot and conjugating the second vector:
a.Conjugate[b]Generalizations & Extensions (2)
Applications (4)
BooleanDot[a_, b_] := Inner[And, a, b, Or]BooleanDot[(| | |
| ----- | ----- |
| a1, 1 | a1, 2 |
| a2, 1 | a2, 2 |), (| | |
| ----- | ----- |
| b1, 1 | b1, 2 |
| b2, 1 | b2, 2 |)]//MatrixForm//TraditionalFormBlockDot[a_, b_] := Inner[Dot, a, b, Plus]BlockDot[(| | |
| ----- | ----- |
| a1, 1 | a1, 2 |
| a2, 1 | a2, 2 |), (| | |
| ----- | ----- |
| b1, 1 | b1, 2 |
| b2, 1 | b2, 2 |)]//MatrixForm//TraditionalFormThe divergence of a vector field is an inner differentiation:
div[vec_, vars_] := Inner[D, vec, vars, Plus]div[{-x / (x ^ 2 + y ^ 2), -y / (x ^ 2 + y ^ 2)}, {x, y}]Applying the functions in a list to corresponding arguments:
Inner[#1[#2]&, {f, g, h}, {a, b, c}, List]Properties & Relations (2)
This gives the scalar product of two vectors:
Dot[{Subscript[a, 1], Subscript[a, 2], Subscript[a, 3]}, {Subscript[b, 1], Subscript[b, 2], Subscript[b, 3]}]Inner[Times, {Subscript[a, 1], Subscript[a, 2], Subscript[a, 3]}, {Subscript[b, 1], Subscript[b, 2], Subscript[b, 3]}, Plus]Combining the products with List gives the same result as MapThread:
Inner[f, {a, b, c}, {x, y, z}, List]MapThread[f, {{a, b, c}, {x, y, z}}]Tech Notes
Related Guides
Related Links
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), Inner, Wolfram Language function, https://reference.wolfram.com/language/ref/Inner.html.
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
BibTeX
@misc{reference.wolfram_2026_inner, author="Wolfram Research", title="{Inner}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Inner.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_inner, organization={Wolfram Research}, title={Inner}, year={1988}, url={https://reference.wolfram.com/language/ref/Inner.html}, note=[Accessed: 12-June-2026]}