deconv — Compute one-dimensional deconvolution in MATLAB and RunMat.
deconv(b,a) performs one-dimensional polynomial long division in descending coefficient order. It returns quotient q and optionally remainder r. Real and complex single/double coefficients are supported; RunMat mode also admits logical coefficients and integers that are exactly representable as double.
Syntax
Q = deconv(numerator, denominator)
[Q, R] = deconv(numerator, denominator)Inputs
numerator- Type
Any- Required
- Yes
- Description
- Numerator coefficients.
denominator- Type
Any- Required
- Yes
- Description
- Denominator coefficients.
Returns
Q- Type
NumericArray- Description
- Quotient polynomial coefficients.
R- Type
NumericArray- Description
- Remainder polynomial coefficients.
Returned values from deconv depend on how many outputs the caller requests.
Errors
RunMat:deconv:InvalidInput- When
- An operand cannot be converted to polynomial coefficients.
- Message
deconv: unsupported input type
RunMat:deconv:VectorRequired- When
- An input is not a scalar, row, or column vector.
- Message
deconv: inputs must be scalars, row vectors, or column vectors
RunMat:deconv:DenominatorInvalid- When
- The denominator is empty or contains only exact zeros.
- Message
deconv: denominator is invalid
Polynomial division
Inputs are scalars, rows, or columns; genuine matrices and N-D arrays are rejected. Only exact zero coefficients count as leading zeros. The remainder keeps the numerator's full length and orientation, making aligned reconstruction with conv(a,q)+r straightforward.
If the numerator degree is lower than the denominator degree, q is zero and r equals the numerator. Empty or all-zero denominators are invalid. The supported public form is classic vector polynomial division; newer shape, least-squares Method, and RegularizationFactor forms remain unsupported.
Classes and execution
Single coefficients select single output when every coefficient input is floating-point. A logical or typed-integer input selects double on both host and resident paths. Explicit complex coefficient input remains complex.
Integer and logical inputs are RunMat extensions, rejected in MATLAB compatibility mode before data access. Each integer coefficient is checked for exact binary64 representation before division; inexact wide integer values are rejected.
Resident input coefficients gather through their owning provider for host long division. Only requested output values are restored, and each restored handle must preserve the numerical class, complexity, shape, device, and owner. There is no native polynomial-division provider hook or fusion path at present.
Examples
Recover a polynomial factor
p = conv([1 2], [1 -3 2]); % Multiply two polynomials
[q, r] = deconv(p, [1 2]) % Divide by the first factorExpected output:
q = [1 -3 2];
r = [0 0 0 0]Find a nonzero remainder
[q, r] = deconv([1 4 7], [1 2])Expected output:
q = [1 2];
r = [0 0 3]Divide by a longer sequence
[q, r] = deconv([3 5], [1 0 2])Expected output:
q = 0;
r = [3 5]Retain leading zero coefficients
b = [0 0 1 2];
a = [0 1 1];
[q, r] = deconv(b, a)Expected output:
q = [1];
r = [0 0 0 1]Divide complex polynomials
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 = [0 0 -10.5-5i]Divide resident coefficient arrays
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 hostUsing 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 if the denominator is empty or all zero?⌄
deconv raises an error; the denominator must contain a nonzero coefficient.
Can I pass logical or integer vectors?⌄
Yes, in RunMat mode only. Logical values and exactly binary64-representable integers select double output; MATLAB compatibility mode rejects these extensions before data access.
Why does the remainder contain leading zeros?⌄
It keeps the full numerator length so aligned polynomial reconstruction remains unambiguous.
Does deconv support column vectors?⌄
Yes. The numerator determines the orientation of quotient and remainder.
How do I reconstruct the numerator?⌄
Use conv(a,q)+r with coefficient alignment (shorter vectors padded on the left).
Does deconv perform FFT deconvolution?⌄
No. It performs polynomial long division; FFT-based deconvolution can be assembled with fft, division, and ifft.
What about ill-conditioned coefficients?⌄
Long division can amplify rounding error. Scale coefficients or use a higher-precision method when the polynomial is ill-conditioned.
Can I request both outputs?⌄
Yes. [q,r] = deconv(b,a) returns both; a single-output call returns only 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 · 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
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
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
Ops
cross · ctranspose · dot · mldivide · mpower · mrdivide · mtimes · pagemtimes · pagetranspose · trace · transpose
Interpolation
griddedInterpolant · griddedInterpolant.subsref · interp1 · interp1q · interp2 · pchip · ppval · spline
Integer Division
Source you can read
Every RunMat function's source is public. 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 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.