value to evaluate InvCDF
slice containing the probability associated with the Categorical Distribution
import mir.ndslice.slice: sliced; import mir.test: should; static immutable x = [0.1, 0.5, 0.4]; auto p = x.sliced; categoricalInvCDF(0.0, p).should == 0; categoricalInvCDF(0.1, p).should == 0; categoricalInvCDF(0.2, p).should == 1; categoricalInvCDF(0.3, p).should == 1; categoricalInvCDF(0.4, p).should == 1; categoricalInvCDF(0.5, p).should == 1; categoricalInvCDF(0.6, p).should == 1; categoricalInvCDF(0.7, p).should == 2; categoricalInvCDF(0.8, p).should == 2; categoricalInvCDF(0.9, p).should == 2; categoricalInvCDF(1.0, p).should == 2;
Can also use dynamic array
import mir.test: should; double[] p = [0.1, 0.5, 0.4]; categoricalInvCDF(0.5, p).should == 1;
Computes the Categorical inverse cumulative distribution function (InvCDF).