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

qammod — Map integer or bit symbols to QAM constellation points in MATLAB and RunMat.

qammod(X, M) maps integer symbols or bit groups X to complex QAM constellation points for modulation order M. Gray, binary, and custom symbol-ordering behavior follow MATLAB semantics.

Syntax

Y = qammod(X, M, symorder, Name, Value)

Inputs

NameTypeRequiredDefaultDescription
XNumericArrayYes—Integer symbols or grouped bit input.
MNumericScalarYes—Square modulation order greater than one.
argsAnyVariadic—Optional symbol order and name-value options.

Returns

NameTypeDescription
YNumericArrayComplex rectangular-QAM baseband samples.

Errors

IdentifierWhenMessage
—Symbols, modulation order, mapping, or options are invalid.qammod: invalid argument

How qammod works

  • X must contain finite integer values in the inclusive range [0, M-1].
  • InputType='bit' groups rows of X in log2(M) chunks per column/channel and maps each bit group to one symbol.
  • M must be a power-of-two integer greater than one.
  • Square QAM orders such as 4, 16, 64, and 256 use symmetric odd integer amplitudes with minimum distance two.
  • Non-square power-of-two orders use a rectangular grid with the larger dimension on the in-phase axis.
  • The default 'gray' order applies Gray coding independently to the in-phase and quadrature grid indexes.
  • 'UnitAveragePower', true scales the complete constellation so its average power is one.
  • 'OutputDataType', 'single' rounds the real and imaginary samples through single precision before returning the complex tensor or resident complex gpuArray output.
  • 'PlotConstellation', true is not implemented yet.

Does RunMat run qammod on the GPU?

RunMat represents complex GPU tensors as interleaved real/imaginary buffers with complex storage metadata, so downstream GPU-aware FFT and signal paths can consume the modulation output without a host result.

The provider hooks receive a validated constellation table and write the complex output on device. They read back only a compact validation state for MATLAB-compatible symbol or bit errors.

GPU memory and residency

The builtin declares NewHandle residency for gpuArray inputs. Integer-symbol and bit-input gpuArrays stay resident through provider-side constellation modulation when provider support is available.

Examples

Default 16-QAM Gray mapping

y = qammod(0:15, 16)

Expected output:

y = [-3+3i -3+1i -3-3i -3-1i -1+3i -1+1i -1-3i -1-1i 3+3i 3+1i 3-3i 3-1i 1+3i 1+1i 1-3i 1-1i]

Binary symbol ordering

y = qammod(0:4, 16, 'bin')

Expected output:

y = [-3+3i -3+1i -3-1i -3-3i -1+3i]

Unit-average-power 16-QAM

y = qammod(0:15, 16, 'UnitAveragePower', true);
mean(abs(y).^2)

Expected output:

ans = 1

Bit input for 16-QAM

bits = [0 1; 0 1; 0 1; 0 1];
y = qammod(bits, 16, 'InputType', 'bit')

Expected output:

y = [-3+3i 1-1i]

Using qammod with coding agents

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

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

FAQ

Does qammod execute on the GPU?⌄

Yes when the active provider implements the modulation hooks. It maps resident integer-symbol and bit-input gpuArrays directly to complex-interleaved gpuArray outputs.

Is bit input supported?⌄

Yes. InputType='bit' accepts numeric 0/1 or logical inputs and groups rows in log2(M) chunks for each column/channel.

Related Comms functions

Modulation

pskmod

Conversion

bi2de · bin2dec · de2bi · dec2bin · dec2hex · hex2dec

Open-source implementation

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

  • View the source for qammod 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 qammod works
  • Does RunMat run qammod on the GPU?
  • GPU memory and residency
  • Examples
  • Default 16-QAM Gray mapping
  • Binary symbol ordering
  • Unit-average-power 16-QAM
  • Bit input for 16-QAM
  • Using qammod with coding agents
  • FAQ
  • Related Comms functions
  • Modulation
  • Conversion
  • Open-source implementation
  • About RunMat