Boost C++ Libraries: Ticket #4024: improve performance of inplace_solve https://svn.boost.org/trac10/ticket/4024 <p> Joern Ungermann proposed a patch to improve performance of inplace_solve. </p> <p> The inplace_solve routine has to cope for 24 different cases: </p> <p> a) row_major / column_major </p> <p> b) upper / lower </p> <p> c) dense / packed / sparse </p> <p> d) A * x = b / x * A = b </p> <p> The case row_major / lower_tag / A * x = b is currently mapped to row_major / upper_tag / x * A = b and the case row_major / upper_tag / A * x = b is currently mapped to row_major / lower_tag / x * A = b This is very inefficient for compressed_matrix types! The cases column_major / [lower_tag | upper_tag] / x * A = b are seemingly handled, but I can't get it to complile. The cases of row_major / [lower_tag | upper_tag] / x * A = b *do* have an efficient implementation, which is *not* used to a programming bug, i.e. making the choice of the function depending on the storage type of the vector and not on the matrix. </p> <p> I rewrote triangular.hpp to </p> <p> a) handle *all* cases of A * x = b and to </p> <p> b) "redirect" the x * A = b cases to the aforementioned ones. </p> <p> This keeps the code about the same size as it currently is. It costs some efficiently for the redirected cases, but previously certain cases were also redirected (just different ones). It is trivial to add the missing cases, but adds quite a bit of code. </p> <pre class="wiki"> old (dense) new (dense) old (sparse) new (sparse) col_low x: 3240000 3240000 10000 10000 row_low x: 5100000 3720000 2590000 10000 col_upp x: 3320000 3340000 10000 10000 row_upp x: 5120000 3750000 2790000 10000 x col_low: - 4660000 - 10000 x row_low: 3330000 4060000 3750000 20000 x col_upp: - 5110000 - 20000 x row_upp: 3230000 3910000 3750000 10000 with dense=ublas::matrix and sparse=ublas::compressed_matrix </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4024 Trac 1.4.3 Gunter Wed, 17 Mar 2010 20:59:33 GMT attachment set https://svn.boost.org/trac10/ticket/4024 https://svn.boost.org/trac10/ticket/4024 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">patch_and_test.tgz</span> </li> </ul> <p> patch provided by Jörn </p> Ticket j.ungermann@… Thu, 18 Mar 2010 07:33:48 GMT attachment set https://svn.boost.org/trac10/ticket/4024 https://svn.boost.org/trac10/ticket/4024 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test_inplace_solve.cc</span> </li> </ul> <p> Test case for inplace solve. </p> Ticket j.ungermann@… Thu, 18 Mar 2010 07:37:40 GMT <link>https://svn.boost.org/trac10/ticket/4024#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:1</guid> <description> <p> Hello, I uploaded a testcase for inplace_solve. It doesn't compile with the current trunk (as it is buggy), but with my patched version. It uses the macros defined in utils.hpp. Compilation time is quite high, execution time is quite fast. It tests all matrix types with both majorities that I am aware of. </p> <p> I just saw that the line #include &lt;boost/numeric/ublas/triangular.hpp.new&gt; should be #include &lt;boost/numeric/ublas/triangular.hpp&gt; . </p> </description> <category>Ticket</category> </item> <item> <author>consulting@…</author> <pubDate>Mon, 12 Apr 2010 08:55:36 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/4024#comment:2 https://svn.boost.org/trac10/ticket/4024#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">consulting@…</span> added </li> </ul> Ticket Gunter Mon, 27 Aug 2012 22:13:28 GMT <link>https://svn.boost.org/trac10/ticket/4024#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:3</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80267" title=" boost/numeric/ublas/triangular.hpp - applied patch, see #4024 ...">[80267]</a>) boost/numeric/ublas/triangular.hpp - applied patch, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> libs/numeric/ublas/test/test_inplace_solve.cpp - fixed includes </p> <p> libs/numeric/ublas/test/utils.hpp - applied patch (after s/BOOST_UBLA_TEST/BOOST_UBLAS_TEST/g), see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7296" title="#7296: Bugs: Bug-fix and improvements to test utility functions (closed: fixed)">#7296</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Tue, 04 Sep 2012 20:42:30 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4024#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:4</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80399" title="libs/numeric/ublas/test/test_inplace_solve.cpp: see #4024 - remove ...">[80399]</a>) libs/numeric/ublas/test/test_inplace_solve.cpp: see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> - remove unused headers </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Tue, 04 Sep 2012 23:31:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4024#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:5</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80403" title="boost/numeric/ublas/matrix_sparse.hpp : fix ...">[80403]</a>) boost/numeric/ublas/matrix_sparse.hpp : fix mapped_vector_of_mapped_vector </p> <p> libs/numeric/ublas/test/test_inplace_solve.cpp : make test set configurable, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> </p> <p> libs/numeric/ublas/test/test32.cpp, libs/numeric/ublas/test/test33.cpp : add mapped_vector_of_mapped_vector </p> <p> libs/numeric/ublas/test/Jamfile.v2 : see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> - split some tests to separate "good" and "bad" matrix types </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Tue, 18 Sep 2012 21:07:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4024#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:6</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80588" title="merge ...">[80588]</a>) merge <a class="changeset" href="https://svn.boost.org/trac10/changeset/61880" title="see #4202: fixed some typos and grammar mistakes ">[61880]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/75560" title="added new tests ">[75560]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80267" title=" boost/numeric/ublas/triangular.hpp - applied patch, see #4024 ...">[80267]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80268" title="boost/numeric/ublas/traits.hpp - apply patch, see #6514 ">[80268]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80269" title=" boost/numeric/ublas/operation: num_rows.hpp, num_columns.hpp - use ...">[80269]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80270" title=" boost/numeric/ublas/vector_expression.hpp - use enable_if for ...">[80270]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80399" title="libs/numeric/ublas/test/test_inplace_solve.cpp: see #4024 - remove ...">[80399]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80403" title="boost/numeric/ublas/matrix_sparse.hpp : fix ...">[80403]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80483" title=" boost/numeric/ublas/traits.hpp, ...">[80483]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80485" title=" * libs/numeric/ublas/test/utils.hpp : see #7296, improved macros * ...">[80485]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80507" title=" * libs/numeric/ublas/tests/utils.hpp: see #7296 - replace __func__ by ...">[80507]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80563" title=" * libs/numeric/ublas/test/test_ticket7296.cpp: see #7296 - add ...">[80563]</a> into release branch </p> <ul><li>fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6511" title="#6511: Bugs: Division by scalar should use enable_if&lt;&gt; (closed: fixed)">#6511</a>, fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6514" title="#6514: Bugs: [ublas] fix for has_trivial_constructor (closed: fixed)">#6514</a>, fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7296" title="#7296: Bugs: Bug-fix and improvements to test utility functions (closed: fixed)">#7296</a>, fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7297" title="#7297: Patches: Make the free functions 'num_columns' and 'num_rows' support the uBLAS ... (closed: fixed)">#7297</a>, </li></ul><ul><li>see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Tue, 18 Sep 2012 21:14:35 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4024#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:7</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80590" title=" * add missing test from [80588], see #4024 ">[80590]</a>) </p> <ul><li>add missing test from <a class="changeset" href="https://svn.boost.org/trac10/changeset/80588" title="merge ...">[80588]</a>, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Wed, 19 Sep 2012 18:57:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4024#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4024#comment:8</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80599" title=" * libs/numeric/ublas/test/test_triangular.cpp - remove unused ...">[80599]</a>) </p> <ul><li>libs/numeric/ublas/test/test_triangular.cpp - remove unused includes, see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> </li></ul> </description> <category>Ticket</category> </item> <item> <dc:creator>Gunter</dc:creator> <pubDate>Sat, 22 Sep 2012 21:52:15 GMT</pubDate> <title>owner, status, milestone changed https://svn.boost.org/trac10/ticket/4024#comment:9 https://svn.boost.org/trac10/ticket/4024#comment:9 <ul> <li><strong>owner</strong> changed from <span class="trac-author">David Bellot</span> to <span class="trac-author">Gunter</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.43.0</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> Ticket Gunter Sat, 22 Sep 2012 21:58:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/4024#comment:10 https://svn.boost.org/trac10/ticket/4024#comment:10 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/80645" title="merged ...">[80645]</a>) merged <a class="changeset" href="https://svn.boost.org/trac10/changeset/80483" title=" boost/numeric/ublas/traits.hpp, ...">[80483]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80487" title="* boost/numeric/ublas/matrix_sparse.hpp: see #7363, add new define ...">[80487]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80586" title=" * libs/numeric/ublas/test/Jamfile.v2: see #7363 - separate test of ...">[80586]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80591" title=" * boost/numeric/ublas/vector_sparse.hpp: add ifdef ...">[80591]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80592" title=" * boost/numeric/ublas/operation/size.hpp: apply patch, see #5812 ">[80592]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80599" title=" * libs/numeric/ublas/test/test_triangular.cpp - remove unused ...">[80599]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80600" title=" * libs/numeric/ublas/test/utils.hpp: use 'using ::std' instead of ...">[80600]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80624" title=" * libs/numeric/ublas/test/utils.hpp: switch to boost::math::isnan, ...">[80624]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80625" title=" * boost/numeric/ublas/vector_sparse.hpp, ...">[80625]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80643" title=" * boost/numeric/ublas/storage.hpp: see #7363, remove ...">[80643]</a>,<a class="changeset" href="https://svn.boost.org/trac10/changeset/80644" title=" * libs/numeric/ublas/test/test_triangular.cpp: switch to boost::timer ...">[80644]</a> into release: </p> <ul><li>fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4024" title="#4024: Patches: improve performance of inplace_solve (closed: fixed)">#4024</a> </li></ul><ul><li>fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5812" title="#5812: Patches: Ill formed use of template keyword in qualified names (closed: fixed)">#5812</a> </li></ul><ul><li>fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7296" title="#7296: Bugs: Bug-fix and improvements to test utility functions (closed: fixed)">#7296</a> (hopefully ;-) </li></ul><ul><li>see <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7363" title="#7363: Bugs: coordinate_matrix::sort() fails with gcc 4.7 (closed: fixed)">#7363</a> (must wait for a full test cycle before closing this task) </li></ul> Ticket