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

deconv — Compute one-dimensional deconvolution in MATLAB and RunMat.

deconv(b, a) performs one-dimensional polynomial long division and returns quotient q plus remainder r. Coefficients use MATLAB/RunMat polynomial ordering (highest-order term first), with support for real and complex inputs.

Syntax

Q = deconv(numerator, denominator)
[Q, R] = deconv(numerator, denominator)

Inputs

NameTypeRequiredDefaultDescription
numeratorAnyYes—Numerator coefficients.
denominatorAnyYes—Denominator coefficients.

Returns

NameTypeDescription
QNumericArrayQuotient polynomial coefficients.
RNumericArrayRemainder polynomial coefficients.

Returned values from deconv depend on how many outputs the caller requests.

Errors

IdentifierWhenMessage
RunMat:deconv:InvalidInputNumerator/denominator input value is not supported for polynomial conversion.deconv: unsupported input type
RunMat:deconv:VectorRequiredInput is not scalar/row/column vector.deconv: inputs must be scalars, row vectors, or column vectors
RunMat:deconv:DenominatorInvalidDenominator is empty or contains only exact zero coefficients.deconv: denominator is invalid
RunMat:deconv:GatherFailedGPU input cannot be gathered for host fallback normalization.deconv: failed to gather GPU input
RunMat:deconv:BuildComplexOutputComplex output tensor allocation fails.deconv: failed to build complex tensor
RunMat:deconv:BuildOutputReal output tensor allocation fails.deconv: failed to build tensor
RunMat:deconv:TooManyOutputsMore than two outputs are requested.deconv: too many output arguments

How deconv works

  • Inputs must be scalars, row vectors, or column vectors. Multi-dimensional tensors are rejected.
  • Only exact zero coefficients are treated as leading zeros. The remainder retains the numerator's full length and orientation so conv(a, q) + r reconstructs the numerator with ordinary aligned polynomial addition.
  • When length(b) < length(a), the quotient is zero and the remainder equals b.
  • MATLAB documents single and double coefficients. RunMat extension mode additionally accepts logical coefficients and integer coefficients that are exactly representable as double; inexact wide integers are rejected.
  • Single and complex-single coefficients preserve single output precision when every coefficient input is floating-point. Any logical or typed-integer coefficient selects double output precision, independent of whether inputs are host values or resident gpuArrays; complex coefficients preserve complex output storage.
  • Empty denominators and all-zero denominators raise MATLAB-compatible errors.
  • This implementation currently covers classic vector polynomial division. The newer shape, least-squares Method, and RegularizationFactor forms remain an explicit compatibility gap.

Does RunMat run deconv on the GPU?

When either input is resident, RunMat gathers it through its registered owner and performs polynomial division on the CPU. Two resident inputs must already share an owner and device. Results return to that owner/device only when it can physically supply the computed precision, and restored handles are accepted only when their owner, device, shape, storage, and precision match the computed result.

Examples

Recovering a factor from a polynomial product

p = conv([1 2], [1 -3 2]);   % Multiply two polynomials
[q, r] = deconv(p, [1 2])   % Divide by the first factor

Expected output:

q = [1 -3 2];
r = [0 0 0 0]

Obtaining a non-zero remainder

[q, r] = deconv([1 4 7], [1 2])

Expected output:

q = [1 2];
r = [0 0 3]

Dividing by a longer sequence

[q, r] = deconv([3 5], [1 0 2])

Expected output:

q = 0;
r = [3 5]

Handling leading zeros explicitly

b = [0 0 1 2];
a = [0 1 1];
[q, r] = deconv(b, a)

Expected output:

q = [1];
r = [0 0 0 1]

Complex polynomial division

b = [1+2i 3-4i 2];
a = [1-i 2+i];
[q, r] = deconv(b, a)

Expected output:

q = [-0.5+1.5i 6-0.5i];
r = [-10.5-5i]

GPU inputs with automatic host fallback

b = gpuArray([1 3 3 1]);
a = gpuArray([1 1]);
[q, r] = deconv(b, a); % Quotient stays on the GPU when possible
r = gather(r);         % Explicitly gather the remainder if needed on the host

Using deconv with coding agents

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

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

FAQ

What happens if the denominator is empty or entirely zero?⌄

An error is raised. MATLAB requires a non-empty, non-zero denominator polynomial.

Can I pass logical or integer vectors?⌄

They are RunMat-only extensions, not MATLAB-compatible input forms. Extension mode accepts logical coefficients and exactly-double-representable integer coefficients; strict compatibility mode rejects them before data access. If either coefficient input is logical or typed integer, quotient and remainder use double precision on both host and resident execution paths.

Why does the remainder contain leading zeros?⌄

The remainder has the numerator's full length. This preserves the documented coefficient identity and makes reconstruction with conv(a, q) + r unambiguous.

Does deconv support column vectors?⌄

Absolutely. The orientation of the numerator (b) determines the orientation of both the quotient and remainder.

How should I reconstruct the original polynomial?⌄

conv(a, q) + r (using MATLAB’s polynomial addition rules, which pad shorter vectors on the left) recreates the original numerator.

Are FFT-based deconvolutions supported?⌄

deconv implements exact polynomial long division. For FFT-based signal deconvolution, combine fft, elementwise division, and ifft manually.

What about numerical stability?⌄

deconv mirrors MATLAB’s long-division semantics. For ill-conditioned problems, consider scaling the coefficients or using higher precision (e.g., symbolic toolboxes) just as you would in MATLAB.

Can I request both outputs in one statement?⌄

Yes. [q, r] = deconv(b, a) returns both quotient and remainder; requesting only one output returns the quotient.

Related Math functions

Signal

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

Elementwise

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

Trigonometry

acos · acosh · asin · asinh · atan · atan2 · atanh · cos · cosd · cosh · cospi · deg2rad · pol2cart · rad2deg · sin · sind · sinh · sinpi · tan · tand · tanh

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 · std · sum · trapz · var

Structure

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

Rounding

ceil · fix · floor · mod · rem · round

Factor

chol · decomposition · eig · eigs · lu · qr · svd

Solve

cond · det · inv · linsolve · norm · null · pinv · rank · rcond · rref · vecnorm

Optim

coneprog · fminbnd · fminunc · fsolve · fzero · integral · linprog · lsqcurvefit · lsqnonlin · optimoptions · optimset · quad · secondordercone

Ops

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

Symbolic

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

Fft

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

Interpolation

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

Discrete

lcm · primes

Ode

ode15s · ode23 · ode45

Poly

polyder · polyfit · polyint · polyval · roots

Open-source implementation

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

  • View the source for deconv 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 deconv works
  • Does RunMat run deconv on the GPU?
  • Examples
  • Recovering a factor from a polynomial product
  • Obtaining a non-zero remainder
  • Dividing by a longer sequence
  • Handling leading zeros explicitly
  • Complex polynomial division
  • GPU inputs with automatic host fallback
  • Using deconv with coding agents
  • FAQ
  • Related Math functions
  • Signal
  • Elementwise
  • Trigonometry
  • Reduction
  • Structure
  • Rounding
  • Factor
  • Solve
  • Optim
  • Ops
  • Symbolic
  • Fft
  • Interpolation
  • Discrete
  • Ode
  • Poly
  • Open-source implementation
  • About RunMat