Hi Toby,
> I've now implemented a test for the iterative solvers and
> preconditioners, using generate_fdm_laplace. This is good because it
> gives consistent results, though compared to using a randomly generated
> system matrix it means that the solvers are only tested on one set of
> input data.
>
> My test works by constructing the system matrix, choosing a solution
> vector that is just a vector of 1.0s of the correct size, and
> multiplying to find the RHS to put into the solver. I then run the
> solver and compare the output to my vector of 1.0s. I report a failure
> if the error is greater than some tolerance value specific for the
> datatype.
>
> Of course, this absolute error tolerance has a different definition to
> that in (for instance) the GMRES solver, where we have
>
> "solver quits if ||r|| < tolerance * ||r_initial|| obtains."
>
> This means that the solver might return successfully, and yet cause a
> false test failure. I have a crude work-around for this. It seems to
> suffice to set the solver tolerance to 1e-1 times the test tolerance,
> which strictly might be stronger than is ideally warranted. I think this
> should suffice for the purposes of this test, however; else I'll have to
> do silly solver-specific things like computing ||r_initial||.
>
> Currently, I use a test tolerance of 1e-2 for single-precision, which
> means a solver tolerance of 1e-3. This seems less precise than I'd like;
> machine epsilon should be around 1e-7, and so I feel like I should be
> able to use a test tolerance of 1e-3 and a solver tolerance of
> 1e-4. However, using GMRES, this gives incorrect results (regardless of
> max_iterations) -- wildly so when combined with some preconditioners. I
> suspect that this is caused by rounding errors, but I'm not sure.
The 'standard' criterion is indeed to monitor the residual norm
||b - Ax||
and quit if this becomes several orders of magnitude smaller than the
initial residual. Since the initial guess is typically the zero vector,
the initial residual is easily computed as ||b||. Common values for the
tolerance are in the range 10^{-6}, which should be okay even with
single precision. To make your system matrix well-behaved, a good hint
is to make your random matrix an M-matrix, i.e. you select all
off-diagonal entries negative, while the diagonal entries are equal or
larger than the negative sum of the off-diagonal entries. This way the
condition number remains reasonable, so you also get useful
approximations of the true solution. Anyway, if you just monitor the
residual, you should be fine.
> I tried to check for what the ViennaCL test does, but I couldn't find
> one for the iterative solvers!
Yeah, these are currently tested in other Vienna* packages, but
(unfortunately) there is no strict test in the Nightly test suite, only
the solverbench.
Best regards,
Karli
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
ViennaCL-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/viennacl-devel