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
    • all
    • any
    • bounds
    • cummax
    • cummin
    • cumprod
    • cumsum
    • cumtrapz
    • diff
    • gradient
    • max
    • maxk
    • mean
    • median
    • min
    • mink
    • movmax
    • movmean
    • movmedian
    • movmin
    • movprod
    • movstd
    • movsum
    • movvar
    • nnz
    • prod
    • rms
    • std
    • sum
    • trapz
    • var

std — Compute sample or population standard deviation.

std(A) measures spread along the first non-singleton dimension. Normalization, selected axes, and missing-value handling can be controlled separately.

Syntax

S = std(A)
S = std(A, w)
S = std(A, w, dim)
S = std(A, w, vecdim)
S = std(A, w, "all")
S = std(A, nanflag)
All supported std forms
S = std(A)
S = std(A, w)
S = std(A, w, dim)
S = std(A, w, vecdim)
S = std(A, w, "all")
S = std(A, nanflag)
S = std(A, w, nanflag)
S = std(A, w, dim, nanflag)
S = std(A, w, nanflag, dim)
S = std(A, w, [], nanflag)

Inputs

A
Type
Any
Required
Yes
Description
Single- or double-precision input array.
w
Type
Any
Required
No
Default
0
Description
Normalization flag or empty placeholder ([]).
axes
Type
Any
Required
No
Default
[]
Description
Dimension selector, vector of dimensions, or "all".
nanflag
Type
StringScalar
Required
No
Default
"includemissing"
Description
Missing-value mode: "includemissing"/"includenan" or "omitmissing"/"omitnan".
NameTypeRequiredDefaultDescription
AAnyYes—Single- or double-precision input array.
wAnyNo0Normalization flag or empty placeholder ([]).
axesAnyNo[]Dimension selector, vector of dimensions, or "all".
nanflagStringScalarNo"includemissing"Missing-value mode: "includemissing"/"includenan" or "omitmissing"/"omitnan".

Returns

S
Type
NumericArray
Description
Standard deviation reduction result.
NameTypeDescription
SNumericArrayStandard deviation reduction result.

Errors

RunMat:std:InvalidArgument
When
Argument grammar, dimensions, normalization, or missing-value selectors are invalid.
Message
std: invalid argument
RunMat:std:InvalidInput
When
Input values are outside the supported floating std reduction domains, including integer data.
Message
std: invalid input
RunMat:std:ComplexUnsupported
When
Input value is complex for a path that currently supports only real reductions.
Message
std: complex inputs are not supported yet
RunMat:std:Internal
When
Execution fails due to conversion, provider, upload, allocation, or fallback internals.
Message
std: internal reduction failure
IdentifierWhenMessage
RunMat:std:InvalidArgumentArgument grammar, dimensions, normalization, or missing-value selectors are invalid.std: invalid argument
RunMat:std:InvalidInputInput values are outside the supported floating std reduction domains, including integer data.std: invalid input
RunMat:std:ComplexUnsupportedInput value is complex for a path that currently supports only real reductions.std: complex inputs are not supported yet
RunMat:std:InternalExecution fails due to conversion, provider, upload, allocation, or fallback internals.std: internal reduction failure

Normalization and axes

std(A) uses the sample normalization: it divides the squared-deviation sum by n-1 when a slice has more than one observation. std(A,1) uses the population denominator n; std(A,0) and std(A,[]) select the sample form. A scalar observation returns zero.

std(A,flag,dim) chooses one axis; std(A,flag,vecdim) reduces several, and std(A,flag,'all') reduces all elements. For a non-scalar array, a selected dimension beyond the stored rank keeps the shape and produces zeros in the input class. Empty selected slices return NaN with the selected shape.

includenan is the default and propagates NaNs. omitnan ignores them, returning NaN when no observations remain. A vector in the normalization-flag position is not a supported weighted standard deviation and receives an error.

Supported classes

Real double and single inputs are admitted. Logical input is converted to numeric observations; integer and complex data are not currently admitted. Typed-integer normalization or dimension controls are a RunMat-only compatibility-mode extension, not integer data support.

The runtime does not currently admit native, double, default, or like as output-class controls for std. Real single reductions retain single output storage on host and admitted provider routes; double and logical inputs return double. Host reductions accumulate in double and round when constructing single output; CPU and GPU results can differ within floating-point precision.

GPU execution

Eligible resident real reductions use an owning provider's standard-deviation hooks. Unsupported axes, shapes, or missing-value modes can gather to the host. Standard deviation is a fusion boundary, not an elementwise fused operation. Automatic placement may choose a GPU; explicit gpuArray remains available.

Examples

Sample standard deviation

x = [1 2 3 4 5];
s = std(x)

Expected output:

s = 1.5811

Population standard deviations

