RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
See all docs
Builtin Reference
    • cross
    • ctranspose
    • dot
    • mldivide
    • mpower
    • mrdivide
    • mtimes
    • pagemtimes
    • pagetranspose
    • trace
    • transpose

dot — Compute dot products in MATLAB and RunMat.

dot(A, B) evaluates inner products between matching slices of A and B, optionally along a selected dimension. Complex inputs use conjugate-on-first-argument semantics consistent with MATLAB and RunMat.

Syntax

C = dot(A, B)
C = dot(A, B, dim)

Inputs

A
Type
Any
Required
Yes
Description
Left operand.
B
Type
Any
Required
Yes
Description
Right operand.
dim
Type
NumericScalar
Required
Yes
Description
Reduction dimension.
NameTypeRequiredDefaultDescription
AAnyYes—Left operand.
BAnyYes—Right operand.
dimNumericScalarYes—Reduction dimension.

Returns

C
Type
NumericArray
Description
Dot product result.
NameTypeDescription
CNumericArrayDot product result.

Errors

RunMat:dot:InvalidArgument
When
Argument count or dimension argument is invalid.
Message
dot: invalid argument
RunMat:dot:InvalidInput
When
Inputs are unsupported or incompatible.
Message
dot: A and B must be the same size.
RunMat:dot:Internal
When
Runtime cannot materialize dot outputs.
Message
dot: internal runtime failure
IdentifierWhenMessage
RunMat:dot:InvalidArgumentArgument count or dimension argument is invalid.dot: invalid argument
RunMat:dot:InvalidInputInputs are unsupported or incompatible.dot: A and B must be the same size.
RunMat:dot:InternalRuntime cannot materialize dot outputs.dot: internal runtime failure

Behavior and supported arrays

dot(A, B) evaluates inner products between matching slices of A and B, optionally along a selected dimension. Complex inputs use conjugate-on-first-argument semantics consistent with MATLAB and RunMat.

Vectors need the same number of elements and may use different row/column orientations. Matrices and N-D arrays must have identical sizes.

When no dimension is supplied, the function reduces along the first non-singleton dimension (dim = 1 when all dimensions are singleton).

dot(A, B, dim) collapses dimension dim (1-based) while leaving every other dimension untouched.

Complex inputs conjugate the first argument before multiplication; real inputs use a straight element-wise product.

Single inputs produce single results, including on the host/fallback path; otherwise the floating result is double.

Empty reductions yield zeros of the appropriate shape; length mismatches raise A and B must be the same size.

Public MATLAB data inputs are single or double. RunMat additionally accepts logical and all eight typed-integer classes only in RunMat extension mode.

When both extension operands are typed integers, each product is formed from authoritative integer storage before crossing to the floating reduction/output domain, avoiding pre-product loss above flintmax.

Typed-integer dim is a documented control input, is available in compatibility modes, and is decoded exactly in every supported integer class.

GPU residency and provider behavior

Same-owner, same-device real floating inputs can use the owning provider's native dot hook. Other supported resident forms gather through the originating owner and restore real results there when its precision can represent the output. Complex outputs remain host-side until provider complex dot support is available.

Native dispatch never sends integer or logical storage to a floating dot hook. It requires proven common ownership/device and accepts a fresh result only after owner, device, shape, real noninteger storage, and operand-requested precision validation. A malformed native result is rejected without replay; only a typed unsupported-hook result permits host fallback. Global-provider fallback for an unknown device is not accepted as ownership. Outputs that alias either input or the fallback residency anchor are rejected and never freed as provider-owned results. Other rejected allocations are freed only through a proven actual owner. Fallback gathers through each handle owner and restores real output to the first resident owner only after applying the same owner, device, shape, storage, class-metadata, freshness, and requested-precision checks.

The provider-side hook is limited to proven-same-owner, same-device real floating inputs. Integer/logical extensions gather through the owning provider and bypass floating-native hooks; operational provider failures and malformed native outputs remain terminal.

Examples

Computing the dot product of row vectors

