RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

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.

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

pagemtimes — Multiply corresponding matrix pages in dense arrays.

pagemtimes(X,Y) multiplies each corresponding two-dimensional matrix page of X and Y. Dimensions three and higher are page dimensions and use MATLAB-compatible singleton expansion.

Syntax

Z = pagemtimes(X, Y)
Z = pagemtimes(X, transpX, Y, transpY)

Inputs

NameTypeRequiredDefaultDescription
XNumericArrayYes—Left dense single, double, or complex array.
YNumericArrayYes—Right dense single, double, or complex array.
transpXStringScalarYes—`none`, `transpose`, or `ctranspose` for X.
transpYStringScalarYes—`none`, `transpose`, or `ctranspose` for Y.

Returns

NameTypeDescription
ZNumericArrayPage-wise matrix product.

Errors

IdentifierWhenMessage
RunMat:pagemtimes:InvalidArityThe call does not use the two-argument or four-argument form.pagemtimes: expected X,Y or X,transpX,Y,transpY
RunMat:pagemtimes:InvalidInputInputs are not dense single, double, or complex arrays.pagemtimes: inputs must be dense single, double, or complex arrays
RunMat:pagemtimes:InvalidTransposeTranspose flags are not one of none, transpose, or ctranspose.pagemtimes: transpose options must be 'none', 'transpose', or 'ctranspose'
RunMat:pagemtimes:PageDimensionMismatchTrailing page dimensions cannot be implicitly expanded.pagemtimes: page dimensions are not compatible
RunMat:pagemtimes:MatrixDimensionMismatchMatrix dimensions are not valid for page-wise multiplication.pagemtimes: inner matrix dimensions must agree
RunMat:pagemtimes:InternalErrorRuntime cannot materialize the page-wise result.pagemtimes: internal runtime failure

How pagemtimes works

  • Supports Z = pagemtimes(X,Y) and Z = pagemtimes(X,transpX,Y,transpY).
  • transpX and transpY must both be present in the four-argument form and each must be none, transpose, or ctranspose.
  • The first two dimensions of each input form the matrix multiplied on each page. Page dimensions are dimensions three and higher and are expanded by position when one side has extent 1 or omits the trailing dimension.
  • If either operand is scalar, the result uses the first two dimensions of the nonscalar operand and performs page-wise scalar multiplication.
  • Dense double, single, and complex double arrays are supported. MATLAB-compatible modes reject integer, logical, sparse, cell, struct, object, and text inputs.
  • RunMat mode additionally accepts real arrays in all eight integer classes when every value is exactly representable as binary64. This named extension returns double and rejects wider values instead of rounding them; resident integer inputs use an exact owner-aware gather and restore path rather than a floating provider kernel.
  • Complex ctranspose conjugates each page before multiplication; transpose only swaps the first two dimensions.

Does RunMat run pagemtimes on the GPU?

pagemtimes exposes a custom GPU spec and keeps outputs resident when any input is a gpuArray and an acceleration provider is available.

Plain page-wise products may be accelerated by provider pagefun hooks in future backends; transpose and scalar forms currently use the host-complete fallback path.

GPU memory and residency

Yes for explicit gpuArray inputs. RunMat gathers when needed for host-complete semantics, then re-uploads real and complex numeric results to the active acceleration provider.

Examples

Multiply matching pages

X = reshape(1:8, [2 2 2]);
Y = reshape(10:17, [2 2 2]);
Z = pagemtimes(X,Y)

Broadcast a matrix across all pages

X = eye(2);
Y = reshape(1:8, [2 2 2]);
Z = pagemtimes(X,Y)

Use transpose options

X = rand(2,3,5);
Y = rand(2,4,5);
Z = pagemtimes(X,'transpose',Y,'none');
size(Z)

Expected output:

ans =
     3     4     5

Implicit expansion of page dimensions

X = rand(10,8,1,3);
Y = rand(8,10,4,1);
Z = pagemtimes(X,Y);
size(Z)

Expected output:

ans =
    10    10     4     3

GPU inputs remain device-resident

G = gpuArray(rand(3,3,8));
H = pagemtimes(G,2);
firstPage = gather(H(:,:,1));

Using pagemtimes with coding agents

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

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

FAQ

How does pagemtimes differ from mtimes?⌄

mtimes multiplies two matrices. pagemtimes treats every slice in dimensions three and higher as an independent matrix and multiplies corresponding pages with singleton expansion across page dimensions.

Can I specify only one transpose option?⌄

No. MATLAB's four-argument form requires both transpX and transpY; use none for the operand that should not be transposed.

What happens when page dimensions do not match?⌄

RunMat raises RunMat:pagemtimes:PageDimensionMismatch unless the differing page extent is 1 or omitted on one side.

Related Linalg functions

Ops

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

Structure

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

Factor

chol · decomposition · eig · eigs · lu · qr · svd

Solve

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

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how pagemtimes is executed, line by line, in Rust.

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 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
  • How pagemtimes works
  • Does RunMat run pagemtimes on the GPU?
  • GPU memory and residency
  • Examples
  • Multiply matching pages
  • Broadcast a matrix across all pages
  • Use transpose options
  • Implicit expansion of page dimensions
  • GPU inputs remain device-resident
  • Using pagemtimes with coding agents
  • FAQ
  • Related Linalg functions
  • Ops
  • Structure
  • Factor
  • Solve
  • Open-source implementation
  • About RunMat