template<unsigned int buckets, typename type>
Computes distribution of an array. Returns min, max & bucket size in first three items.
Definition at line 1837 of file FXMaths.h. References max(), mean(), and min(). 01838 { 01839 Vector<type, buckets+3> ret; 01840 const type &_min=(min && max) ? *min : ret[0], &_max=(min && max) ? *max : ret[1]; 01841 type &div=ret[2]; 01842 if(!min || !max) 01843 mean(array, len, stride, &ret[0], &ret[1]); 01844 div=(_max-_min)/buckets; 01845 for(FXuval n=0; n<len; n+=stride) 01846 { 01847 for(FXuval bucket=0; bucket<buckets; bucket++) 01848 { 01849 if(array[n]>=_min+div*bucket && array[n]<_min+div*(bucket+1)) 01850 ++ret[3+bucket]; 01851 } 01852 } 01853 return ret; 01854 }
|