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
    • 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

inf — Create arrays filled with IEEE positive infinity values using MATLAB-compatible size, class, and like forms.

inf(...) creates positive-infinity-filled arrays across scalar, vector, matrix, and N-D size signatures, with MATLAB-compatible class and 'like' option behavior.

Syntax

A = inf()
A = inf(n)
A = inf(size_vector)
A = inf(m, n, ...)
A = inf(..., typename)
A = inf(..., "like", prototype)

Inputs

NameTypeRequiredDefaultDescription
nSizeArgYes—Square size.
size_vectorSizeArgYes—Size vector defining output dimensions.
dimsSizeArgVariadic—Dimension sizes.
typenameStringScalarNo"double"Class name override (double|single|gpuArray).
like_kwStringScalarYes"like"Like keyword.
prototypeLikePrototypeYes—Prototype array used for class/device.

Returns

NameTypeDescription
ANumericArrayInf-filled output array.

Errors

IdentifierWhenMessage
—The 'like' keyword is provided without a prototype argument.inf: expected prototype after 'like'
—A class keyword and a 'like' prototype are both provided.inf: cannot combine 'like' with other class specifiers
—A trailing option string is not a supported class keyword.inf: unrecognised option
—The 'like' keyword is specified more than once.inf: multiple 'like' specifications are not supported
—The 'like' prototype has an integer data type that cannot represent Inf.inf: integer 'like' prototypes are not supported

How inf works

  • inf() returns the scalar Inf.
  • inf(n) returns an n x n double array filled with Inf.
  • inf(m, n, ...) returns a dense double array with the requested dimensions.
  • inf(sz) accepts a size vector and returns an array with prod(sz) Inf elements.
  • inf(A) returns an Inf array with the same size as A.
  • inf(___, 'single') returns a single-precision numeric array.
  • inf(___, 'like', prototype) matches numeric precision and device residency for supported prototype arrays.

Does RunMat run inf on the GPU?

Provider-backed inf construction uses constant-fill hooks, so fully resident GPU pipelines can create Inf arrays without first materializing a host tensor when provider support is available.

GPU memory and residency

When a GPU prototype is supplied, RunMat preserves residency by allocating the output through the active acceleration provider. If the provider cannot fill on device, RunMat falls back to a host Inf tensor and uploads it.

Examples

Creating a 2x3 matrix of Inf values

A = inf(2, 3)

Expected output:

A = [Inf Inf Inf; Inf Inf Inf]

Creating a single-precision Inf array

A = inf(4, 1, 'single')

Expected output:

A = [Inf; Inf; Inf; Inf]

Creating a GPU-resident Inf array like a prototype

G = gpuArray(rand(2,2));
A = inf(2, 2, 'like', G)

Expected output:

A = [Inf Inf; Inf Inf]

Using inf with coding agents

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

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

FAQ

How is inf different from Inf?⌄

Both bare identifiers resolve to the scalar IEEE positive-infinity constant. The callable form inf(...) constructs Inf-filled arrays.

Does inf(n) create a row vector?⌄

No. MATLAB compatibility requires inf(n) to create an n x n matrix. Use inf(1, n) or inf(n, 1) for vectors.

Can inf create GPU arrays?⌄

Yes. With a GPU prototype, inf(..., 'like', G) asks the active acceleration provider to allocate an Inf-filled GPU tensor.

Related Array functions

Creation

colon · createArray · empty · eye · false · full · 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 inf is executed, line by line, in Rust.

  • View the source for inf 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 inf works
  • Does RunMat run inf on the GPU?
  • GPU memory and residency
  • Examples
  • Creating a 2x3 matrix of Inf values
  • Creating a single-precision Inf array
  • Creating a GPU-resident Inf array like a prototype
  • Using inf with coding agents
  • FAQ
  • Related Array functions
  • Creation
  • Grouping
  • Sorting Sets
  • Shape
  • Indexing
  • Introspection
  • Open-source implementation
  • About RunMat