Re: [eigen] Bug in traspose

[ Thread Index | Date Index | More Archives ]


On Thursday 17 January 2008 03:01:59 Ian Mackenzie wrote:
> CxxTest doesn't seem designed specifically to test template functions,
> although of course you could always do something like
>         void test_template()
>         {
>             template_test<1>();
>             template_test<2>();
>         };

exactly what I am currently doing with QTestLib ;)

> I don't see a built-in way to pass command-line options to the tests, or
> only running one test in a suite.  I don't know if this helps at all, but
> if you use the CTest testing framework bundled with CMake, you can use the
> -R command line option to only run test executables whose name matches a
> given regular expression, so you could (for instance) prefix each of your
> test names with 'linux_' or 'windows_' or whatever and then run 'ctest -R
> linux' or 'ctest -R windows' depending on what platform you're on.

Interesting, I hadn't considered CTest.

From what Ben and you say, I probably won't use CxxTest; in fact my original 
idea was to write my unit-tests without relying on any existing framework, as 
there is not so much work to do than what I have already done (currently we 
don't use a lot of stuff from QTestLib). Now that you mention CTest I'll 
consider it, it seems to be the only one potentially solving one of my 2 
problems and at leasts is no additional dependency.

My TODO for alpha4 looks like this:
- port the unit-tests to whichever framework we decide to;
- improve/update unit-tests
- add a comma-initializer (class with overloaded operator,) allowing to do 
things like
Matrix3d m;
m.list(), 1, 2, 3 .newline(),
          4, 5, 6 .newline(),
          7, 8, 9 .end();
In this design, m.list() returns an object of 
type "CommaInitializer<MatrixType>" which stores a reference to m, and 
subsequently one calls CommaInitializer::operator, , 
CommaInitializer::newline(), CommaInitializer::end;
The matrix m may be of dynamic size but it must have its correct size before 
calling m.list().

The cool things by comparisons with existing comma-initializers (tvmet or 
afaik blitz++) is that we do explicit "newline()", each call checks that 
ranges are respected, and "end()" checks that exactly the right number of 
coefficients was passed; the even cooler thing is that we can allow the items 
in the list to be matrices, hence constructing a matrix by blocks:
Matrix4d m;
Matrix2d blocks[4];
m.list(), blocks[0], blocks[1] .newline(),
          blocks[2], blocks[3] .end();
This is not even limited to fixed-size matrices and blocks.

- i will benchmark minor() as I am not sure if it allows the compiler to 
generate optimized-enough code and will remove it (not very useful anyway) if 
it turns out to be intrinsically slow (if there is a conditional branch at 
every coefficient access). Or will implement it in a read-only, 
immediate-evaluation way, which will make it even less useful.

See you when I get back to coding!



Attachment: signature.asc
Description: This is a digitally signed message part.

Mail converted by MHonArc 2.6.19+