Inner product
An inner product is a scalar-valued operation on two vectors that combines their corresponding components, summing their products and, for complex vectors, using conjugation.
AI-Powered Search
A dot product is the sum of pairwise products of corresponding components of two vectors.
- How it is used
- Scores query–document matches, dense-embedding similarity, and predicted user–item preferences from paired feature vectors.
- How deep it goes
- Works through term-count scores and unit normalization, then implements embedding comparisons; uses pretrained encodings rather than constructing an encoder.
- Examples
- Compares “apple juice” term-count vectors and scores pairwise sentence embeddings.
- What you can do after
- Apply it via Python dot(...) for keyword ranking or sentence_transformers.util.dot_score for normalized embedding comparisons.
Geometry for Programmers
The dot product is a scalar product of two vectors formed by summing the products of corresponding coordinates.
- How it is used
- Uses directional alignment for projections, surface shading, smooth arc-line joins, and point-to-segment projection.
- How deep it goes
- Defines coordinate and N-dimensional forms, derives projection and angle meaning, and implements SymPy and 2D uses without deriving broader vector-product theory.
- Examples
- Demonstrates coordinate multiplication, SymPy vectors, sphere shading, arc-line smoothness, and projection onto 2D segments.
- What you can do after
- Apply it via SymPy or a 2D helper to compute alignment, lighting coefficients, orthogonality constraints, and segment projections.
Math and Architectures of Deep Learning
A scalar computed from two vectors by multiplying corresponding components and summing them, used here to measure one vector's projection along another.
- How it is used
- Expresses weighted sums compactly for linear models, document similarity, and neural-network layers.
- How deep it goes
- Defines componentwise computation, develops projection and orthogonality intuition, then connects it to matrix operations and PyTorch.
- Examples
- Uses cat-brain weighted sums, document word vectors, physical push and displacement, and PyTorch vector tensors.
- What you can do after
- Apply it via PyTorch to compute vector products and interpret zero, positive, and negative results geometrically.
Read how Math and Architectures of Deep Learning explains inner product →
Classic Computer Science Problems in Swift: Essential techniques for practicing programmers
A dot product is the scalar obtained by multiplying corresponding components of two equal-length vectors and summing the products.
- How it is used
- Combines neuron inputs with weights during feed-forward computation and next-layer weights with deltas during backpropagation.
- How deep it goes
- Shows a Swift implementation and two network call sites, but does not develop the underlying vector mathematics or derive training formulas.
- Examples
- Uses an Accelerate-backed `dotProduct` helper, a neuron's `output(inputs:)`, and a hidden layer's delta calculation.
- What you can do after
- Apply it via Accelerate's `vDSP_dotprD` to implement neuron outputs and hidden-layer delta calculations.
Natural Language Processing in Action, Second Edition
A dot product is the scalar obtained by multiplying corresponding components of two equal-length vectors and summing the products.
- How it is used
- Scores vector comparisons in text search and local pattern matches in text convolution.
- How deep it goes
- Works through pairwise multiplication, summation, cosine normalization, and Python implementations, then benchmarks repeated calculations.
- Examples
- Calculates a three-component vector product, compares sentence-vector search timings, and scores sliding text windows.
- What you can do after
- Apply it via NumPy to calculate vector scores and use their normalized form for cosine similarity.
Read how Natural Language Processing in Action, Second Edition explains inner product →
Statistics Every Programmer Needs
A dot product is an algebraic operation that multiplies corresponding elements of two equal-length sequences and sums the products.
- How it is used
- Uses vector–matrix multiplication to forecast future state distributions in Markov analysis.
- How deep it goes
- Defines the operation, explains its Markov interpretation, and demonstrates repeated and direct two-period calculations.
- Examples
- Demonstrates cellular-market share forecasts across periods using NumPy vectors and transition matrices.
- What you can do after
- Apply it via NumPy to calculate and iterate Markov state-distribution forecasts.
Read how Statistics Every Programmer Needs explains inner product →
Build a Robo-Advisor with Python (From Scratch)
The dot product is an operation that sums the pairwise products of corresponding components of two vectors to produce a scalar.
- How it is used
- Computes weighted portfolio returns and expected values for allocation choices in goals-based dynamic programming.
- How deep it goes
- Defines the vector operation and implements it with NumPy, stopping short of broader matrix-multiplication details.
- Examples
- Uses FE, WMT, and AAPL weights for portfolio return, then evaluates wealth-state transitions against future values.
- What you can do after
- Apply it via NumPy to calculate portfolio returns and expected values for discrete allocation decisions.
Read how Build a Robo-Advisor with Python (From Scratch) explains inner product →
Grokking AI Algorithms, Second Edition
A dot product is an operation on two equal-length vectors that multiplies corresponding components and sums the resulting products.
- How it is used
- Replaces repeated weighted-sum loops and scores alignment in neurons, self-attention, and convolutional filters.
- How deep it goes
- Defines pairwise multiplication and summation, then works through attention and convolution examples without formal proofs.
- Examples
- Uses neuron inputs and weights, Query-Key token scores, and a 3×3-style filter scanning image pixels.
- What you can do after
- Apply it to calculate weighted sums, attention relevance scores, and convolution responses by hand.
Read how Grokking AI Algorithms, Second Edition explains inner product →
Deep Learning with Python, Third Edition
An inner-product operation used as a similarity score between vectors.
- How it is used
- Uses vector products as similarity scores in attention and as the basic operation underlying matrix multiplication.
- How deep it goes
- Explains vector, matrix-vector, matrix, and higher-dimensional products with shape rules, but avoids deeper mathematical derivation.
- Examples
- Demonstrates NumPy matmul, Python's @ operator, naive products, einsum attention, and parameterized query-key-value projections.
- What you can do after
- Apply it via NumPy, Keras operations, Python's @ operator, or einsum-based attention implementations.
Read how Deep Learning with Python, Third Edition explains inner product →
Advanced Algorithms and Data Structures
The dot product is a scalar operation on vectors equal to the sum of the products of corresponding coordinates and related to their angle.
- How it is used
- Uses dot products to eliminate parameters while testing whether two planar line segments intersect.
- How deep it goes
- Develops perpendicular-vector construction, algebraic elimination, implementation, and endpoint handling without general inner-product theory.
- Examples
- Uses vectors between segment endpoints, a quarter-turned vector, scaling factors, and shared-endpoint cases.
- What you can do after
- Apply vector arithmetic to compute segment parameters and diagnose whether two segments intersect.
Read how Advanced Algorithms and Data Structures explains inner product →
Knowledge Graphs and LLMs in Action
A dot product is the scalar obtained by multiplying corresponding components of two equal-length vectors and summing the results.
- How it is used
- Scores candidate user–movie links after heterogeneous graph encoding.
- How deep it goes
- Defines the scoring role and shows its classifier call, but does not derive the arithmetic or explain optimization internals.
- Examples
- Uses user–movie ratings, genre features, and a PyTorch DotProduct classifier in an encoder–decoder implementation.
- What you can do after
- Apply it via a DotProduct classifier to score candidate links between learned user and movie embeddings.
Read how Knowledge Graphs and LLMs in Action explains inner product →
Deep Learning with JAX
A linear algebra operation that multiplies corresponding elements of two arrays and sums the products.
- How it is used
- Uses dot products for single-vector calculations and as the shape-sensitive core of batched neural-network predictions.
- How deep it goes
- Defines the operation, demonstrates jnp.vdot, and diagnoses a batch-shape failure without deriving contraction internals.
- Examples
- Uses two three-element vectors, random arrays of vectors, and a batch of 32 flattened 28×28 images.
- What you can do after
- Apply it via JAX's jnp.vdot, recognize incompatible batch shapes, and prepare single-item functions for vmap.
Related concepts
- attentionused by · Attention is a neural-network mechanism that computes input-dependent weights to combine information according to its relevance to a computation.
- scalarkind of · A scalar is a single, indivisible value rather than a collection or multidimensional structure; in mathematics, it is a quantity with magnitude and no direction.
- embeddinguses · A numerical vector representation of an item or input that encodes features or relationships useful for computational tasks.
- cosine similarityused by · Cosine similarity measures the directional alignment of two nonzero vectors as the cosine of the angle between them, equivalently their dot product divided by the product of their magnitudes.
- matrix-matrix multiplicationused by · Matrix multiplication combines compatible matrices to form a result whose entries are sums of products between rows of the first matrix and columns of the second.
- attention scoreproduces · An attention score is a numerical compatibility or relevance value computed between elements, such as a query and key, before normalization into attention weights.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.











