udecode
Convert quantized integer matrix elements to floating-point values.
Syntax
u = udecode(q, n)
u = udecode(q, n, v)
u = udecode(q, n, v, mode)
Inputs
- q
- The matrix to decode.
- n
- The quantization exponent, specifying 2^n levels.
- v
- The upper limit of the interval to quantize, [-v,v). Values outside of this range are restricted to the nearest allowed value.
- mode
- A flag to specify whether the overflow inputs saturate to the interval bounds or wrap around.
Outputs
- u
- The converted floating-point value for each element. The level values are the left endpoints of the intervals.
Example
Unsigned example:
x = [-64,-49,-25,-16,-9,9,16,25,49,64];
q = udecode(x,6,60)
q = [Matrix] 1 x 10
0 5 18 23 27 36 40 45 58 63
Signed example:
x = [-64,-49,-25,-16,-9,9,16,25,49,64];
q = uencode(x,6,60,'signed');
y = udecode(q,6,60)
y = [Matrix] 1 x 10
-60.00000 -50.62500 -26.25000 -16.87500 -9.37500 7.50000 15.00000 24.37500 48.75000 58.12500
Comments
If all(u) > 0 then the floating-point output is assumed to be nonnegative also.