Commit e4f9071c authored by Carsten Gräser's avatar Carsten Gräser

[bugfix] Evaluate Newton-polynomias as raw field

If domain and range are FV<k,1,1> and the derivative is FM<k,1,1>
the other code fails because these do not interact like scalars
would do. Maybe this should be fixed in dune-common. However,
since the class only implements univariate polynomials we can
simply evaluate the Newton-polynomial using the raw field
type and cast to the derivative type later on.
parent 08c8e3c6
Pipeline #28156 passed with stage
in 48 minutes and 1 second
......@@ -81,11 +81,14 @@ class Polynomial:
*/
virtual void evaluateDerivative(const DomainType& x, DerivativeType& d) const
{
d = 0.0;
// Compute result as field, because FM<K,1,1> and FV<k,1,1>
// d not interact nicely and we're having univariate polynomials
// anyway.
using Field = typename Dune::FieldTraits<DerivativeType>::field_type;
Field y = 0.0;
for (int k=degree_; k>=1; --k)
d = x*d + dCoeff(1,k)*coeffs_[k];
y = x*y + dCoeff(1,k)*coeffs_[k];
d = y;
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment