mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Added rsqrt() method to the Array class: this method computes the coefficient-wise inverse square root much more efficiently than calling sqrt().inverse().
This commit is contained in:
@@ -236,6 +236,7 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
||||
// avoid NaNs with abs() so verification doesn't fail
|
||||
m3 = m1.abs();
|
||||
VERIFY_IS_APPROX(m3.sqrt(), sqrt(abs(m1)));
|
||||
VERIFY_IS_APPROX(m3.rsqrt(), Scalar(1)/sqrt(abs(m1)));
|
||||
VERIFY_IS_APPROX(m3.log(), log(m3));
|
||||
VERIFY_IS_APPROX(m3.log10(), log10(m3));
|
||||
|
||||
@@ -292,6 +293,10 @@ template<typename ArrayType> void array_real(const ArrayType& m)
|
||||
|
||||
VERIFY_IS_APPROX(m3.pow(RealScalar(0.5)), m3.sqrt());
|
||||
VERIFY_IS_APPROX(pow(m3,RealScalar(0.5)), m3.sqrt());
|
||||
|
||||
VERIFY_IS_APPROX(m3.pow(RealScalar(-0.5)), m3.rsqrt());
|
||||
VERIFY_IS_APPROX(pow(m3,RealScalar(-0.5)), m3.rsqrt());
|
||||
|
||||
VERIFY_IS_APPROX(log10(m3), log(m3)/log(10));
|
||||
|
||||
// scalar by array division
|
||||
|
||||
Reference in New Issue
Block a user