oph_quantize

Description

Behaviour

It quantizes an array according to a binary list of quantization level and a binary list of quantization values (expressed as doubles).

Let the quantization levels be l1,l2,...,lk and the quantization values v1,v2,...,vs. Let measures be m1,m2,...,mq. The implemented function operates in this way:

for m in {m1,...,mq}

if m <= l1 then m = v1

if l1 < m <= l2 then m = v2

...

if lk-1 < m <= lk then m = vs-1

if m > lk then m = vs

So it has to be s=k+1.

Parameters

  • input measure type: Ophidia typing. Supported types are: ‘oph_double’; ‘oph_float’; ‘oph_long’; ‘oph_int’; ‘oph_short’; ‘oph_byte’.
  • output measure type: Ophidia typing. Supported types are: ‘oph_double’; ‘oph_float’; ‘oph_long’; ‘oph_int’; ‘oph_short’; ‘oph_byte’.
  • measure: input measure.
  • binary quantization levels: binary array of doubles representing quantization levels.
  • binary quantization values: binary array of doubles representing quantization values.

Return type

Binary-array.

Examples

Assign 0 to all elements <= 5, 1 to all elements > 10 and 0.5 to all the others.

oph_quantize('OPH_DOUBLE','OPH_DOUBLE',measure,oph_to_bin('','OPH_DOUBLE','5,10'),oph_to_bin('','OPH_DOUBLE','0,0.5,1'))

Operation type

Simple.

Arguments

Argument name Type Mandatory Values Default Min/Max-value Min/Max-times
input measure type “oph_type” “yes” “‘oph_double’|’oph_float’|’oph_int’|’oph_long’|’oph_short’|’oph_byte’”     “1” / “1”
output measure type “oph_type” “yes” “‘oph_double’|’oph_float’|’oph_int’|’oph_long’|’oph_short’|’oph_byte’”     “1” / “1”
measure “binary-array” “yes”       “1” / “1”
binary quantization levels “binary-array” “yes”       “1” / “1”
binary quantization values “binary-array” “yes”       “1” / “1”