17 template <
class T,
class I>
23 if(!a_v)
return false;
25 for(I i=0;i<a_n;i++) a_v[i] = a_from[i];
29 template <
class T,
class I>
30 inline bool copy(T*& a_v,I a_n,
const T* a_from) {
return carray_copy<T,I>(a_v,a_n,a_from);}
71 template <
class I,
class T,
class TO>
72 inline bool min_max(I a_n,
const void* a_v,TO& a_mn,TO& a_mx){
73 if(a_n<=I(0)) {a_mn = TO(0);a_mx = TO(0);
return false;}
77 for(I i=0;i<a_n;i++,pos++) {
78 a_mn = mn<TO>(a_mn,*pos);
79 a_mx = mx<TO>(a_mx,*pos);
84 template <
class I,
class T,
class TO>
85 inline bool min_max_S_S2(I a_n,
const void* a_v,TO& a_mn,TO& a_mx,TO& a_S,TO& a_S2){
86 if(a_n<=0) {a_mn = TO(0);a_mx = TO(0);a_S=TO(0);a_S2=TO(0);
return false;}
92 for(I i=0;i<a_n;i++,pos++) {
93 a_mn = mn<TO>(a_mn,*pos);
94 a_mx = mx<TO>(a_mx,*pos);
96 a_S2 += TO(*pos) * TO(*pos);
101 template <
class I,
class T,
class TO>
103 TO(*a_sqrt)(TO),TO(*a_fabs)(TO)){
106 if(!min_max_S_S2<I,T,TO>(a_n,a_v,a_mn,a_mx,S,S2)) {
107 a_mn = TO(0);a_mx = TO(0);a_mean=TO(0);a_rms=TO(0);
111 a_rms = a_sqrt(a_fabs(S2/TO(a_n) - a_mean * a_mean));
115 template <
class I,
class T,
class HISTO>
116 inline bool h1_fill(I a_n,
const void* a_v,HISTO& a_histo) {
118 if(a_n<=0)
return false;
119 typedef typename HISTO::coordinate_t TC;
121 for(I i=0;i<a_n;i++,pos++) a_histo.fill(TC(*pos));
125 template <
class T,
class I>
126 inline T*
_4s_to_3s(
const T* a_4s,
const I& a_w,
const I& a_h) {
127 T* _3s =
new T[a_w*a_h*3];
132 for(I i=0;i<_sz;i+=4) {
133 *(
pto+0) = *(pfrom+0);
134 *(
pto+1) = *(pfrom+1);
135 *(
pto+2) = *(pfrom+2);