43 for(
int i=d; i>=0; --i)
46 for(
int i=d; i>=0; --i)
57 for (
int i=1; i<this->coeff_size(); i++)
58 this->coeff_[i] =
T(0.);
79 int d = this->degree();
84 this->coeff_.resize(xd+1);
97 for(
int i=d; i>=0; --i)
100 for(
int i=d; i>=0; --i)
101 this->coeff_[i] = x.
coeff(i);
106 template <
typename T>
110 this->coeff_[0] += v;
115 template <
typename T>
119 this->coeff_[0] -= v;
124 template <
typename T>
133 template <
typename T>
142 template <
typename T>
143 template <
typename S>
148 int d = this->degree();
152 this->resizeCoeffs(xd);
158 if (x.hasFastAccess(d))
159 for (
int i=d; i>=0; --i)
160 this->coeff_[i] += x.fastAccessCoeff(i);
162 for (
int i=xd; i>=0; --i)
163 this->coeff_[i] += x.coeff(i);
168 template <
typename T>
169 template <
typename S>
174 int d = this->degree();
178 this->resizeCoeffs(xd);
184 if (x.hasFastAccess(d))
185 for (
int i=d; i>=0; --i)
186 this->coeff_[i] -= x.fastAccessCoeff(i);
188 for (
int i=xd; i>=0; --i)
189 this->coeff_[i] -= x.coeff(i);
194 template <
typename T>
195 template <
typename S>
200 int d = this->degree();
205 this->resizeCoeffs(xd);
209 x.allocateCache(dfinal);
214 if (x.hasFastAccess(dfinal))
215 for(
int i=dfinal; i>=0; --i) {
217 for (
int k=0; k<=i; ++k)
218 tmp += this->coeff_[k]*x.fastAccessCoeff(i-k);
219 this->coeff_[i] = tmp;
222 for(
int i=dfinal; i>=0; --i) {
224 for (
int k=0; k<=i; ++k)
225 tmp += this->coeff_[k]*x.coeff(i-k);
226 this->coeff_[i] = tmp;
230 if (x.hasFastAccess(dfinal))
231 for(
int i=dfinal; i>=0; --i)
232 this->coeff_[i] = this->coeff_[0] * x.fastAccessCoeff(i);
234 for(
int i=dfinal; i>=0; --i)
235 this->coeff_[i] = this->coeff_[0] * x.coeff(i);
239 this->coeff_ *= x.coeff(0);
244 template <
typename T>
245 template <
typename S>
250 int d = this->degree();
255 this->resizeCoeffs(xd);
259 x.allocateCache(dfinal);
262 std::valarray<T> tmp(this->coeff_);
263 if (x.hasFastAccess(dfinal))
264 for(
int i=0; i<=dfinal; i++) {
265 for (
int k=1; k<=i; k++)
266 tmp[i] -= x.fastAccessCoeff(k)*tmp[i-k];
267 tmp[i] /= x.fastAccessCoeff(0);
270 for(
int i=0; i<=dfinal; i++) {
271 for (
int k=1; k<=i; k++)
272 tmp[i] -= x.coeff(k)*tmp[i-k];
273 tmp[i] /= x.coeff(0);
278 this->coeff_ /= x.coeff(0);