mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-02 12:36:54 -06:00
Merge remote-tracking branch 'bska/master'
This commit is contained in:
commit
0bf693e8c0
32
AutoDiff.hpp
32
AutoDiff.hpp
@ -58,74 +58,58 @@ namespace AutoDiff {
|
|||||||
return Forward(x, dx);
|
return Forward(x, dx);
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator +=(const Scalar& rhs)
|
operator +=(const Scalar& rhs)
|
||||||
{
|
{
|
||||||
val_ += rhs;
|
val_ += rhs;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator +=(const Forward& rhs)
|
operator +=(const Forward& rhs)
|
||||||
{
|
{
|
||||||
val_ += rhs.val_;
|
val_ += rhs.val_;
|
||||||
der_ += rhs.der_;
|
der_ += rhs.der_;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator -=(const Scalar& rhs)
|
operator -=(const Scalar& rhs)
|
||||||
{
|
{
|
||||||
val_ -= rhs;
|
val_ -= rhs;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator -=(const Forward& rhs)
|
operator -=(const Forward& rhs)
|
||||||
{
|
{
|
||||||
val_ -= rhs.val_;
|
val_ -= rhs.val_;
|
||||||
der_ -= rhs.der_;
|
der_ -= rhs.der_;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator *=(const Scalar& rhs)
|
operator *=(const Scalar& rhs)
|
||||||
{
|
{
|
||||||
val_ *= rhs;
|
val_ *= rhs;
|
||||||
der_ *= rhs;
|
der_ *= rhs;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator *=(const Forward& rhs)
|
operator *=(const Forward& rhs)
|
||||||
{
|
{
|
||||||
der_ = der_*rhs.val_ + val_*rhs.der_;
|
der_ = der_*rhs.val_ + val_*rhs.der_;
|
||||||
val_ *= rhs.val_;
|
val_ *= rhs.val_;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator /=(const Scalar& rhs)
|
operator /=(const Scalar& rhs)
|
||||||
{
|
{
|
||||||
val_ /= rhs;
|
val_ /= rhs;
|
||||||
der_ /= rhs;
|
der_ /= rhs;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Forward&
|
void
|
||||||
operator /=(const Forward& rhs)
|
operator /=(const Forward& rhs)
|
||||||
{
|
{
|
||||||
der_ = (der_*rhs.val_ - val_*rhs.der_) / (rhs.val_ * rhs.val_);
|
der_ = (der_*rhs.val_ - val_*rhs.der_) / (rhs.val_ * rhs.val_);
|
||||||
val_ /= rhs.val_;
|
val_ /= rhs.val_;
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Ostream>
|
template <class Ostream>
|
||||||
|
Loading…
Reference in New Issue
Block a user