Changeset 4879:3d39c745c8f7 in roaraudio
- Timestamp:
- 04/26/11 14:36:32 (12 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroardsp/poly.h
r4708 r4879 51 51 float roar_math_cvpoly_4x4 (float * poly, float t); 52 52 53 int roar_math_diffpoly(float * poly, int len); 54 int roar_math_intpoly(float * poly, int len, float c); 55 56 float roar_math_numintpoly(float * poly, int len, float st, float et); 57 53 58 #endif 54 59 -
libroardsp/poly.c
r4708 r4879 141 141 } 142 142 143 int roar_math_diffpoly(float * poly, int len) { 144 int i; 145 146 for (i = 1; i < len; i++) { 147 poly[i-1] = poly[i]*(i+1); 148 } 149 150 poly[len-1] = 0; 151 152 return 0; 153 } 154 155 int roar_math_intpoly(float * poly, int len, float c) { 156 int i; 157 158 for (i = len - 1; i > 0; i--) { 159 poly[i] = poly[i-1]/i; 160 } 161 162 poly[0] = c; 163 164 return 0; 165 } 166 167 float roar_math_numintpoly(float * poly, int len, float st, float et) { 168 float ipoly[8]; 169 float upper, lower; 170 171 if (len > 8) { 172 roar_err_set(ROAR_ERROR_RANGE); 173 return -1.; 174 } 175 176 memcpy(ipoly, poly, sizeof(float)*len); 177 roar_math_intpoly(ipoly, len, 0); 178 179 lower = roar_math_cvpoly(ipoly, st, len+1); 180 upper = roar_math_cvpoly(ipoly, et, len+1); 181 182 //printf("lower(%f)=%f, upper(%f)=%f\n", st, lower, et, upper); 183 184 return upper-lower; 185 } 186 143 187 //ll
Note: See TracChangeset
for help on using the changeset viewer.