A = [1 2 3];
B = [4 5 6];
val = dot(A, B)

Expected output:

val = 32

Dotting column vectors to obtain a scalar

u = [1; 3; 5];
v = [2; 4; 6];
val = dot(u, v)

Expected output:

val = 44

Applying dot along a chosen dimension

X = [1 2 3; 4 5 6];
Y = [6 5 4; 3 2 1];
cols = dot(X, Y, 1)  % collapse rows
rows = dot(X, Y, 2)  % collapse columns

Expected output:

cols = [18 20 18];
rows = [28; 28]

Dotting complex vectors uses conjugation on the first input

a = [1+2i, 3-4i];
b = [2-3i, -1+5i];
val = dot(a, b)

Expected output:

val = -27 + 4i

Evaluating dot on gpuArray inputs

G1 = gpuArray([1 2 3 4]);
G2 = gpuArray([4 3 2 1]);
G = dot(G1, G2);
result = gather(G)

Expected output:

result = 20

Using dot with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how dot changes the result.

Run a small dot example, explain the result, then change one input and compare the output.

FAQ

Does dot require vectors?⌄

No. Any pair of tensors with identical sizes works; specifying a dimension lets you dot slices of higher-dimensional arrays.

How does the optional dimension behave?⌄

dot(A, B, dim) collapses the dimth dimension (1-based). Dimensions greater than the array rank have length 1 and therefore leave the data unchanged.

What happens with complex numbers?⌄

The first input is conjugated before multiplication so the result matches MATLAB's hermitian inner product.

Are empty inputs supported?⌄

Yes. If the reduction dimension has length 0 the result is filled with zeros of the appropriate shape.

Will the result stay on the GPU?⌄

When a provider is active the runtime uploads real-valued results back to the device. Complex outputs stay on the host until GPU complex support is available.

What error is raised for size mismatches?⌄

When A and B differ in size dot raises: A and B must be the same size. matching MATLAB's wording.

Does dot accept logical or integer inputs?⌄

Only as explicit RunMat extensions. Current public MATLAB documentation lists single and double data inputs. RunMat mode accepts logical and all eight integer classes; compatibility modes reject those data forms. Typed-integer dim remains documented and available.

Can I request conjugation of the second argument instead?⌄

No. MATLAB's dot is fixed to conjugate the first argument. Use sum(A .* conj(B)) manually if you need the opposite orientation.

Related Linalg functions

Ops

cross · ctranspose · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose

Structure

bandwidth · isdiag · ishermitian · issymmetric · istril · istriu · symrcm

Factor

chol · decomposition · decomposition.ctranspose · decomposition.mldivide · decomposition.mrdivide · decomposition.mtimes · decomposition.rdivide · decomposition.subsref · decomposition.times · decomposition.uminus · decomposition.uplus · eig · eigs · gmres · ichol · ilu · lu · ordeig · ordqz · ordschur · pcg · qr · qz · rsf2csf · schur · svd

Solve

cond · det · inv · linsolve · norm · null · pinv · rank · rcond · rref · vecnorm

Source you can read

Every RunMat function's source is public. Read exactly how dot is executed, line by line, in Rust.

  • View the source for dot in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is a runtime that executes MATLAB-syntax code fast on any GPU. The runtime is free for individuals, including freelancers; students and faculty at an academic institution, for teaching or research there; contributors to an open-source project, for work on that project; organizations with 250 or fewer people and US$10M or less in annual revenue; and anyone, for non-production use. See runmat.com/license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • Behavior and supported arrays
  • GPU residency and provider behavior
  • Examples
  • Computing the dot product of row vectors
  • Dotting column vectors to obtain a scalar
  • Applying dot along a chosen dimension
  • Dotting complex vectors uses conjugation on the first input
  • Evaluating dot on gpuArray inputs
  • Using dot with coding agents
  • FAQ
  • Related Linalg functions
  • Ops
  • Structure
  • Factor
  • Solve
  • Source you can read
  • About RunMat