A = [1 3 5; 2 4 6];
spop = std(A, 1)

Expected output:

spop = [0.5 0.5 0.5]

Reduce every dimension

B = reshape(1:12, [3 4]);
overall = std(B, 0, 'all')

Expected output:

overall = 3.6056

Reduce rows and pages

C = cat(3, [1 2; 3 4], [5 6; 7 8]);
sliceStd = std(C, [], [1 3])

Expected output:

sliceStd = [2.5820 2.5820]

Ignore NaNs

D = [1 NaN 3; 2 4 NaN];
rowStd = std(D, 0, 2, 'omitnan')

Expected output:

rowStd = [1.4142; 1.4142]

Standard deviation of a resident array

G = gpuArray([1 3; 5 7]);
spread = std(G, 0, 'all');
answer = gather(spread)

Expected output:

answer = 2.5820

Keep sample normalization with an empty flag

C = [1 2; 3 4];
rowStd = std(C, [], 2)

Expected output:

rowStd = [0.7071; 0.7071]

Using std with coding agents

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

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

FAQ

Which normalization flag should I use?⌄

Use 0 or [] for sample standard deviation, and 1 for population standard deviation. Weighted-vector flags are not implemented.

What does std compute by default?⌄

It uses the sample denominator n-1 for a slice with more than one observation.

How do I match a population standard deviation?⌄

Pass 1 as the normalization flag, including when selecting dim, vecdim, or all.

How can I collapse multiple dimensions?⌄

Pass a dimension vector such as std(A,[],[1 3]), or pass all after the normalization flag.

How are NaNs handled?⌄

The default includenan mode propagates NaNs. Omitnan excludes them and returns NaN when no observations remain.

What happens beyond ndims(A)?⌄

For a non-scalar array, std keeps the shape and returns zeros in the input class when the selected dimension is beyond the stored rank. This differs from reducing an existing axis.

Are complex or integer data supported?⌄

No. Real floating data and logical input are admitted; typed-integer controls are a separate RunMat-only extension.

Do native and like select output class?⌄

No. Those output-class options are not currently admitted by this builtin.

Does std run on a GPU?⌄

An eligible resident reduction uses the input's provider; other supported forms gather to the host and may restore residency.

Related Math functions

Reduction

all · any · bounds · cummax · cummin · cumprod · cumsum · cumtrapz · diff · gradient · max · maxk · mean · median · min · mink · movmax · movmean · movmedian · movmin · movprod · movstd · movsum · movvar · nnz · prod · rms · sum · trapz · var

Elementwise

abs · angle · besselj · bsxfun · complex · conj · double · eps · erf · erfcinv · exp · expm1 · flintmax · gamma · gammaln · heaviside · hypot · imag · int16 · int32 · int64 · int8 · intmax · intmin · ldivide · log · log10 · log1p · log2 · minus · nextpow2 · plus · pow2 · power · rdivide · real · realmax · realmin · realsqrt · rescale · sign · single · sqrt · times · typecast · uint16 · uint32 · uint64 · uint8

Optim

