[GRASS-dev] GNU scientific library in GRASS

Hi All!

What about using GNU scientific library (gsl) in GRASS module?

Will it create additional dependencies?
What about compiling on windows?
Any other contraindications??

In general what I want to use I cannot find in gmath library.

thanks for any answer
J.

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.

Sören

thanks for any answer
J.
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

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?
  

thanks for answer and hint.

In general I have almost created module (v.surf.trend) to fit polynominal 2,5D surface to set of points (in theory any order of plynominal, but in fact up to 6 or 10 order).
I used for it gsl_multifit_linear and gsl_multifit_linear_svd wich work for now well on sample dataset
now I try to expeand it with some addational functions like gsl_multifit_wlinear and gsl_multifit_linear_est (rather experimentally)

and finally must create GRASS io and interface section to finish it.

I look into ccmath and what I found is pplsq, but I'm not sure I will easily expand it to 2D surface (it differs form gsl which is genearlly based on "Numerical recipies..."). I do not know ccmath I saw it for the first time so I cannot surely say there is all I need.
In general it is possible to solve problem with some additional programing effort but with gsl I have given solution.

On the other hand gsl is in practice available in almost all linux installation except these most limited...

Again thanks for answer. I think now I will finish it on my way and start test, and next I can think about rewrite it with ccmath for GRASS 7

Jarek.

**

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.

Sören

thanks for any answer
J.
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

On Tue, Apr 13, 2010 at 5:48 PM, Jarek Jasiewicz <jarekj@amu.edu.pl> wrote:
...

I look into ccmath and what I found is pplsq, but I'm not sure I will easily
expand it to 2D surface (it differs form gsl which is genearlly based on
"Numerical recipies...").

Just for the record (sorry to insist): it is not.

http://www.gnu.org/software/gsl/design/gsl-design.html
"Routines in GSL should not refer to Numerical Recipes or be based on
it in any way."

Another random link:
http://mingus.as.arizona.edu/~bjw/software/boycottnr.html

In essence, NR routines are non-free. We cannot use them in GPL'ed software.

Best,
Markus

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