Frequently Asked Questions
This is the single-most often occurring error people experience when starting with MTL4.
The problem is that certain objects cannot be accessed during insertion, in particular sparse and distributed matrices.
The following program fragment is wrong:
using namespace mtl; typedef compressed2D<double> matrix_type; matrix_type A(5, 5); matrix::inserter<matrix_type> ins(A); ins[0][0] << 7.3; // .... more insertions do_something_with(A); // TROUBLE!!!
In this code, A is used before it is ready.
The insertion is only finished when the inserter is destroyed. This can be achieved in two ways:
An extra scope is implicitly used when the insertion is performed in a separate function, as done here.
The easiest way to destroy the inserter is to enclose the insertion in braces:
using namespace mtl; typedef compressed2D<double> matrix_type; matrix_type A(5, 5); { matrix::inserter<matrix_type> ins(A); ins[0][0] << 7.3; } // ins is destroyed here do_something_with(A); // and A is ready to use
For more information read this.
No. But it has the same directory structure as boost with the intention of easier inclusion. Probably, we will apply for a boost revision with the open source edition some day.
Yes. This is planned for the open source edition.
This should not happen and we hope that we already eradicated this error. In fact, there were no problems reported recently.
The trouble comes from the fact that there are namespaces traits in mtl as well as in mtl::matrix. Within namespace mtl::matrix, the name traits::xyz is searched in mtl::matrix::traits not in mtl::traits.
The quick solution is to replace traits::xyz by mtl::traits::xyz to nominate the namespace explicitly.
The best solution is to send us (mtl4@osl.iu.edu) a bug report and we will fix it for everybody.
Frequently Asked Questions -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine
-- Gen. with
rev. 7542
on Sat Aug 11 2012 by doxygen 1.7.6.1 -- © 2010 by SimuNova UG.