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.2, Nov 26, 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

transpose — Transpose arrays by swapping the first two dimensions without complex conjugation.

B = transpose(A) swaps the rows and columns of a vector or matrix without conjugating complex values. It is equivalent to MATLAB A.' and preserves the input class.

Syntax

B = transpose(A)

Inputs

A
Type
Any
Required
Yes
Description
Input scalar/array value.
NameTypeRequiredDefaultDescription
AAnyYes—Input scalar/array value.

Returns

B
Type
Any
Description
Input value with first two dimensions swapped.
NameTypeDescription
BAnyInput value with first two dimensions swapped.

Errors

RunMat:transpose:InvalidArgument
When
Call does not provide exactly one input argument.
Message
transpose: invalid argument
RunMat:transpose:InvalidInput
When
Input type is unsupported for transpose or the input has a nonsingleton dimension above two.
Message
transpose: unsupported input type
RunMat:transpose:Internal
When
Runtime cannot materialize transpose output.
Message
transpose: internal runtime failure
IdentifierWhenMessage
RunMat:transpose:InvalidArgumentCall does not provide exactly one input argument.transpose: invalid argument
RunMat:transpose:InvalidInputInput type is unsupported for transpose or the input has a nonsingleton dimension above two.transpose: unsupported input type
RunMat:transpose:InternalRuntime cannot materialize transpose output.transpose: internal runtime failure

Behavior and supported arrays

B = transpose(A) swaps the rows and columns of a vector or matrix without conjugating complex values. It is equivalent to MATLAB A.' and preserves the input class.

Works for scalars, vectors, and matrices. Use permute to reorder N-D arrays.

All eight integer classes preserve exact values and class across dense, sparse, empty, and supported gpuArray inputs.

Complex values are not conjugated. Use ctranspose/A' for conjugate transpose.

Logical, string, character, and cell arrays preserve their types and metadata.

Vectors become column or row matrices as needed (e.g., size(transpose(1:3)) == [3 1]).

Empty and singleton dimensions follow MATLAB's column-major semantics.

GPU residency and provider behavior

No additional residency management is required. If the planner keeps your data on the GPU, transpose will honour that residency and either invoke a provider kernel or, in the worst case, perform a gather/transpose/upload round-trip automatically.

When a gpuArray is provided, RunMat first asks the active Accel provider for a dedicated transpose kernel. The WGPU backend ships such a kernel today; other providers may supply their own implementation. If the hook is missing, RunMat gathers the data to the host, performs the transpose once, and re-uploads it so downstream GPU work continues without residency churn.

Prefers the provider transpose hook; falls back to gather→transpose→upload when unavailable.

Examples

Transposing a numeric matrix to swap rows and columns

A = [1 2 3; 4 5 6];
B = transpose(A)

Expected output:

B =
     1     4
     2     5
     3     6

Turning a row vector into a column vector

row = 1:4;
col = transpose(row);
size(col)

Expected output:

ans = [4 1]

Preserving imaginary parts when transposing complex matrices

Z = [1+2i 3-4i];
ZT = transpose(Z)

Expected output:

ZT =
     1.0000 + 2.0000i
     3.0000 - 4.0000i

Transposing logical masks while keeping logical type

mask = logical([1 0 1; 0 1 0]);
maskT = transpose(mask);
class(maskT)

Expected output:

ans = 'logical'

Transposing character arrays to flip rows and columns of text

C = ['r' 'u' 'n'; 'm' 'a' 't'];
CT = transpose(C)

Expected output:

CT =
    'rm'
    'ua'
    'nt'

Transposing gpuArray data without leaving the device

G = gpuArray(rand(1024, 32));
GT = transpose(G);
isgpuarray(GT)

Expected output:

ans = logical 1

Using transpose with coding agents

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

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

FAQ

Does transpose conjugate complex numbers?⌄

No. Use ctranspose or the ' operator for conjugate transpose.

What happens for tensors with more than two dimensions?⌄

The public transpose contract is for vectors and matrices. Use permute(A, [2 1 3 ...]) for N-D arrays.

Do empty matrices stay empty after transposition?⌄

Yes. MATLAB's empty-dimension rules are preserved exactly.

Is the result a copy or a view?⌄

It is a new array. Neither the input nor the output share storage.

Can I transpose cell arrays?⌄

Yes—RunMat mirrors MATLAB by rearranging each cell handle into the new layout.

Are logical arrays still logical after transpose?⌄

Absolutely. The data stay in compact logical storage.

How does transpose interact with the fusion planner?⌄

Fusion treats transposes as pipeline boundaries, so kernels before and after the transpose can still fuse independently.

What if my provider lacks a transpose kernel?⌄

RunMat transparently gathers, transposes on the host, and re-uploads while logging a warning.

Does transpose change sparse matrices?⌄

Sparse matrices are supported and retain their sparse storage and numeric class.

Can I compose transpose with permute?⌄

Yes—transpose is equivalent to permute(A, [2 1 3 ...]).

Related Linalg functions

Ops

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

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 transpose is executed, line by line, in Rust.

  • View the source for transpose 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
  • Transposing a numeric matrix to swap rows and columns
  • Turning a row vector into a column vector
  • Preserving imaginary parts when transposing complex matrices
  • Transposing logical masks while keeping logical type
  • Transposing character arrays to flip rows and columns of text
  • Transposing gpuArray data without leaving the device
  • Using transpose with coding agents
  • FAQ
  • Related Linalg functions
  • Ops
  • Structure
  • Factor
  • Solve
  • Source you can read
  • About RunMat