<div dir="ltr"><div>Dear duners,</div><div><br></div><div> As Martin has suggested me:</div><div><br></div>2016-03-21 4:09 GMT-04:00 Martin Nolte <span dir="ltr"><<a href="mailto:nolte@mathematik.uni-freiburg.de" target="_blank">nolte@mathematik.uni-freiburg.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">As Andreas already said, wrapping a few more methods might be interesting, too. You could also have a look at the FieldMatrix, especially at the operator[] (which returns a reference to a FieldVector).<br></blockquote><div><br></div><div>I am working on a (Boost.Python) wrapper for the FieldMatrix class and you can find the code on the gitlab [1].</div><div><br></div><div>Like my first junior job (a wrapper for the FieldVector class), I have to deal with static polymorphism and C++ templates. Thus, I used the same skeleton with a WrapFieldMatrix class, which defines a WrapFieldMatrix() constructor, called inside a BOOST_PYTHON_MODULE macro to specialize this class at compile time.</div><div><br></div><div>See the result, within a python interpreter:</div><div><span style="color:rgb(0,0,0)"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span style="color:rgb(0,0,0)">>>> from libfmatrix import *<br></span><span style="color:rgb(0,0,0)">>>> m = FieldMatrix11(3.14)<br></span><span style="color:rgb(0,0,0)">>>> m<br></span><span style="color:rgb(0,0,0)"><libfmatrix.FieldMatrix11 object at 0x7fa692add030><br></span><span style="color:rgb(0,0,0)">>>> m.mat_access(0)<br></span><span style="color:rgb(0,0,0)"><libfvector.FieldVector1 object at 0x7fa692acdf80><br></span><span style="color:rgb(0,0,0)">>>> m.mat_access(0)[0]<br></span><span style="color:rgb(0,0,0)">3.14</span></blockquote><div><span style="color:rgb(0,0,0)"><br></span></div><div><font color="#000000">However, I have some interrogations about the leftmultiplyany and rightmultiplyany methods. Both of them introduces a new template parameter which defines the number of rows or columns of the second FieldMatrix. And I just jumped to the conclusion that there as no elegant way to deal with it.In fact, this template parameter which defines the number of rows or columns of the second FieldMatrix must be specialized at compile time and it means registering all the matrices that can be multiplied by the others...</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">So actually with my wrapper, you can just multiply a matrix by a square matrix with the same dimension of rows/columns. Is that okay? </font><span style="color:rgb(0,0,0)">I grepped "leftmultiplyany" and "rightmultiplyany" with "grep -R" on all the core modules of DUNE and these methods are not used anywhere (except in the files where they are defined and in the related test files). So I assume it is not very important to provide bindings for them?</span></div><div><font color="#000000"><br></font></div><div><font color="#000000">I think it matters to have some discussion about that because it would give me some leads about the fact to do such "compromises" about templated methods like that (I guess I will have the same problem on other classes soon enough).</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Anyway, I am going to continue my work by writing some documentation and unit tests and think about how to handle exceptions (because for now, you can do out of bonds accesses without any "trouble", which is kind of disturbing).</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Best,</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Michaël</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">[1] <a href="https://gitlab.dune-project.org/michael.sghaier/dune-common/commit/22e9c16ff0bb536e7c844f8be10d71e80f7fc4e2">https://gitlab.dune-project.org/michael.sghaier/dune-common/commit/22e9c16ff0bb536e7c844f8be10d71e80f7fc4e2</a></font></div></div>