From baf0cffedd8774b49708eeb8b0f2c2c2b1ce51ea Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 18 Aug 2008 12:33:14 +0000 Subject: *add operator()(int) for vectors, synonymous to operator[](int). I don't see any reason not to allow it, it doesn't add much code, and it makes porting from eigen1 easier. *expand tests/basicstuff to first test coefficient access methods --- test/basicstuff.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/basicstuff.cpp') diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 9da5167e6..b48ebbe8e 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -46,9 +46,22 @@ template void basicStuff(const MatrixType& m) v2 = VectorType::Random(rows), vzero = VectorType::Zero(rows); + Scalar x = ei_random(); + int r = ei_random(0, rows-1), c = ei_random(0, cols-1); + m1.coeffRef(r,c) = x; + VERIFY_IS_APPROX(x, m1.coeff(r,c)); + m1(r,c) = x; + VERIFY_IS_APPROX(x, m1(r,c)); + v1.coeffRef(r) = x; + VERIFY_IS_APPROX(x, v1.coeff(r)); + v1(r) = x; + VERIFY_IS_APPROX(x, v1(r)); + v1[r] = x; + VERIFY_IS_APPROX(x, v1[r]); + VERIFY_IS_APPROX( v1, v1); VERIFY_IS_NOT_APPROX( v1, 2*v1); VERIFY_IS_MUCH_SMALLER_THAN( vzero, v1); -- cgit v1.2.3