[eigen] inverse unit test |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: Eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] inverse unit test
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Thu, 10 Jun 2010 00:43:43 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=O2gRcg8veYSC3boqiHeu1ZL7wjmH8RhPNGiQVbVxJj8=; b=ckWLiLPasmWL116WPbyLdDmndF4/as5EPtxidtkIi70VArKbl7zGvKVYPEAZFldCaT 65+12vhUffXD+63qTsZT7IlhKC3BCiebvT7Mb0f36pPasFJdSnZyRNyQmvECiLrKn8Ob V3TMQDez5AQ1hq6Y7m8PpO27hg/PFkzknAsSs=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=AzQ6wl5heloMFePZxBgaQein3HfroPMzlJItaNn14gS2hJp350uMI1zz20k8td/hHa M6WEYrKrFWO29WWLb7i1WSJMZhITlFAfAPZzveSSnLdsdq3VpUxx/2BzVAsJSjBI4DM7 OQTv9N3WV2D3DNxu91nWhx/Lr5RxgVWrcEgVM=
On MSVC the inverse unit test fails here:
//Second: a rank one matrix (not invertible, except for 1x1 matrices)
VectorType v3 = VectorType::Random(rows);
MatrixType m3 = v3*v3.transpose(), m4(rows,cols);
m3.computeInverseAndDetWithCheck(m4, det, invertible);
VERIFY( rows==1 ? invertible : !invertible );
VERIFY_IS_APPROX(det, m3.determinant());
m3.computeInverseWithCheck(m4, invertible);
VERIFY( rows==1 ? invertible : !invertible );
We expect a determinant of 0 since the matrix is not invertible and
then this check fails
VERIFY_IS_APPROX(det, m3.determinant());
VERIFY_IS_APPROX will always fail in case one of the two parameters is
zero and in case both values are small it is likely to fail as well
because
abs(x-y) <= min(abs(x),abs(y)) * 1e-3
here, we take the minimal value and make it even smaller.
Here are some nice comparison methods we might try to adapt:
http://www.boost.org/doc/libs/1_32_0/boost/test/floating_point_comparison.hpp
- Hauke