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

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact
  • License
  • Privacy

Learn

  • Docs
  • Blog
  • Benchmarks
  • RunMat vs MATLAB Online

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.

/
See all docs
Builtin Reference
    • colon
    • createArray
    • empty
    • eye
    • false
    • full
    • inf
    • linspace
    • logspace
    • magic
    • meshgrid
    • nan
    • nchoosek
    • ndgrid
    • nonzeros
    • ones
    • peaks
    • perms
    • rand
    • randi
    • randn
    • randperm
    • range
    • sparse
    • spdiags
    • speye
    • spones
    • sprand
    • true
    • zeros

empty — Create an empty array of a specified class.

ClassName.empty creates a 0-by-0 empty array of the receiver class. Size arguments can specify other empty shapes, but at least one normalized dimension must be zero.

Syntax

A = ClassName.empty
A = ClassName.empty(sz1, ..., szN)
A = ClassName.empty(sizeVector)

Inputs

NameTypeRequiredDefaultDescription
dimensionsSizeArgVariadic—Integer scalar dimensions; at least one dimension must be zero.
sizeVectorSizeArgYes—Row vector of integer dimensions; at least one dimension must be zero.

Returns

NameTypeDescription
AAnyEmpty array preserving the receiver class.

Errors

IdentifierWhenMessage
RunMat:empty:InvalidSizeSize arguments are not integer-valued numeric scalars or one row size vector.empty: invalid size arguments
RunMat:empty:NonEmptyShapeEvery normalized dimension is nonzero.empty: at least one dimension must be zero
RunMat:empty:UnsupportedClassThe selected shorthand class cannot be represented as a shaped empty value.empty: unsupported output class
RunMat:empty:InternalThe empty value cannot be assembled.empty: internal error

How empty works

  • RunMat registers class-qualified forms for int8.empty, int16.empty, int32.empty, int64.empty, uint8.empty, uint16.empty, uint32.empty, and uint64.empty.
  • All eight integer classes are accepted for scalar dimension controls and row size vectors. Values are decoded from authoritative integer storage without conversion through double.
  • Signed negative dimensions become zero. Nonnegative dimensions must be integer-valued and within the platform size range.
  • A single scalar dimension requests a square shape. A size-vector argument must be a row vector; column vectors reject.
  • Trailing singleton dimensions after dimension two are removed. At least one remaining dimension must be zero.
  • Integer outputs contain exact empty IntegerStorage of the receiver class.
  • The global empty(...) shorthand and its trailing typename selector are RunMat-only extensions. MATLAB-compatible mode requires class-qualified syntax.
  • The former global "like" shorthand is not retained because it did not inherit output class and is not part of the documented class-static surface.
  • User-defined and general object-class empty arrays require broader class-array storage and static-method dispatch support.

GPU memory and residency

Integer class-static forms construct host empty storage. Resident numeric size controls are accepted only in RunMat mode and reject before provider access when extensions are disabled.

Examples

Create an empty unsigned integer array

A = uint8.empty

Expected output:

`A` is a 0-by-0 uint8 array with authoritative uint8 storage.

Create an empty integer array with a nonzero second dimension

A = int16.empty(int64(0), uint64(5))

Expected output:

`A` is a 0-by-5 int16 array.

Use a row size vector

A = uint64.empty(uint32([0 0 6]))

Expected output:

`A` is a 0-by-0-by-6 uint64 array.

Using empty with coding agents

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

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

FAQ

Does the class come from a size argument?⌄

No. In MATLAB-compatible syntax the receiver in ClassName.empty determines the output class. Integer size arguments are structural controls only.

Are wide uint64 dimensions converted through double?⌄

No. Host integer controls are decoded exactly from integer storage and checked against the platform size range.

Can empty create a nonempty array?⌄

No. After signed-negative clamping and trailing-singleton normalization, at least one dimension must be zero.

Can I call empty as a global function?⌄

Only in RunMat mode. The global shorthand is explicitly compatibility-gated; portable MATLAB-compatible code uses ClassName.empty.

Related Array functions

Creation

colon · createArray · eye · false · full · inf · linspace · logspace · magic · meshgrid · nan · nchoosek · ndgrid · nonzeros · ones · peaks · perms · rand · randi · randn · randperm · range · sparse · spdiags · speye · spones · sprand · true · zeros

Grouping

accumarray · combinations · discretize · findgroups · groupcounts · grp2idx · splitapply

Sorting Sets

argsort · intersect · ismember · ismembertol · issorted · issortedrows · setdiff · setxor · sort · sortrows · union · unique

Shape

blkdiag · cat · circshift · diag · flip · fliplr · flipud · horzcat · ipermute · kron · permute · repelem · repmat · reshape · rot90 · squeeze · toeplitz · tril · triu · vertcat

Indexing

find · ind2sub · sub2ind

Introspection

iscolumn · isempty · ismatrix · isrow · isscalar · isvector · length · ndims · numel · size

Open-source implementation

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

  • View the source for empty 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 empty works
  • GPU memory and residency
  • Examples
  • Create an empty unsigned integer array
  • Create an empty integer array with a nonzero second dimension
  • Use a row size vector
  • Using empty with coding agents
  • FAQ
  • Related Array functions
  • Creation
  • Grouping
  • Sorting Sets
  • Shape
  • Indexing
  • Introspection
  • Open-source implementation
  • About RunMat