Soeren Gebbert pisze:
Hello,
2010/4/13 Jarosław Jasiewicz <jarekj@amu.edu.pl>:
Hi All!
What about using GNU scientific library (gsl) in GRASS module?
Will it create additional dependencies?
Yes.
What about compiling on windows?
Any other contraindications??
In general what I want to use I cannot find in gmath library.
What kind of algorithms are missing in gmath library?
GRASS7 already includes a numerical library called ccmath. Have a look
in the gmath-ccmath wrapper in lib/gmath.
Currently only a few algorithms from ccmath are used: eigenvalue
computation, LU decomposition and SVD solver. Have a look at the
ccmath library (http://freshmeat.net/projects/ccmath/). Maybe the
algorithms you are searching for is present there? If this is the case
we can add it to grass7.
Hi again!
There is a problem:
I wrote new GRASS module, v.surf.trend I think it will be useful and it is a part of something bigger (kriging based GRASS contour to raster interpolation with terrain feature like streams lakes, discontinuation, peaks etc, something like ANU-DEM) but at the beginning I must solve more basic problems
v.surf.trend allow to fit set of points to trend surface at any degree of polynomial (in fact more than 6 has no sense)
Module v.surf.trend is ready to use (there remained some cosmetics) but is based on external dependencies: GNU Scientific library. It uses linear multifit with singular value matrix decomposition (gsl_multifit_linear). As I understood above this is not especially acceptable.
According to Soren's advice I decided to use function from ccmath and here is the problem.
There are two approach which allow to use multifit in ccmath:
function qrlsq which uses qr decomposition to solve linear least squares fitting and function lsqsv with singular value matrix decomposition
I assume that results shall be similar to that from gsl. In fact there is absolutely not.
I prepared testing version of the module. Is someone can help it is here: http://heretic.livenet.pl/heretic/v.surf.trend.tar.gz
(may be some problems with server)
To compile it gsl is necessary
This module performs calculating trend coefs with three methods:
gsl_multifit_linear gives perfect result up to 16 degree polynomial (and probably more but I stopped testing here)
ccmath qrlsq gives perfect result to 3th degree of polynomial and good result on 4th degree but above coef are completely different from gsl and results are similar to good but with artifacts (see output)
ccmath svdlsq gives completely wrong results not comparable with gsl
if someone can help there only calc.c file is important: ccmath.c has function from ccmath library, vector.c process input vector file there is no help however and there are some issues like lack of 3D and WHERE support
Sorry for such mail. But it is result of previous suggestion. Now I can:
1) publish module with external dependency and limit it usability for advanced users only
2) reinvent wheel again and rewrite gsl solution to GRASS code (I prefer spend that time on something more useful, simple extracting like with ccmath is not possible)
3) maybe I'm wrong about methods from ccmath and solution is simple?
regards
Jarek
BTW:
there are two flags in current version -r and -s with no flag output is from gsl with -r output is from qr reduction with -s flag svd reduction