I may found a way to avoid licensing problems or the need to <br>convince the meschach developers to change there license<br>to be compatible with the gpl.<br><br>We can use parts of the ccmath library.<br><a href="http://freshmeat.net/projects/ccmath/">http://freshmeat.net/projects/ccmath/</a><br>
<br>The ccmath library is licensed under the LGPL,<br>and i hope we don&#39;t face any problems with this license?<br><br>To replace the nr code in grass we need:<br><br>* a fast lu decomposition with pivoting<br>* computation of eigen values and eigen vectors <br>
* singular value decomposition<br><br>Here a cite from the ccmath matrix library documentation:<br><br>
#######################################################<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The matrix algebra library contains functions that<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; perform the standard computations of linear algebra.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; General areas covered are:<br>
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Solution of Linear Systems<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Matrix Inversion<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Eigensystem Analysis<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Matrix Utility Operations<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o Singular Value Decomposition<br>
...<br><br>&nbsp;o&nbsp; Solving and Inverting Linear Systems:<br><br>&nbsp;&nbsp;&nbsp; solv&nbsp; --------- solve a general system of real linear equations.<br>&nbsp;&nbsp;&nbsp; solvps&nbsp; ------- solve a real symmetric linear system.<br>&nbsp;&nbsp;&nbsp; solvru&nbsp; ------- solve a real right upper triangular linear system.<br>
&nbsp;&nbsp;&nbsp; solvtd&nbsp; ------- solve a tridiagonal real linear system.<br><br>&nbsp;&nbsp;&nbsp; minv&nbsp; --------- invert a general real square matrix.<br>&nbsp;&nbsp;&nbsp; psinv&nbsp; -------- invert a real symmetric matrix.<br>&nbsp;&nbsp;&nbsp; ruinv&nbsp; -------- invert a right upper triangular matrix.<br>
<br>...<br><br>&nbsp;o&nbsp; Eigensystem Analysis:<br><br>&nbsp;&nbsp;&nbsp; eigen&nbsp; ------ extract all eigen values and vectors of a real<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; symmetric matrix.<br>&nbsp;&nbsp;&nbsp; eigval&nbsp; ----- extract the eigen values of a real symmetric matrix.<br>
&nbsp;&nbsp;&nbsp; evmax&nbsp; ------ compute the eigen value of maximum absolute magnitude<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and its corresponding vector for a symmetric matrix.<br><br>...<br><br>&nbsp;o Singular Value Decomposition:<br><br>&nbsp;&nbsp;&nbsp; svdval&nbsp; ----- compute the singular values of a m by n real matrix.<br>
&nbsp;&nbsp;&nbsp; sv2val&nbsp; ----- compute the singular values of a real matrix<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; efficiently for m &gt;&gt; n.<br>&nbsp;&nbsp;&nbsp; svduv&nbsp; ------ compute the singular values and the transformation<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrices u and v for a real m by n matrix.<br>
&nbsp;&nbsp;&nbsp; sv2uv&nbsp; ------ compute the singular values and transformation<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrices efficiently for m &gt;&gt; n.<br>&nbsp;&nbsp;&nbsp; svdu1v&nbsp; ----- compute the singular values and transformation<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrices u1 and v, where u1 overloads the input<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with the first n column vectors of u.<br>&nbsp;&nbsp;&nbsp; sv2u1v&nbsp; ----- compute the singular values and the transformation<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; matrices u1 and v efficiently for m &gt;&gt; n.<br><br>end<br>#######################################################<br>
<br>So the ccmath library provides all the algorithms we need to replace the nr code in grass.<br><br>I would suggest to extract the needed parts from ccmath and integrate <br>them in the gmath library structure i already created (take a look at the patch i provided). <br>
I would suggest an extraction of needed parts because the ccmath library ships a lot of algorithms we don&#39;t need and<br>the source code is not well documented and difficult to read.<br>We only need the matrix computation algorithm including documentation and tests.<br>
<br>I will keep my sparse matrix solver and matrix-vector algorithm in gmath and extend them, <br>(more sparse matrix and sparse vector operations ... inspired from meschach),<br>to implement in the future a sparse ILU and LU factorisation with minimal fill in.<br>
This is needed for huge sparse linear equation systems with bad condition. Such linear equation systems<br>can not be solved with the sparse matrix solver i implemented.<br><br>Things to be done (very roughly estimated):<br>
<br>* extraction of the needed algorithm from ccmath <br>* Implementation of a wrapper around these functions, so a user can replace the grass ccmath extraction with <br>&nbsp; a distribution or self compiled version of the ccmath library.<br>
* integration of the documentation and the tests of ccmath matrix into gmath<br>* integration of the ccmath solver in the gmath solver structure. This may result in a modification of the current matrix<br>&nbsp; access methods and a rewrite of the blas 1, 2 and 3 functions i implemented.<br>
* replacing the nr code which results in the modification of all dependent gmath code and grass modules<br>* writing tests for all depended modules<br>* improving the grass sparse matrix algorithms and solver<br><br>Well i guess i will need at least another year to code this. <br>
...<br><br>So, how about this approach? Any hints, suggestions or criticism?<br>Did i over see an issue?<br><br><br>Best regards<br>Soeren<br><br><br><br><br><div class="gmail_quote">2009/1/15 Glynn Clements <span dir="ltr">&lt;<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d"><br>
Moritz Lennert wrote:<br>
<br>
&gt; &gt; I don&#39;t really see a problem with it. It&#39;s a &quot;you do not have the<br>
&gt; &gt; freedom to make this program less free&quot; restriction, similar to the<br>
&gt; &gt; restrictions imposed by the GPL.<br>
&gt;<br>
&gt; Well, the first paragraphe of the DFSG is:<br>
&gt;<br>
&gt; &quot;Free Redistribution<br>
&gt;<br>
&gt; The license of a Debian component may not restrict any party from<br>
&gt; selling or giving away the software as a component of an aggregate<br>
&gt; software distribution containing programs from several different sources.&quot;<br>
&gt;<br>
&gt; So, forbidding to sell seems against the DFSG...<br>
<br>
</div>The meschach licence doesn&#39;t prohibit selling an aggregation of which<br>
meschach is a component.<br>
<br>
That makes the problematic clause even more pointless. You could sell<br>
a CD containing meschach and a two-line script, on the basis that<br>
meschach is free but the script costs $50k.<br>
<div class="Ih2E3d"><br>
&gt; &gt; Essentially, it&#39;s a question of how to resolve competing freedoms, and<br>
&gt; &gt; the meschach licence took a different view to the GPL. It&#39;s just a<br>
&gt; &gt; different (and incompatible) sort of &quot;free&quot;.<br>
&gt;<br>
&gt; There seems to be a possibility of exceptions for these situations in<br>
&gt; the GPL[1]:<br>
<br>
</div>Only the copyright holder can provide such an exemption.<br>
<br>
The author can release their code under any licence they choose,<br>
including e.g. GPL-but-you-can-link-against-meschach (KDE provided<br>
such an exemption for Qt before it was available under the GPL).<br>
<br>
But you can&#39;t provide such an exemption for anyone else&#39;s GPL code. So<br>
you couldn&#39;t distribute a binary linked against e.g. both meschach and<br>
readline. I don&#39;t know if this would apply on a module-by-module basis<br>
or to GRASS as a whole. IOW, whether you can claim that GRASS is a<br>
&quot;mere aggregation&quot; of its components or a single work. I suspect the<br>
latter.<br>
<div class="Ih2E3d"><br>
&gt; So, we might be able to do this, but AFAICT this would need the<br>
&gt; agreement of all people holding copyright over GRASS code.<br>
<br>
</div>Yes. Including any GPL libraries (e.g. readline).<br>
<div><div></div><div class="Wj3C7c"><br>
--<br>
Glynn Clements &lt;<a href="mailto:glynn@gclements.plus.com">glynn@gclements.plus.com</a>&gt;<br>
_______________________________________________<br>
grass-dev mailing list<br>
<a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
</div></div></blockquote></div><br>