covartech / PRT

Pattern Recognition Toolbox for MATLAB
http://covartech.github.io/
MIT License
144 stars 70 forks source link

Change prtRvUniform to accept upper bound == lower bound #74

Closed peterTorrione closed 5 years ago

peterTorrione commented 5 years ago

Right now this causes an error:

>> r = prtRvUniform('lowerBounds',25,'upperBounds',25)
>> r.draw
Error using prtRvUniform/draw (line 118)
DRAW cannot yet be evaluated. This RV is not yet valid because at least one entry of lowerBounds is greater than the corresponding entry of upperBounds.

First - the error message is wrong. Should be "Greater than or equal to". But even so, I think this should work (even if the resulting uniform is improper, and can be well represented by a prtRvDiscrete). I think the change is on line 138:

badOrder = ~all(R.upperBounds>=R.lowerBounds);

Any objections?

patrickkwang commented 5 years ago

Seems reasonable to me.