acceptancesa · annealingboltz · annealingfast · coneprog · crossoverarithmetic · crossoverheuristic · crossoverintermediate · crossoverlaplace · crossoverscattered · crossoversinglepoint · crossovertwopoint · eqnproblem · EquationProblem.solve · EquationProblem.subsasgn · EquationProblem.subsref · evaluate · fgoalattain · fitscalingprop · fitscalingrank · fitscalingshiftlinear · fitscalingtop · fminbnd · fmincon · fminimax · fminsearch · fminunc · fseminf · fsolve · fzero · ga · gacreationlinearfeasible · gacreationnonlinearfeasible · gacreationsobol · gacreationuniform · gacreationuniformint · gaplotbestf · gaplotbestindiv · gaplotdistance · gaplotexpectation · gaplotgenealogy · gaplotmaxconstr · gaplotrange · gaplotscorediversity · gaplotscores · gaplotselection · gaplotstopping · integerConstraint · integral · intlinprog · linprog · lsqcurvefit · lsqlin · LsqlinWarmStart.subsasgn · LsqlinWarmStart.subsref · lsqnonlin · lsqnonneg · mutationadaptfeasible · mutationgaussian · mutationpositivebasis · mutationpower · mutationuniform · optimexpr · optimget · OptimizationConstraint.evaluate · OptimizationConstraint.subsasgn · OptimizationConstraint.subsref · OptimizationExitflag.double · OptimizationExitflag.eq · OptimizationExitflag.ne · OptimizationExitflag.string · OptimizationExpression.acos · OptimizationExpression.acosh · OptimizationExpression.acot · OptimizationExpression.acoth · OptimizationExpression.acsc · OptimizationExpression.acsch · OptimizationExpression.asec · OptimizationExpression.asech · OptimizationExpression.asin · OptimizationExpression.asinh · OptimizationExpression.atan · OptimizationExpression.atanh · OptimizationExpression.cat · OptimizationExpression.cos · OptimizationExpression.cosh · OptimizationExpression.cot · OptimizationExpression.coth · OptimizationExpression.csc · OptimizationExpression.csch · OptimizationExpression.ctranspose · OptimizationExpression.cumprod · OptimizationExpression.cumsum · OptimizationExpression.diag · OptimizationExpression.diff · OptimizationExpression.dot · OptimizationExpression.eq · OptimizationExpression.evaluate · OptimizationExpression.exp · OptimizationExpression.ge · OptimizationExpression.horzcat · OptimizationExpression.ldivide · OptimizationExpression.le · OptimizationExpression.log · OptimizationExpression.mean · OptimizationExpression.minus · OptimizationExpression.mldivide · OptimizationExpression.mpower · OptimizationExpression.mrdivide · OptimizationExpression.mtimes · OptimizationExpression.norm · OptimizationExpression.plus · OptimizationExpression.power · OptimizationExpression.prod · OptimizationExpression.rdivide · OptimizationExpression.reshape · OptimizationExpression.sec · OptimizationExpression.sech · OptimizationExpression.sin · OptimizationExpression.sinh · OptimizationExpression.sqrt · OptimizationExpression.subsasgn · OptimizationExpression.subsref · OptimizationExpression.sum · OptimizationExpression.tan · OptimizationExpression.tanh · OptimizationExpression.times · OptimizationExpression.trace · OptimizationExpression.transpose · OptimizationExpression.uminus · OptimizationExpression.uplus · OptimizationExpression.vertcat · OptimizationExpression.zeros · OptimizationExpression.zerosLike · OptimizationProblem.solve · OptimizationProblem.subsasgn · OptimizationProblem.subsref · OptimizationVariable.subsasgn · OptimizationVariable.subsref · optimoptions · optimplotconstrviolation · optimplotfirstorderopt · optimplotfunccount · optimplotfval · optimplotfvalconstr · optimplotmilp · optimplotstepsize · optimplotx · optimproblem · optimset · optimvar · optimwarmstart · particleswarm · patternsearch · psplotbestf · psplotbestx · psplotfuncount · psplotmaxconstr · psplotmeshsize · pswcreationuniform · pswplotbestf · quad · quadprog · QuadprogWarmStart.subsasgn · QuadprogWarmStart.subsref · saplotbestf · saplotbestx · saplotf · saplotstopping · saplottemperature · saplotx · savemilpsolutions · secondordercone · selectionremainder · selectionroulette · selectionstochunif · selectiontournament · selectionuniform · simulannealbnd · solve · surrogateopt · surrogateoptplot · temperatureboltz · temperatureexp · temperaturefast

Trigonometry

acos · acosd · acosh · acotd · acscd · asecd · asin · asind · asinh · atan · atan2 · atan2d · atand · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh

Structure

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

Bitwise

bitand · bitcmp · bitget · bitor · bitset · bitshift · bitxor · swapbytes

Signal

blackman · butter · buttord · cheb2ord · conv · conv2 · deconv · downsample · envelope · filter · filtfilt · fir1 · freqz · gauspuls · hamming · hann · hilbert · periodogram · pulstran · pwelch · rectpuls · resample · sawtooth · sinc · spectrogram · square · tripuls · unwrap · upsample · zplane

Rounding

ceil · fix · floor · mod · rem · round

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

Ops

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

Symbolic

digits · int · limit · piecewise · sym · syms · vpa

Discrete

factor · factorial · gcd · isprime · lcm · primes

Fft

fft · fft2 · fftn · fftshift · ifft · ifft2 · ifftn · ifftshift

Interpolation

griddedInterpolant · griddedInterpolant.subsref · interp1 · interp1q · interp2 · pchip · ppval · spline

Integer Division

idivide

Ode

ode15s · ode23 · ode45 · odeset

Poly

poly · polyder · polyfit · polyint · polyval · roots

Source you can read

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

  • View the source for std 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
  • Normalization and axes
  • Supported classes
  • GPU execution
  • Examples
  • Sample standard deviation
  • Population standard deviations
  • Reduce every dimension
  • Reduce rows and pages
  • Ignore NaNs
  • Standard deviation of a resident array
  • Keep sample normalization with an empty flag
  • Using std with coding agents
  • FAQ
  • Related Math functions
  • Reduction
  • Elementwise
  • Optim
  • Trigonometry
  • Structure
  • Bitwise
  • Signal
  • Rounding
  • Factor
  • Solve
  • Ops
  • Symbolic
  • Discrete
  • Fft
  • Interpolation
  • Integer Division
  • Ode
  • Poly
  • Source you can read
  • About RunMat