[GRASS-SVN] r63335 - in grass-addons/grass7/imagery: . i.pr i.pr/PRLIB i.pr/doc i.pr/i.pr_blob i.pr/i.pr_classify i.pr/i.pr_features i.pr/i.pr_features_additional i.pr/i.pr_features_extract i.pr/i.pr_features_selection i.pr/i.pr_model i.pr/i.pr_sites_aggregate i.pr/i.pr_statistics i.pr/i.pr_subsets i.pr/i.pr_subsets/old i.pr/i.pr_training i.pr/i.pr_uxb i.pr/include

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 2 12:19:54 PST 2014


Author: zarch
Date: 2014-12-02 12:19:54 -0800 (Tue, 02 Dec 2014)
New Revision: 63335

Added:
   grass-addons/grass7/imagery/i.pr/
   grass-addons/grass7/imagery/i.pr/Makefile
   grass-addons/grass7/imagery/i.pr/PRLIB/
   grass-addons/grass7/imagery/i.pr/PRLIB/Makefile
   grass-addons/grass7/imagery/i.pr/PRLIB/blob.c
   grass-addons/grass7/imagery/i.pr/PRLIB/bootstrap.c
   grass-addons/grass7/imagery/i.pr/PRLIB/dist.c
   grass-addons/grass7/imagery/i.pr/PRLIB/eigen.c
   grass-addons/grass7/imagery/i.pr/PRLIB/entropy.c
   grass-addons/grass7/imagery/i.pr/PRLIB/extract_functions.pl
   grass-addons/grass7/imagery/i.pr/PRLIB/extract_ps.pl
   grass-addons/grass7/imagery/i.pr/PRLIB/features.c
   grass-addons/grass7/imagery/i.pr/PRLIB/features_selection.c
   grass-addons/grass7/imagery/i.pr/PRLIB/getline.c
   grass-addons/grass7/imagery/i.pr/PRLIB/gm.c
   grass-addons/grass7/imagery/i.pr/PRLIB/integration.c
   grass-addons/grass7/imagery/i.pr/PRLIB/lu.c
   grass-addons/grass7/imagery/i.pr/PRLIB/matrix.c
   grass-addons/grass7/imagery/i.pr/PRLIB/min_quadratic.c
   grass-addons/grass7/imagery/i.pr/PRLIB/nn.c
   grass-addons/grass7/imagery/i.pr/PRLIB/open.c
   grass-addons/grass7/imagery/i.pr/PRLIB/pca.c
   grass-addons/grass7/imagery/i.pr/PRLIB/percent.c
   grass-addons/grass7/imagery/i.pr/PRLIB/random.c
   grass-addons/grass7/imagery/i.pr/PRLIB/read_models.c
   grass-addons/grass7/imagery/i.pr/PRLIB/soft_margin_boosting.c
   grass-addons/grass7/imagery/i.pr/PRLIB/sort.c
   grass-addons/grass7/imagery/i.pr/PRLIB/stats.c
   grass-addons/grass7/imagery/i.pr/PRLIB/svm.c
   grass-addons/grass7/imagery/i.pr/PRLIB/test.c
   grass-addons/grass7/imagery/i.pr/PRLIB/training.c
   grass-addons/grass7/imagery/i.pr/PRLIB/tree.c
   grass-addons/grass7/imagery/i.pr/PRLIB/write_matrix.c
   grass-addons/grass7/imagery/i.pr/README
   grass-addons/grass7/imagery/i.pr/TODO
   grass-addons/grass7/imagery/i.pr/doc/
   grass-addons/grass7/imagery/i.pr/doc/psfig.sty
   grass-addons/grass7/imagery/i.pr/doc/usage.tex
   grass-addons/grass7/imagery/i.pr/doc/usage_EN.txt
   grass-addons/grass7/imagery/i.pr/i.pr_blob/
   grass-addons/grass7/imagery/i.pr/i.pr_blob/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_blob/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_classify/
   grass-addons/grass7/imagery/i.pr/i.pr_classify/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_classify/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_features/
   grass-addons/grass7/imagery/i.pr/i.pr_features/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_features/description.html
   grass-addons/grass7/imagery/i.pr/i.pr_features/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_features_additional/
   grass-addons/grass7/imagery/i.pr/i.pr_features_additional/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_features_additional/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_features_extract/
   grass-addons/grass7/imagery/i.pr/i.pr_features_extract/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_features_extract/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_features_selection/
   grass-addons/grass7/imagery/i.pr/i.pr_features_selection/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_features_selection/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_model/
   grass-addons/grass7/imagery/i.pr/i.pr_model/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_model/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/
   grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/cell.c
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/localproto.h
   grass-addons/grass7/imagery/i.pr/i.pr_statistics/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_subsets/
   grass-addons/grass7/imagery/i.pr/i.pr_subsets/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_subsets/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_subsets/old/
   grass-addons/grass7/imagery/i.pr/i.pr_subsets/old/main_orig.c
   grass-addons/grass7/imagery/i.pr/i.pr_subsets/old/main_orig_2.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/
   grass-addons/grass7/imagery/i.pr/i.pr_training/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_training/conv.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/defs.h
   grass-addons/grass7/imagery/i.pr/i.pr_training/description.html
   grass-addons/grass7/imagery/i.pr/i.pr_training/globals.h
   grass-addons/grass7/imagery/i.pr/i.pr_training/graphics.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/loc_func.h
   grass-addons/grass7/imagery/i.pr/i.pr_training/main.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/mouse.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/points.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/sites.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/title.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/view.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/write_map.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/zoom.c
   grass-addons/grass7/imagery/i.pr/i.pr_training/zoom2.c
   grass-addons/grass7/imagery/i.pr/i.pr_uxb/
   grass-addons/grass7/imagery/i.pr/i.pr_uxb/Makefile
   grass-addons/grass7/imagery/i.pr/i.pr_uxb/main.c
   grass-addons/grass7/imagery/i.pr/include/
   grass-addons/grass7/imagery/i.pr/include/func.h
   grass-addons/grass7/imagery/i.pr/include/func_help
   grass-addons/grass7/imagery/i.pr/include/global.h
Log:
Start porting i.pr from grass6 to grass7

Added: grass-addons/grass7/imagery/i.pr/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,24 @@
+MODULE_TOPDIR = ../..
+
+include $(MODULE_TOPDIR)/include/Make/Dir.make
+
+SUBDIRS = \
+        PRLIB \
+	i.pr_blob \
+	i.pr_classify \
+	i.pr_features \
+	i.pr_features_additional \
+	i.pr_features_extract \
+	i.pr_features_selection \
+	i.pr_model \
+	i.pr_statistics \
+	i.pr_subsets \
+	i.pr_training \
+	i.pr_uxb \
+	i.pr_sites_aggregate
+
+default: subdirs
+
+clean: cleansubdirs
+
+install: installsubdirs

Added: grass-addons/grass7/imagery/i.pr/PRLIB/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/PRLIB/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/PRLIB/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,12 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+EXTRA_LIBS = $(GMATHLIB) $(GISLIB) $(MATHLIB)
+
+LIB_NAME = grass_pr
+
+include $(MODULE_TOPDIR)/include/Make/Lib.make
+
+default: lib
+

Added: grass-addons/grass7/imagery/i.pr/PRLIB/blob.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/bootstrap.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/dist.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/eigen.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/entropy.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/extract_functions.pl
===================================================================
--- grass-addons/grass7/imagery/i.pr/PRLIB/extract_functions.pl	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/PRLIB/extract_functions.pl	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,162 @@
+#!/usr/local/bin/perl
+
+require 'getopts.pl';
+
+&Getopts('f');
+
+
+opendir DIR, "./";
+ at files=readdir DIR;
+closedir DIR;
+$nfiles=$#files;
+$done = 0;
+
+if(!$opt_f){
+    while($nfiles>=0){
+	($name,$extension)= split(/\./,$files[$nfiles]);
+	if($extension eq "c" || $extension eq "h"){
+	    if(!$done){
+		print "#########################\n$files[$nfiles]\n#########################\n\n";} else {
+		    print "\n#########################\n$files[$nfiles]\n#########################\n\n";
+		}
+	    $done = 1;
+	    open(FILE,$files[$nfiles]);
+	    while(<FILE>){
+		if(!/\#/){
+		    print $_;
+		}else{
+		    goto START;
+		}
+	    }
+	  START:
+	    while(<FILE>){
+	      NEWfun:
+		if(!/;/ && !/static/){
+		    if(/void /){
+			print $_;
+			while(<FILE>){
+			    if(!/\{/){
+				print $_;
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/double /){
+			print $_;
+			while(<FILE>){
+			    if(!/\{/){
+				print $_;
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/float /){
+			print $_;
+			while(<FILE>){
+			    if(!/\{/){
+				print $_;
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/int /){
+			print $_;
+			while(<FILE>){
+			    if(!/\{/){
+				print $_;
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/char /){
+			print $_;
+			while(<FILE>){
+			    if(!/\{/){
+				print $_;
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		}
+	    }
+	    close(FILE);
+
+	}
+	$nfiles = $nfiles - 1;
+    }
+} else{
+    while($nfiles>=0){
+	($name,$extension)= split(/\./,$files[$nfiles]);
+	if($extension eq "c"){
+	    if(!$done){
+		print "/*\n$files[$nfiles]\n*/\n\n";} else {
+		    print "\n/*\n$files[$nfiles]\n*/\n\n";
+		}
+	    $done = 1;
+	    open(FILE,$files[$nfiles]);
+	    while(<FILE>){
+	      NEWfun:
+		if(!/;/ && !/static/){
+		    if(/void /){
+			($func,$param)=split(/\(/,$_);
+			print $func,"();\n";
+			while(<FILE>){
+			    if(!/\{/){
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/double /){
+			($func,$param)=split(/\(/,$_);
+			print $func,"();\n";
+			while(<FILE>){
+			    if(!/\{/){
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/float /){
+			($func,$param)=split(/\(/,$_);
+			print $func,"();\n";
+			while(<FILE>){
+			    if(!/\{/){
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/int /){
+			($func,$param)=split(/\(/,$_);
+			print $func,"();\n";
+			while(<FILE>){
+			    if(!/\{/){
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		    if(/char /){
+			($func,$param)=split(/\(/,$_);
+			print $func,"();\n";
+			while(<FILE>){
+			    if(!/\{/){
+			    }else{
+				goto NEWfun;
+			    }
+			}
+		    }
+		}
+	    }
+	    close(FILE);
+
+	}
+	$nfiles = $nfiles - 1;
+    }
+}


Property changes on: grass-addons/grass7/imagery/i.pr/PRLIB/extract_functions.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: grass-addons/grass7/imagery/i.pr/PRLIB/extract_ps.pl
===================================================================
--- grass-addons/grass7/imagery/i.pr/PRLIB/extract_ps.pl	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/PRLIB/extract_ps.pl	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,18 @@
+#!/usr/local/bin/perl
+
+opendir DIR, "./";
+ at files=readdir DIR;
+closedir DIR;
+$nfiles=$#files;
+
+
+while($nfiles>=0){
+    ($name,$extension)= split(/\./,$files[$nfiles]);
+    if($extension eq "c" || $extension eq "h"){
+	$out = join(".",$name,"ps");
+	system("a2ps $files[$nfiles] -o $out");
+	system("lpr -PNE.PP.Sud $out");
+    }
+    $nfiles = $nfiles - 1;
+}
+


Property changes on: grass-addons/grass7/imagery/i.pr/PRLIB/extract_ps.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: grass-addons/grass7/imagery/i.pr/PRLIB/features.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/features_selection.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/getline.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/gm.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/integration.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/lu.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/matrix.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/min_quadratic.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/nn.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/open.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/pca.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/percent.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/random.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/read_models.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/soft_margin_boosting.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/sort.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/stats.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/svm.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/test.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/training.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/tree.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/PRLIB/write_matrix.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/README
===================================================================
--- grass-addons/grass7/imagery/i.pr/README	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/README	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,28 @@
+Stefano Merler
+ITC-irst
+Via Sommarive, 18
+38050, Povo
+Trento
+Italy
+http://mpba.fbk.eu/merlo
+
+    * pr : C code for classification problems. It implements k-NN (multiclass), classification trees (multiclass), maximum likelihood (multiclass), Support Vector Machines (binary), bagging versions of all the base classifiers, AdaBoost for binary trees and support vector machines. It allows feature manipulation (normalization, principal components,...). It also implements feature selection techniques (RFE, E-RFE,...), statistical tests on variables, tools for resampling (cross-validation and bootstrap) and cost-sensitive techniques for trees and support vector machines. Feature selection techniques and statistical tests are not distributed in the current release.
+    * i.pr : a version of pr implemented in the GIS GRASS for dealing with images. 
+
+###############
+
+Update 2014:
+
+- updated to ANSI C in an automated way. Sometimes functions seem to be duplicated, to be CLEANED
+---> TODO
+
+###############
+Compilation
+
+The easiest way to compile this module set is to
+tell 'make' where to find GRASS:
+
+  make MODULE_TOPDIR=$HOME/grass64/
+
+(adapt to your /path/to/grass6/ )
+

Added: grass-addons/grass7/imagery/i.pr/TODO
===================================================================
--- grass-addons/grass7/imagery/i.pr/TODO	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/TODO	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,6 @@
+This module set was developed for GRASS 5.
+
+TODO:
+- change to ANSI prototypes
+- follow SUBMITTING rules
+- change sites to vector

Added: grass-addons/grass7/imagery/i.pr/doc/psfig.sty
===================================================================
--- grass-addons/grass7/imagery/i.pr/doc/psfig.sty	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/doc/psfig.sty	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,896 @@
+% Psfig/TeX 
+\def\PsfigVersion{1.9}
+% dvips version
+%
+% All psfig/tex software, documentation, and related files
+% in this distribution of psfig/tex are 
+% Copyright 1987, 1988, 1991 Trevor J. Darrell
+%
+% Permission is granted for use and non-profit distribution of psfig/tex 
+% providing that this notice is clearly maintained. The right to
+% distribute any portion of psfig/tex for profit or as part of any commercial
+% product is specifically reserved for the author(s) of that portion.
+%
+% *** Feel free to make local modifications of psfig as you wish,
+% *** but DO NOT post any changed or modified versions of ``psfig''
+% *** directly to the net. Send them to me and I'll try to incorporate
+% *** them into future versions. If you want to take the psfig code 
+% *** and make a new program (subject to the copyright above), distribute it, 
+% *** (and maintain it) that's fine, just don't call it psfig.
+%
+% Bugs and improvements to trevor at media.mit.edu.
+%
+% Thanks to Greg Hager (GDH) and Ned Batchelder for their contributions
+% to the original version of this project.
+%
+% Modified by J. Daniel Smith on 9 October 1990 to accept the
+% %%BoundingBox: comment with or without a space after the colon.  Stole
+% file reading code from Tom Rokicki's EPSF.TEX file (see below).
+%
+% More modifications by J. Daniel Smith on 29 March 1991 to allow the
+% the included PostScript figure to be rotated.  The amount of
+% rotation is specified by the "angle=" parameter of the \psfig command.
+%
+% Modified by Robert Russell on June 25, 1991 to allow users to specify
+% .ps filenames which don't yet exist, provided they explicitly provide
+% boundingbox information via the \psfig command. Note: This will only work
+% if the "file=" parameter follows all four "bb???=" parameters in the
+% command. This is due to the order in which psfig interprets these params.
+%
+%  3 Jul 1991	JDS	check if file already read in once
+%  4 Sep 1991	JDS	fixed incorrect computation of rotated
+%			bounding box
+% 25 Sep 1991	GVR	expanded synopsis of \psfig
+% 14 Oct 1991	JDS	\fbox code from LaTeX so \psdraft works with TeX
+%			changed \typeout to \ps at typeout
+% 17 Oct 1991	JDS	added \psscalefirst and \psrotatefirst
+%
+
+% From: gvr at cs.brown.edu (George V. Reilly)
+%
+% \psdraft	draws an outline box, but doesn't include the figure
+%		in the DVI file.  Useful for previewing.
+%
+% \psfull	includes the figure in the DVI file (default).
+%
+% \psscalefirst width= or height= specifies the size of the figure
+% 		before rotation.
+% \psrotatefirst (default) width= or height= specifies the size of the
+% 		 figure after rotation.  Asymetric figures will
+% 		 appear to shrink.
+%
+% \psfigurepath#1	sets the path to search for the figure
+%
+% \psfig
+% usage: \psfig{file=, figure=, height=, width=,
+%			bbllx=, bblly=, bburx=, bbury=,
+%			rheight=, rwidth=, clip=, angle=, silent=}
+%
+%	"file" is the filename.  If no path name is specified and the
+%		file is not found in the current directory,
+%		it will be looked for in directory \psfigurepath.
+%	"figure" is a synonym for "file".
+%	By default, the width and height of the figure are taken from
+%		the BoundingBox of the figure.
+%	If "width" is specified, the figure is scaled so that it has
+%		the specified width.  Its height changes proportionately.
+%	If "height" is specified, the figure is scaled so that it has
+%		the specified height.  Its width changes proportionately.
+%	If both "width" and "height" are specified, the figure is scaled
+%		anamorphically.
+%	"bbllx", "bblly", "bburx", and "bbury" control the PostScript
+%		BoundingBox.  If these four values are specified
+%               *before* the "file" option, the PSFIG will not try to
+%               open the PostScript file.
+%	"rheight" and "rwidth" are the reserved height and width
+%		of the figure, i.e., how big TeX actually thinks
+%		the figure is.  They default to "width" and "height".
+%	The "clip" option ensures that no portion of the figure will
+%		appear outside its BoundingBox.  "clip=" is a switch and
+%		takes no value, but the `=' must be present.
+%	The "angle" option specifies the angle of rotation (degrees, ccw).
+%	The "silent" option makes \psfig work silently.
+%
+
+% check to see if macros already loaded in (maybe some other file says
+% "\input psfig") ...
+\ifx\undefined\psfig\else\endinput\fi
+
+%
+% from a suggestion by eijkhout at csrd.uiuc.edu to allow
+% loading as a style file. Changed to avoid problems
+% with amstex per suggestion by jbence at math.ucla.edu
+
+\let\LaTeXAtSign=\@
+\let\@=\relax
+\edef\psfigRestoreAt{\catcode`\@=\number\catcode`@\relax}
+%\edef\psfigRestoreAt{\catcode`@=\number\catcode`@\relax}
+\catcode`\@=11\relax
+\newwrite\@unused
+\def\ps at typeout#1{{\let\protect\string\immediate\write\@unused{#1}}}
+\ps at typeout{psfig/tex \PsfigVersion}
+
+%% Here's how you define your figure path.  Should be set up with null
+%% default and a user useable definition.
+
+\def\figurepath{./}
+\def\psfigurepath#1{\edef\figurepath{#1}}
+
+%
+% @psdo control structure -- similar to Latex @for.
+% I redefined these with different names so that psfig can
+% be used with TeX as well as LaTeX, and so that it will not 
+% be vunerable to future changes in LaTeX's internal
+% control structure,
+%
+\def\@nnil{\@nil}
+\def\@empty{}
+\def\@psdonoop#1\@@#2#3{}
+\def\@psdo#1:=#2\do#3{\edef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
+    \expandafter\@psdoloop#2,\@nil,\@nil\@@#1{#3}\fi}
+\def\@psdoloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
+       #5\def#4{#2}\ifx #4\@nnil \else#5\@ipsdoloop #3\@@#4{#5}\fi\fi}
+\def\@ipsdoloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil 
+       \let\@nextwhile=\@psdonoop \else
+      #4\relax\let\@nextwhile=\@ipsdoloop\fi\@nextwhile#2\@@#3{#4}}
+\def\@tpsdo#1:=#2\do#3{\xdef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
+    \@tpsdoloop#2\@nil\@nil\@@#1{#3}\fi}
+\def\@tpsdoloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil 
+       \let\@nextwhile=\@psdonoop \else
+      #4\relax\let\@nextwhile=\@tpsdoloop\fi\@nextwhile#2\@@#3{#4}}
+% 
+% \fbox is defined in latex.tex; so if \fbox is undefined, assume that
+% we are not in LaTeX.
+% Perhaps this could be done better???
+\ifx\undefined\fbox
+% \fbox code from modified slightly from LaTeX
+\newdimen\fboxrule
+\newdimen\fboxsep
+\newdimen\ps at tempdima
+\newbox\ps at tempboxa
+\fboxsep = 3pt
+\fboxrule = .4pt
+\long\def\fbox#1{\leavevmode\setbox\ps at tempboxa\hbox{#1}\ps at tempdima\fboxrule
+    \advance\ps at tempdima \fboxsep \advance\ps at tempdima \dp\ps at tempboxa
+   \hbox{\lower \ps at tempdima\hbox
+  {\vbox{\hrule height \fboxrule
+          \hbox{\vrule width \fboxrule \hskip\fboxsep
+          \vbox{\vskip\fboxsep \box\ps at tempboxa\vskip\fboxsep}\hskip 
+                 \fboxsep\vrule width \fboxrule}
+                 \hrule height \fboxrule}}}}
+\fi
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% file reading stuff from epsf.tex
+%   EPSF.TEX macro file:
+%   Written by Tomas Rokicki of Radical Eye Software, 29 Mar 1989.
+%   Revised by Don Knuth, 3 Jan 1990.
+%   Revised by Tomas Rokicki to accept bounding boxes with no
+%      space after the colon, 18 Jul 1990.
+%   Portions modified/removed for use in PSFIG package by
+%      J. Daniel Smith, 9 October 1990.
+%
+\newread\ps at stream
+\newif\ifnot at eof       % continue looking for the bounding box?
+\newif\if at noisy        % report what you're making?
+\newif\if at atend        % %%BoundingBox: has (at end) specification
+\newif\if at psfile       % does this look like a PostScript file?
+%
+% PostScript files should start with `%!'
+%
+{\catcode`\%=12\global\gdef\epsf at start{%!}}
+\def\epsf at PS{PS}
+%
+\def\epsf at getbb#1{%
+%
+%   The first thing we need to do is to open the
+%   PostScript file, if possible.
+%
+\openin\ps at stream=#1
+\ifeof\ps at stream\ps at typeout{Error, File #1 not found}\else
+%
+%   Okay, we got it. Now we'll scan lines until we find one that doesn't
+%   start with %. We're looking for the bounding box comment.
+%
+   {\not at eoftrue \chardef\other=12
+    \def\do##1{\catcode`##1=\other}\dospecials \catcode`\ =10
+    \loop
+       \if at psfile
+	  \read\ps at stream to \epsf at fileline
+       \else{
+	  \obeyspaces
+          \read\ps at stream to \epsf at tmp\global\let\epsf at fileline\epsf at tmp}
+       \fi
+       \ifeof\ps at stream\not at eoffalse\else
+%
+%   Check the first line for `%!'.  Issue a warning message if its not
+%   there, since the file might not be a PostScript file.
+%
+       \if at psfile\else
+       \expandafter\epsf at test\epsf at fileline:. \\%
+       \fi
+%
+%   We check to see if the first character is a % sign;
+%   if so, we look further and stop only if the line begins with
+%   `%%BoundingBox:' and the `(atend)' specification was not found.
+%   That is, the only way to stop is when the end of file is reached,
+%   or a `%%BoundingBox: llx lly urx ury' line is found.
+%
+          \expandafter\epsf at aux\epsf at fileline:. \\%
+       \fi
+   \ifnot at eof\repeat
+   }\closein\ps at stream\fi}%
+%
+% This tests if the file we are reading looks like a PostScript file.
+%
+\long\def\epsf at test#1#2#3:#4\\{\def\epsf at testit{#1#2}
+			\ifx\epsf at testit\epsf at start\else
+\ps at typeout{Warning! File does not start with `\epsf at start'.  It may not be a PostScript file.}
+			\fi
+			\@psfiletrue} % don't test after 1st line
+%
+%   We still need to define the tricky \epsf at aux macro. This requires
+%   a couple of magic constants for comparison purposes.
+%
+{\catcode`\%=12\global\let\epsf at percent=%\global\def\epsf at bblit{%BoundingBox}}
+%
+%
+%   So we're ready to check for `%BoundingBox:' and to grab the
+%   values if they are found.  We continue searching if `(at end)'
+%   was found after the `%BoundingBox:'.
+%
+\long\def\epsf at aux#1#2:#3\\{\ifx#1\epsf at percent
+   \def\epsf at testit{#2}\ifx\epsf at testit\epsf at bblit
+	\@atendfalse
+        \epsf at atend #3 . \\%
+	\if at atend	
+	   \if at verbose{
+		\ps at typeout{psfig: found `(atend)'; continuing search}
+	   }\fi
+        \else
+        \epsf at grab #3 . . . \\%
+        \not at eoffalse
+        \global\no at bbfalse
+        \fi
+   \fi\fi}%
+%
+%   Here we grab the values and stuff them in the appropriate definitions.
+%
+\def\epsf at grab #1 #2 #3 #4 #5\\{%
+   \global\def\epsf at llx{#1}\ifx\epsf at llx\empty
+      \epsf at grab #2 #3 #4 #5 .\\\else
+   \global\def\epsf at lly{#2}%
+   \global\def\epsf at urx{#3}\global\def\epsf at ury{#4}\fi}%
+%
+% Determine if the stuff following the %%BoundingBox is `(atend)'
+% J. Daniel Smith.  Copied from \epsf at grab above.
+%
+\def\epsf at atendlit{(atend)} 
+\def\epsf at atend #1 #2 #3\\{%
+   \def\epsf at tmp{#1}\ifx\epsf at tmp\empty
+      \epsf at atend #2 #3 .\\\else
+   \ifx\epsf at tmp\epsf at atendlit\@atendtrue\fi\fi}
+
+
+% End of file reading stuff from epsf.tex
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% trigonometry stuff from "trig.tex"
+\chardef\psletter = 11 % won't conflict with \begin{letter} now...
+\chardef\other = 12
+
+\newif \ifdebug %%% turn me on to see TeX hard at work ...
+\newif\ifc at mpute %%% don't need to compute some values
+\c at mputetrue % but assume that we do
+
+\let\then = \relax
+\def\r at dian{pt }
+\let\r at dians = \r at dian
+\let\dimensionless at nit = \r at dian
+\let\dimensionless at nits = \dimensionless at nit
+\def\internal at nit{sp }
+\let\internal at nits = \internal at nit
+\newif\ifstillc at nverging
+\def \Mess at ge #1{\ifdebug \then \message {#1} \fi}
+
+{ %%% Things that need abnormal catcodes %%%
+	\catcode `\@ = \psletter
+	\gdef \nodimen {\expandafter \n at dimen \the \dimen}
+	\gdef \term #1 #2 #3%
+	       {\edef \t@ {\the #1}%%% freeze parameter 1 (count, by value)
+		\edef \t@@ {\expandafter \n at dimen \the #2\r at dian}%
+				   %%% freeze parameter 2 (dimen, by value)
+		\t at rm {\t@} {\t@@} {#3}%
+	       }
+	\gdef \t at rm #1 #2 #3%
+	       {{%
+		\count 0 = 0
+		\dimen 0 = 1 \dimensionless at nit
+		\dimen 2 = #2\relax
+		\Mess at ge {Calculating term #1 of \nodimen 2}%
+		\loop
+		\ifnum	\count 0 < #1
+		\then	\advance \count 0 by 1
+			\Mess at ge {Iteration \the \count 0 \space}%
+			\Multiply \dimen 0 by {\dimen 2}%
+			\Mess at ge {After multiplication, term = \nodimen 0}%
+			\Divide \dimen 0 by {\count 0}%
+			\Mess at ge {After division, term = \nodimen 0}%
+		\repeat
+		\Mess at ge {Final value for term #1 of 
+				\nodimen 2 \space is \nodimen 0}%
+		\xdef \Term {#3 = \nodimen 0 \r at dians}%
+		\aftergroup \Term
+	       }}
+	\catcode `\p = \other
+	\catcode `\t = \other
+	\gdef \n at dimen #1pt{#1} %%% throw away the ``pt''
+}
+
+\def \Divide #1by #2{\divide #1 by #2} %%% just a synonym
+
+\def \Multiply #1by #2%%% allows division of a dimen by a dimen
+       {{%%% should really freeze parameter 2 (dimen, passed by value)
+	\count 0 = #1\relax
+	\count 2 = #2\relax
+	\count 4 = 65536
+	\Mess at ge {Before scaling, count 0 = \the \count 0 \space and
+			count 2 = \the \count 2}%
+	\ifnum	\count 0 > 32767 %%% do our best to avoid overflow
+	\then	\divide \count 0 by 4
+		\divide \count 4 by 4
+	\else	\ifnum	\count 0 < -32767
+		\then	\divide \count 0 by 4
+			\divide \count 4 by 4
+		\else
+		\fi
+	\fi
+	\ifnum	\count 2 > 32767 %%% while retaining reasonable accuracy
+	\then	\divide \count 2 by 4
+		\divide \count 4 by 4
+	\else	\ifnum	\count 2 < -32767
+		\then	\divide \count 2 by 4
+			\divide \count 4 by 4
+		\else
+		\fi
+	\fi
+	\multiply \count 0 by \count 2
+	\divide \count 0 by \count 4
+	\xdef \product {#1 = \the \count 0 \internal at nits}%
+	\aftergroup \product
+       }}
+
+\def\r at duce{\ifdim\dimen0 > 90\r at dian \then   % sin(x+90) = sin(180-x)
+		\multiply\dimen0 by -1
+		\advance\dimen0 by 180\r at dian
+		\r at duce
+	    \else \ifdim\dimen0 < -90\r at dian \then  % sin(-x) = sin(360+x)
+		\advance\dimen0 by 360\r at dian
+		\r at duce
+		\fi
+	    \fi}
+
+\def\Sine#1%
+       {{%
+	\dimen 0 = #1 \r at dian
+	\r at duce
+	\ifdim\dimen0 = -90\r at dian \then
+	   \dimen4 = -1\r at dian
+	   \c at mputefalse
+	\fi
+	\ifdim\dimen0 = 90\r at dian \then
+	   \dimen4 = 1\r at dian
+	   \c at mputefalse
+	\fi
+	\ifdim\dimen0 = 0\r at dian \then
+	   \dimen4 = 0\r at dian
+	   \c at mputefalse
+	\fi
+%
+	\ifc at mpute \then
+        	% convert degrees to radians
+		\divide\dimen0 by 180
+		\dimen0=3.141592654\dimen0
+%
+		\dimen 2 = 3.1415926535897963\r at dian %%% a well-known constant
+		\divide\dimen 2 by 2 %%% we only deal with -pi/2 : pi/2
+		\Mess at ge {Sin: calculating Sin of \nodimen 0}%
+		\count 0 = 1 %%% see power-series expansion for sine
+		\dimen 2 = 1 \r at dian %%% ditto
+		\dimen 4 = 0 \r at dian %%% ditto
+		\loop
+			\ifnum	\dimen 2 = 0 %%% then we've done
+			\then	\stillc at nvergingfalse 
+			\else	\stillc at nvergingtrue
+			\fi
+			\ifstillc at nverging %%% then calculate next term
+			\then	\term {\count 0} {\dimen 0} {\dimen 2}%
+				\advance \count 0 by 2
+				\count 2 = \count 0
+				\divide \count 2 by 2
+				\ifodd	\count 2 %%% signs alternate
+				\then	\advance \dimen 4 by \dimen 2
+				\else	\advance \dimen 4 by -\dimen 2
+				\fi
+		\repeat
+	\fi		
+			\xdef \sine {\nodimen 4}%
+       }}
+
+% Now the Cosine can be calculated easily by calling \Sine
+\def\Cosine#1{\ifx\sine\UnDefined\edef\Savesine{\relax}\else
+		             \edef\Savesine{\sine}\fi
+	{\dimen0=#1\r at dian\advance\dimen0 by 90\r at dian
+	 \Sine{\nodimen 0}
+	 \xdef\cosine{\sine}
+	 \xdef\sine{\Savesine}}}	      
+% end of trig stuff
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\def\psdraft{
+	\def\@psdraft{0}
+	%\ps at typeout{draft level now is \@psdraft \space . }
+}
+\def\psfull{
+	\def\@psdraft{100}
+	%\ps at typeout{draft level now is \@psdraft \space . }
+}
+
+\psfull
+
+\newif\if at scalefirst
+\def\psscalefirst{\@scalefirsttrue}
+\def\psrotatefirst{\@scalefirstfalse}
+\psrotatefirst
+
+\newif\if at draftbox
+\def\psnodraftbox{
+	\@draftboxfalse
+}
+\def\psdraftbox{
+	\@draftboxtrue
+}
+\@draftboxtrue
+
+\newif\if at prologfile
+\newif\if at postlogfile
+\def\pssilent{
+	\@noisyfalse
+}
+\def\psnoisy{
+	\@noisytrue
+}
+\psnoisy
+%%% These are for the option list.
+%%% A specification of the form a = b maps to calling \@p@@sa{b}
+\newif\if at bbllx
+\newif\if at bblly
+\newif\if at bburx
+\newif\if at bbury
+\newif\if at height
+\newif\if at width
+\newif\if at rheight
+\newif\if at rwidth
+\newif\if at angle
+\newif\if at clip
+\newif\if at verbose
+\def\@p@@sclip#1{\@cliptrue}
+
+
+\newif\if at decmpr
+
+%%% GDH 7/26/87 -- changed so that it first looks in the local directory,
+%%% then in a specified global directory for the ps file.
+%%% RPR 6/25/91 -- changed so that it defaults to user-supplied name if
+%%% boundingbox info is specified, assuming graphic will be created by
+%%% print time.
+%%% TJD 10/19/91 -- added bbfile vs. file distinction, and @decmpr flag
+
+\def\@p@@sfigure#1{\def\@p at sfile{null}\def\@p at sbbfile{null}
+	        \openin1=#1.bb
+		\ifeof1\closein1
+	        	\openin1=\figurepath#1.bb
+			\ifeof1\closein1
+			        \openin1=#1
+				\ifeof1\closein1%
+				       \openin1=\figurepath#1
+					\ifeof1
+					   \ps at typeout{Error, File #1 not found}
+						\if at bbllx\if at bblly
+				   		\if at bburx\if at bbury
+			      				\def\@p at sfile{#1}%
+			      				\def\@p at sbbfile{#1}%
+							\@decmprfalse
+				  	   	\fi\fi\fi\fi
+					\else\closein1
+				    		\def\@p at sfile{\figurepath#1}%
+				    		\def\@p at sbbfile{\figurepath#1}%
+						\@decmprfalse
+	                       		\fi%
+			 	\else\closein1%
+					\def\@p at sfile{#1}
+					\def\@p at sbbfile{#1}
+					\@decmprfalse
+			 	\fi
+			\else
+				\def\@p at sfile{\figurepath#1}
+				\def\@p at sbbfile{\figurepath#1.bb}
+				\@decmprtrue
+			\fi
+		\else
+			\def\@p at sfile{#1}
+			\def\@p at sbbfile{#1.bb}
+			\@decmprtrue
+		\fi}
+
+\def\@p@@sfile#1{\@p@@sfigure{#1}}
+
+\def\@p@@sbbllx#1{
+		%\ps at typeout{bbllx is #1}
+		\@bbllxtrue
+		\dimen100=#1
+		\edef\@p at sbbllx{\number\dimen100}
+}
+\def\@p@@sbblly#1{
+		%\ps at typeout{bblly is #1}
+		\@bbllytrue
+		\dimen100=#1
+		\edef\@p at sbblly{\number\dimen100}
+}
+\def\@p@@sbburx#1{
+		%\ps at typeout{bburx is #1}
+		\@bburxtrue
+		\dimen100=#1
+		\edef\@p at sbburx{\number\dimen100}
+}
+\def\@p@@sbbury#1{
+		%\ps at typeout{bbury is #1}
+		\@bburytrue
+		\dimen100=#1
+		\edef\@p at sbbury{\number\dimen100}
+}
+\def\@p@@sheight#1{
+		\@heighttrue
+		\dimen100=#1
+   		\edef\@p at sheight{\number\dimen100}
+		%\ps at typeout{Height is \@p at sheight}
+}
+\def\@p@@swidth#1{
+		%\ps at typeout{Width is #1}
+		\@widthtrue
+		\dimen100=#1
+		\edef\@p at swidth{\number\dimen100}
+}
+\def\@p@@srheight#1{
+		%\ps at typeout{Reserved height is #1}
+		\@rheighttrue
+		\dimen100=#1
+		\edef\@p at srheight{\number\dimen100}
+}
+\def\@p@@srwidth#1{
+		%\ps at typeout{Reserved width is #1}
+		\@rwidthtrue
+		\dimen100=#1
+		\edef\@p at srwidth{\number\dimen100}
+}
+\def\@p@@sangle#1{
+		%\ps at typeout{Rotation is #1}
+		\@angletrue
+%		\dimen100=#1
+		\edef\@p at sangle{#1} %\number\dimen100}
+}
+\def\@p@@ssilent#1{ 
+		\@verbosefalse
+}
+\def\@p@@sprolog#1{\@prologfiletrue\def\@prologfileval{#1}}
+\def\@p@@spostlog#1{\@postlogfiletrue\def\@postlogfileval{#1}}
+\def\@cs at name#1{\csname #1\endcsname}
+\def\@setparms#1=#2,{\@cs at name{@p@@s#1}{#2}}
+%
+% initialize the defaults (size the size of the figure)
+%
+\def\ps at init@parms{
+		\@bbllxfalse \@bbllyfalse
+		\@bburxfalse \@bburyfalse
+		\@heightfalse \@widthfalse
+		\@rheightfalse \@rwidthfalse
+		\def\@p at sbbllx{}\def\@p at sbblly{}
+		\def\@p at sbburx{}\def\@p at sbbury{}
+		\def\@p at sheight{}\def\@p at swidth{}
+		\def\@p at srheight{}\def\@p at srwidth{}
+		\def\@p at sangle{0}
+		\def\@p at sfile{} \def\@p at sbbfile{}
+		\def\@p at scost{10}
+		\def\@sc{}
+		\@prologfilefalse
+		\@postlogfilefalse
+		\@clipfalse
+		\if at noisy
+			\@verbosetrue
+		\else
+			\@verbosefalse
+		\fi
+}
+%
+% Go through the options setting things up.
+%
+\def\parse at ps@parms#1{
+	 	\@psdo\@psfiga:=#1\do
+		   {\expandafter\@setparms\@psfiga,}}
+%
+% Compute bb height and width
+%
+\newif\ifno at bb
+\def\bb at missing{
+	\if at verbose{
+		\ps at typeout{psfig: searching \@p at sbbfile \space  for bounding box}
+	}\fi
+	\no at bbtrue
+	\epsf at getbb{\@p at sbbfile}
+        \ifno at bb \else \bb at cull\epsf at llx\epsf at lly\epsf at urx\epsf at ury\fi
+}	
+\def\bb at cull#1#2#3#4{
+	\dimen100=#1 bp\edef\@p at sbbllx{\number\dimen100}
+	\dimen100=#2 bp\edef\@p at sbblly{\number\dimen100}
+	\dimen100=#3 bp\edef\@p at sbburx{\number\dimen100}
+	\dimen100=#4 bp\edef\@p at sbbury{\number\dimen100}
+	\no at bbfalse
+}
+% rotate point (#1,#2) about (0,0).
+% The sine and cosine of the angle are already stored in \sine and
+% \cosine.  The result is placed in (\p at intvaluex, \p at intvaluey).
+\newdimen\p at intvaluex
+\newdimen\p at intvaluey
+\def\rotate@#1#2{{\dimen0=#1 sp\dimen1=#2 sp
+%            	calculate x' = x \cos\theta - y \sin\theta
+		  \global\p at intvaluex=\cosine\dimen0
+		  \dimen3=\sine\dimen1
+		  \global\advance\p at intvaluex by -\dimen3
+% 		calculate y' = x \sin\theta + y \cos\theta
+		  \global\p at intvaluey=\sine\dimen0
+		  \dimen3=\cosine\dimen1
+		  \global\advance\p at intvaluey by \dimen3
+		  }}
+\def\compute at bb{
+		\no at bbfalse
+		\if at bbllx \else \no at bbtrue \fi
+		\if at bblly \else \no at bbtrue \fi
+		\if at bburx \else \no at bbtrue \fi
+		\if at bbury \else \no at bbtrue \fi
+		\ifno at bb \bb at missing \fi
+		\ifno at bb \ps at typeout{FATAL ERROR: no bb supplied or found}
+			\no-bb-error
+		\fi
+		%
+%\ps at typeout{BB: \@p at sbbllx, \@p at sbblly, \@p at sbburx, \@p at sbbury} 
+%
+% store height/width of original (unrotated) bounding box
+		\count203=\@p at sbburx
+		\count204=\@p at sbbury
+		\advance\count203 by -\@p at sbbllx
+		\advance\count204 by -\@p at sbblly
+		\edef\ps at bbw{\number\count203}
+		\edef\ps at bbh{\number\count204}
+		%\ps at typeout{ psbbh = \ps at bbh, psbbw = \ps at bbw }
+		\if at angle 
+			\Sine{\@p at sangle}\Cosine{\@p at sangle}
+	        	{\dimen100=\maxdimen\xdef\r at p@sbbllx{\number\dimen100}
+					    \xdef\r at p@sbblly{\number\dimen100}
+			                    \xdef\r at p@sbburx{-\number\dimen100}
+					    \xdef\r at p@sbbury{-\number\dimen100}}
+%
+% Need to rotate all four points and take the X-Y extremes of the new
+% points as the new bounding box.
+                        \def\minmaxtest{
+			   \ifnum\number\p at intvaluex<\r at p@sbbllx
+			      \xdef\r at p@sbbllx{\number\p at intvaluex}\fi
+			   \ifnum\number\p at intvaluex>\r at p@sbburx
+			      \xdef\r at p@sbburx{\number\p at intvaluex}\fi
+			   \ifnum\number\p at intvaluey<\r at p@sbblly
+			      \xdef\r at p@sbblly{\number\p at intvaluey}\fi
+			   \ifnum\number\p at intvaluey>\r at p@sbbury
+			      \xdef\r at p@sbbury{\number\p at intvaluey}\fi
+			   }
+%			lower left
+			\rotate@{\@p at sbbllx}{\@p at sbblly}
+			\minmaxtest
+%			upper left
+			\rotate@{\@p at sbbllx}{\@p at sbbury}
+			\minmaxtest
+%			lower right
+			\rotate@{\@p at sbburx}{\@p at sbblly}
+			\minmaxtest
+%			upper right
+			\rotate@{\@p at sbburx}{\@p at sbbury}
+			\minmaxtest
+			\edef\@p at sbbllx{\r at p@sbbllx}\edef\@p at sbblly{\r at p@sbblly}
+			\edef\@p at sbburx{\r at p@sbburx}\edef\@p at sbbury{\r at p@sbbury}
+%\ps at typeout{rotated BB: \r at p@sbbllx, \r at p@sbblly, \r at p@sbburx, \r at p@sbbury}
+		\fi
+		\count203=\@p at sbburx
+		\count204=\@p at sbbury
+		\advance\count203 by -\@p at sbbllx
+		\advance\count204 by -\@p at sbblly
+		\edef\@bbw{\number\count203}
+		\edef\@bbh{\number\count204}
+		%\ps at typeout{ bbh = \@bbh, bbw = \@bbw }
+}
+%
+% \in at hundreds performs #1 * (#2 / #3) correct to the hundreds,
+%	then leaves the result in @result
+%
+\def\in at hundreds#1#2#3{\count240=#2 \count241=#3
+		     \count100=\count240	% 100 is first digit #2/#3
+		     \divide\count100 by \count241
+		     \count101=\count100
+		     \multiply\count101 by \count241
+		     \advance\count240 by -\count101
+		     \multiply\count240 by 10
+		     \count101=\count240	%101 is second digit of #2/#3
+		     \divide\count101 by \count241
+		     \count102=\count101
+		     \multiply\count102 by \count241
+		     \advance\count240 by -\count102
+		     \multiply\count240 by 10
+		     \count102=\count240	% 102 is the third digit
+		     \divide\count102 by \count241
+		     \count200=#1\count205=0
+		     \count201=\count200
+			\multiply\count201 by \count100
+		 	\advance\count205 by \count201
+		     \count201=\count200
+			\divide\count201 by 10
+			\multiply\count201 by \count101
+			\advance\count205 by \count201
+			%
+		     \count201=\count200
+			\divide\count201 by 100
+			\multiply\count201 by \count102
+			\advance\count205 by \count201
+			%
+		     \edef\@result{\number\count205}
+}
+\def\compute at wfromh{
+		% computing : width = height * (bbw / bbh)
+		\in at hundreds{\@p at sheight}{\@bbw}{\@bbh}
+		%\ps at typeout{ \@p at sheight * \@bbw / \@bbh, = \@result }
+		\edef\@p at swidth{\@result}
+		%\ps at typeout{w from h: width is \@p at swidth}
+}
+\def\compute at hfromw{
+		% computing : height = width * (bbh / bbw)
+	        \in at hundreds{\@p at swidth}{\@bbh}{\@bbw}
+		%\ps at typeout{ \@p at swidth * \@bbh / \@bbw = \@result }
+		\edef\@p at sheight{\@result}
+		%\ps at typeout{h from w : height is \@p at sheight}
+}
+\def\compute at handw{
+		\if at height 
+			\if at width
+			\else
+				\compute at wfromh
+			\fi
+		\else 
+			\if at width
+				\compute at hfromw
+			\else
+				\edef\@p at sheight{\@bbh}
+				\edef\@p at swidth{\@bbw}
+			\fi
+		\fi
+}
+\def\compute at resv{
+		\if at rheight \else \edef\@p at srheight{\@p at sheight} \fi
+		\if at rwidth \else \edef\@p at srwidth{\@p at swidth} \fi
+		%\ps at typeout{rheight = \@p at srheight, rwidth = \@p at srwidth}
+}
+%		
+% Compute any missing values
+\def\compute at sizes{
+	\compute at bb
+	\if at scalefirst\if at angle
+% at this point the bounding box has been adjsuted correctly for
+% rotation.  PSFIG does all of its scaling using \@bbh and \@bbw.  If
+% a width= or height= was specified along with \psscalefirst, then the
+% width=/height= value needs to be adjusted to match the new (rotated)
+% bounding box size (specifed in \@bbw and \@bbh).
+%    \ps at bbw       width=
+%    -------  =  ---------- 
+%    \@bbw       new width=
+% so `new width=' = (width= * \@bbw) / \ps at bbw; where \ps at bbw is the
+% width of the original (unrotated) bounding box.
+	\if at width
+	   \in at hundreds{\@p at swidth}{\@bbw}{\ps at bbw}
+	   \edef\@p at swidth{\@result}
+	\fi
+	\if at height
+	   \in at hundreds{\@p at sheight}{\@bbh}{\ps at bbh}
+	   \edef\@p at sheight{\@result}
+	\fi
+	\fi\fi
+	\compute at handw
+	\compute at resv}
+
+%
+% \psfig
+% usage : \psfig{file=, height=, width=, bbllx=, bblly=, bburx=, bbury=,
+%			rheight=, rwidth=, clip=}
+%
+% "clip=" is a switch and takes no value, but the `=' must be present.
+\def\psfig#1{\vbox {
+	% do a zero width hard space so that a single
+	% \psfig in a centering enviornment will behave nicely
+	%{\setbox0=\hbox{\ }\ \hskip-\wd0}
+	%
+	\ps at init@parms
+	\parse at ps@parms{#1}
+	\compute at sizes
+	%
+	\ifnum\@p at scost<\@psdraft{
+		%
+		\special{ps::[begin] 	\@p at swidth \space \@p at sheight \space
+				\@p at sbbllx \space \@p at sbblly \space
+				\@p at sbburx \space \@p at sbbury \space
+				startTexFig \space }
+		\if at angle
+			\special {ps:: \@p at sangle \space rotate \space} 
+		\fi
+		\if at clip{
+			\if at verbose{
+				\ps at typeout{(clip)}
+			}\fi
+			\special{ps:: doclip \space }
+		}\fi
+		\if at prologfile
+		    \special{ps: plotfile \@prologfileval \space } \fi
+		\if at decmpr{
+			\if at verbose{
+				\ps at typeout{psfig: including \@p at sfile.Z \space }
+			}\fi
+			\special{ps: plotfile "`zcat \@p at sfile.Z" \space }
+		}\else{
+			\if at verbose{
+				\ps at typeout{psfig: including \@p at sfile \space }
+			}\fi
+			\special{ps: plotfile \@p at sfile \space }
+		}\fi
+		\if at postlogfile
+		    \special{ps: plotfile \@postlogfileval \space } \fi
+		\special{ps::[end] endTexFig \space }
+		% Create the vbox to reserve the space for the figure.
+		\vbox to \@p at srheight sp{
+		% 1/92 TJD Changed from "true sp" to "sp" for magnification.
+			\hbox to \@p at srwidth sp{
+				\hss
+			}
+		\vss
+		}
+	}\else{
+		% draft figure, just reserve the space and print the
+		% path name.
+		\if at draftbox{		
+			% Verbose draft: print file name in box
+			\hbox{\frame{\vbox to \@p at srheight sp{
+			\vss
+			\hbox to \@p at srwidth sp{ \hss \@p at sfile \hss }
+			\vss
+			}}}
+		}\else{
+			% Non-verbose draft
+			\vbox to \@p at srheight sp{
+			\vss
+			\hbox to \@p at srwidth sp{\hss}
+			\vss
+			}
+		}\fi	
+
+
+
+	}\fi
+}}
+\psfigRestoreAt
+\let\@=\LaTeXAtSign
+
+
+

Added: grass-addons/grass7/imagery/i.pr/doc/usage.tex
===================================================================
--- grass-addons/grass7/imagery/i.pr/doc/usage.tex	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/doc/usage.tex	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,608 @@
+\documentstyle[psfig,times]{article}
+
+\begin{document}
+\begin{center}
+  {\Large\em L'ambiente PR (Pattern Recognition)}
+\end{center}
+\vspace{1truecm}
+\noindent
+
+\section{i.pr\_training}
+Interfaccia grafica per estrazione di dati di training da mappe raster
+GRASS.  Data una lista di mappe (parametro map), di cui la prima
+verr\`{a} utilizzata per visualizzazione se non \`{e} settato il
+parametro vis\_map, l'utente cliccando sulla mappa selezioner\`{a}
+esempi di training che avranno dimensione rows $\times$ cols
+(parametri rows e cols rispettivamente).  Gli esempi selezionati
+saranno assegnati alla classe scelta in input dall'utente (parametro
+class) che dovr\`{a} essere un intero positivo progressivo.  Una
+procedura alternativa (e non grafica) \`{e} quella di dare in input al
+programma un file di siti GRASS (parametro site\_file) e il programma
+creer\`{a} gli esempi di training in corrispondenza dei siti stessi.
+La classe assegnata agli esempi sar\`{a} quella definita nel file di
+siti. L'output del programma \`{e} una serie di mappe raster di
+dimensione rows $\times$ cols il cui nome sar\`{a} del tipo {\em x\_y.z}
+dove {\em y} \`{e} il nome della mappe raster da cui \`{e} stata estratta,
+{\em z} un contatore mentre {\em x} sar\`{a} il nome di un file che
+verr\`{a} creato (parametro training) e che sar\`{a} come quello generato
+dalle seguenti chiamate:
+
+ESEMPIO: i.pr\_training map=ammcom,genesi rows=11 cols=11 training=AAA class=1
+
+ESEMPIO: i.pr\_training map=ammcom,genesi rows=11 cols=11 training=AAA class=2
+
+FILE: AAA
+
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+\begin{verbatim}
+Data type:
+GrassTraining
+Number of layers:
+2
+Label:
+AAA
+Data:
+Layer_1 Layer_2 Class   East    North   Rows    Cols    EW-res  NS-res
+AAA_ammcom.1    AAA_genesi.1    1       1657029  5072830  11      11      1.5       1.5
+AAA_ammcom.2    AAA_genesi.2    1       1657072  5072864  11      11      1.5        1.5
+AAA_ammcom.3    AAA_genesi.3    2       1657123  5072871  11      11      1.5        1.5
+AAA_ammcom.4    AAA_genesi.4    2       1657153  5072910  11      11      1.5        1.5
+\end{verbatim}
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+
+\subsection*{Help}
+\begin{verbatim}
+Usage:
+ i.pr_training map=name[,name,...] [vis_map=name] training=name
+   [vector=name] rows=value cols=value [class=value]
+
+Parameters:
+        map   Input raster maps (max 25) for extracting the training
+              examples.
+                The first one will be used for graphical output 
+                in case vis_map option not set
+    vis_map   Raster map for visualization.
+   training   Name of the output file containing the training raster 
+              maps.
+                If this file already exists, the new data will 
+                be appended to the end of the file.
+     vector   Name of the  site file containing labelled location.
+                Substitutes the interactive procedure of site selection.
+       rows   Number of rows (required odd) of the training samples.
+       cols   Number of columns (required odd) of the training samples.
+      class   Numerical label to be attached to the training examples.
+                Option not required with the vector option.
+\end{verbatim}
+
+\section{i.pr\_features}
+Processa dati di training ed estrae features. Dato un file di training
+in ingresso (paretro training) e che contiene il nome di mappe raster
+relative a layers differenti permette eleborare di normalizzare le
+mappa dei layers selezionati (parametro normalize) di calcolarne la
+media (parametro mean), la varianza (parametro variance). Inoltre per
+ogni layer selezionato permette di calcolare la componenti principali
+(parametro prin\_comp); il modello di componenti principali pu\`{o}
+essere calcolato su tutti i dati (default) oppure solo sui dati delle
+classi selezionate (parametro class\_pc). Inoltre permette di
+standardizzare le features estratte (parametro standardize); questo
+parametro non \`{e} collegato al numero di layers contenuti nel file di
+training ma \`{e} collegato al numero di features precedentemente
+calcolate. L'output del programma \`{e} un file (parametro features) come quello generato dalla seguente chiamata:
+
+ESEMPIO: i.pr\_features training=AAA features=BBB normalize=1 mean=1,2
+
+FILE BBB:
+
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+\begin{verbatim}
+#####################
+TRAINING: (AAA)
+#####################
+Type of data:
+1
+Number of layers:
+2
+Training dimensions:
+11      11
+EW-res  NS-res
+1.5        1.5
+#####################
+FEATURES:
+#####################
+normalize:
+1       1       1
+standardize:
+0
+mean:
+1       2       1       2
+variance:
+0
+pca:
+0
+Number of classes:
+2
+Classes:
+1       2
+Standardization values:
+NULL
+NULL
+Features dimensions:
+4       2
+Features:
+l1_mean l2_mean class
+1.000000        5.000000        1
+1.000000        5.000000        1
+1.000000        5.000000        2
+1.000000        5.000000        2
+\end{verbatim}
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+
+\noindent
+Se nessuna opearazione viene selezionata, le features estratte saranno i dati stessi.
+
+\noindent
+Il programma i.pr\_features permette di eseguire le stesse operazione
+su dati non GRASS, ovvero su una tabella di dati. Il formato dei dati
+deve essere come il seguente:
+
+FILE AAA:
+
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+\begin{verbatim}
+Data type:
+TableTraining
+Dimension:
+2
+Data:
+6.5     0.      1
+-6.5    -0.     -1
+6.3     1.2     1
+-6.3    -1.2    -1
+5.8     2.4     1
+-5.8    -2.4    -1
+\end{verbatim}
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+
+\noindent
+In questo caso i dati sono interpretati come singolo layer (quindi ad esempio se si setta mean=1, la feature estratta sar\`{a} la media dei dati).
+
+\noindent
+L'output sar\`{a} come il seguente:
+
+ESEMPIO: i.pr\_features training=AAA features=BBB mean=1
+
+FILE: BBB
+
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+\begin{verbatim}
+
+#####################
+TRAINING: (AAA)
+#####################
+Type of data:
+2
+Number of layers:
+1
+Training dimensions:
+1       2
+EW-res  NS-res
+0.000000        0.000000
+#####################
+FEATURES:
+#####################
+normalize:
+0
+standardize:
+0
+mean:
+1       1       1
+variance:
+0
+pca:
+0
+Number of classes:
+2
+Classes:
+1       -1
+Standardization values:
+NULL
+NULL
+Features dimensions:
+6     1
+Features:
+l1_mean class
+3.250000        1
+-3.250000       -1
+3.784850        1
+-3.784850       -1
+4.164670        1
+-4.164670       -1
+\end{verbatim}
+\noindent
+\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#\#
+
+\subsection*{Help}
+\begin{verbatim}
+Usage:
+ i.pr_features [-s] training=name[,name,...] features=name
+   [normalize=value[,value,...]] [mean=value[,value,...]]
+   [variance=value[,value,...]] [prin_comp=value[,value,...]]
+   [class_pc=value[,value,...]] [standardize=value[,value,...]]
+
+Flags:
+  -s   Print site file containing coordinates of examples and class labels
+        (from training data) into features option and exit.
+
+Parameters:
+     training   Input files (max 50) containing training data.
+                2 formats are currently supported:
+                1) GRASS_data (output of i.pr_training)
+                2) TABLE_data.
+     features   Name of the output file containing the features.
+    normalize   Numbers of the layers to be normalized.
+         mean   Numbers of the layers on which to compute the mean value.
+     variance   Numbers of the layers on which to compute the variance.
+    prin_comp   Numbers of the layers on which to compute the principal 
+                components.
+     class_pc   Classes of the data to be used for computing the 
+                principal components.
+                If not set, all the examples will be used.
+  standardize   Numbers of features to be standardize.
+                WARNING: not related to the number of layers.
+\end{verbatim}
+
+\section{i.pr\_statistics}
+Calcola statistiche sulle features. Dato un file di features in input
+(parametro features), calcola kolgomorov-smirnov test e t\-test per
+ogni classe di ogni features. Se nelle features sono presenti
+componenti principali, calcola la varianza spiegata da esse. Se ci
+sono pi\`{u} modelli di componenti principali (per pi\`{u} layers),
+l'analisi viene eseguita solo su un layer (parametro layer). Il
+parametro npc serve per limitare l'analissi alle prime npc componenti
+princiapli.
+
+\begin{verbatim}
+Usage:
+ i.pr_statistics features=name [layer=value] [npc=value]
+
+Parameters:
+  features   Input file containing the features (output of i.pr_features).
+     layer   Number of the layer to be analized (concerning with the 
+             principal components).
+                Ignored if features does not contain principal 
+                components model.
+             default: 1
+       npc   Number of principal components to be analized.
+                If this number is greater then the dimension of the data,
+                all the principal components will be considered.
+                Ignored if features does not contain principal 
+                components model.
+\end{verbatim}
+
+\section{i.pr\_model}
+Crea modello di classificazione a partire da file di features. Il tipo
+di modello creato viene scelto settando uno dei flag g (gaussian mixture) n (nearest
+neighbor) t (classification trees) s (support vector machines). Ci
+sono poi dei parametri generali come il file delle features (parametro
+features), il nome del file prodotto e contenente il modello
+(parametro model), il nome di un file di features addizioanle sul
+quale calcolare dei valori di predizione durante la fase di training
+(parametro validation), il nome di un file di features addizioanle sul
+quale calcolare dei valori di predizione oltre al training set
+(parametro test) e il numero di componenti principali da utilizzare
+nel modello (parametro npc) se queste sono presenti nelle features.
+Poi ci sono parametri modello specifici. Nessuno per la gaussian
+mixture. Il numero di neighbors per nearest neighbor (parametro
+nn\_k), anche se questo parametro serve solo per la valutazione del
+modello in quando il modello di per s\`{e} sono i dati stessi. Per i
+classification trees si pu\`{o} decidere se fare alberi ad un solo
+nodo (stamps) o no (parametro tree\_stamps), oppure decidere quanti
+dati deve contenere almeno un nodo per essere splittato (parametro
+tree\_minsize). Inoltre il parametro tree\_costs permette di
+sbilanciare le classi (stile rpart). Per le support vector machines
+l'utente deve settare il tipo di kernel (parametro svm\_kernel, che
+pu\'o assumere i valori linear gaussian e 2pbk), l'ampiezza del kernel
+in caso sia gaussiano (parametro (svm\_kp), il parametro di
+regolarizzazione (svm\_C), i parametri di convergenza svm\_eps,
+svm\_tolerance e svm\_maxloops. Si suggereisce di non modificare i
+primi due mentre il numero massimo di loop di ottimizazione pu\`{o}
+essere modificato (sempre con cura). Per le support vector machines si
+pu\`{o} decidere di calcolare una stima del leave-one-out model error
+utilizzando il paramtro svm\_l1o. L'output della procedura \`{e} un
+file che contiene il modello selezionato. A standard output verranno
+descritte le prestazioni del modello sul training set e opzionalmente
+su un test set. Per le support vector machines opzionalmente anche una
+stima di cross-validation. Per i modelli classification trees e
+support vecor machines sono disponibili anche combinazioni di modelli
+(bagging e boosting). Il numero di modelli \`{e} scelto dall'utente
+(parametri bagging e boosting rispettivamente). Per il boosting \`{e}
+disponibile anche la versione cost-sensitive, il cui parametro \`{e}
+cost\_boosting. Se si usa boosting, \'e possibile ottenere la dinamica
+dei pesi boosting utilizzando il parametro weights\_boosting. Sempre
+per boosting di trees \`e possibile sviluppare (il tutto \'e
+sperimentale) la versione soft del modello con il parametro
+soft\_margin\_boosting. Una versione cost-sensitive per la support
+vector machine singola \`e ottenibile utilizzando il parametro
+svm\_cost. 
+\`E possibile inoltre utilizzare una versione regolarizzata dell'algoritmo
+AdaBoost specificando il numero di intervalli (parametro reg) in cui
+suddividere il misclassification ratio (quindi il numero di 
+training set generati), in questo caso il validation set \`e indispnsabile, in 
+alternativa \`e possibile scegliere manualmente il valore di misclassification 
+ratio al disopra del quale i campioni vengono eliminati dal training set 
+(parametro misclass\_ratio).
+Per alcuni modelli sono implementate solo classificazione
+binarie in accordo al seguente prospetto:
+
+\noindent
+gaussian mixture: multiclasse
+
+\noindent
+nearest neighbor: multiclasse
+
+\noindent
+classification trees: multiclasse
+
+\noindent
+support vector machines: binaria
+
+\noindent
+bagging classification trees: multiclasse
+
+\noindent
+boosting classification trees: binaria
+
+\noindent
+bagging support vector machines: binaria
+
+\noindent
+boosting support vector machines: binaria
+
+\subsection*{Help}
+\begin{verbatim}
+Usage:
+ i.pr_model [-gtsn] features=name model=name [validation=name]
+   [test=name] [npc=value] [bagging=value] [boosting=value] [reg=value]
+   [misclass_ratio=value] [reg_verbose=value] [progressive_error=value]
+   [cost_boosting=value] [weights_boosting=value] [parallel_boosting=value]
+   [soft_margin_boosting=value] [tree_stamps=value] [tree_minsize=value]
+   [tree_costs=value[,value,...]] [svm_kernel=name] [svm_kp=value]
+   [svm_C=value] [svm_cost=value] [svm_tol=value] [svm_eps=value]
+   [svm_l1o=value] [svm_maxloops=value] [svm_verbose=value] [nn_k=value]
+
+Flags:
+  -g   selected model: gaussian mixture.
+  -t   selected model: classification trees.
+  -s   selected model: support vector machines.
+  -n   selected model: nearest neighbor.
+
+Parameters:
+              features   Input file containing the features 
+                         (output of i.pr_features).
+                 model   Name of the output file containing the model.
+            validation   Input file containing other features for the 
+                         training and for the evaluation of the performances 
+                         of the model on an independent test set 
+                         (for regularized AdaBoost).
+                  test   Input file containing other features for the 
+                         evaluation of the performances of the model 
+                         on an independent test set.
+                   npc   Number of the principal components to be used 
+                         for the model development.
+                         If not set all the principal components 
+                         will be used.
+                         Ignored if features does not contain 
+                         principal  components model.
+               bagging   Number of bagging models.
+                         If bagging = 0 the classical model will
+                         be implemented.
+                         Implemented for trees and svm only.
+                         default: 0
+              boosting   Number of boosting models.
+                         If boosting = 0 the classical model will 
+                         be implemented.
+                         Implemented for trees and svm only.
+                         default: 0
+                   reg   Number of misclassification ratio intervals.
+                         default: 0
+        misclass_ratio   For regularized AdaBoost: misclassification ratio 
+                         for hard point shaving and compute the new model.
+                         default: 1.00
+           reg_verbose   For regularized AdaBoost:
+                         - if it is set = 1 the current value of 
+                           misclassification ratio and the current 
+                           error will be printed.
+                         - if it is set to >1 the number of
+                           loops, accuracy and the current value of 
+                           misclassification ratio will be printed.
+                         For shaving and compute:
+                         - if it is set >0 the numbers of samples 
+                           shaved will be printed.
+                         default: 0
+     progressive_error   Progressive estimate of the model error
+                         increasing the number of aggregated models
+                         options: 0,1
+                         default: 0
+         cost_boosting   Cost parameter for the implementation of 
+                         cost-sensitive procedure(w in [0,2]).
+                         w>1 results higher weight on examples of class 1.
+                         w<1 results higher weight on examples of class -1.
+                         w=1 corresponds to standard Adaboost.
+                         default: 1.0
+      weights_boosting   For boosting: if weights_boosting = 1, a file 
+                         containing the evolution of the weights associated 
+                         to data points will be produced.
+                         options: 0,1
+                         default: 0
+     parallel_boosting   For boosting: number of true boosting steps for 
+                         parallel boosting.
+                         Implemented only for trees!!
+                         default: 0
+  soft_margin_boosting   For boosting: if soft_margin_boosting = 1, 
+                         sof margin of Ababoost will bee used. 
+                         Implemented only with trees. (Sperimental!!!!!!!!)
+                         options: 0,1
+                         default: 0
+           tree_stamps   For trees: if tree_stamps = 1, a single split 
+                         tree will be procuded, if tree_stamps = 0, 
+                         a classical tree will be procuded.
+                         options: 0,1
+                         default: 0
+          tree_minsize   For trees: minimum number of examples containined
+                         into a node for splitting the node itself
+                         default: 0
+            tree_costs   For trees: misclassification costs for each class
+            svm_kernel   For svm: type of employed kernel.
+                         options: gaussian,linear,2pbk
+                         default: linear
+                svm_kp   For svm: kernel parameter (Required parameter if 
+                         you are using gaussian kernel).
+                 svm_C   For svm: optimization parameter (Required parameter).
+              svm_cost   Cost parameter for the implementation of 
+                         cost-sensitive procedure(w in [-1,1]).
+                         w>0 results higher weight on examples of class 1.
+                         w<0 results higher weight on examples of class -1.
+                         w=0 corresponds to standard SVM.
+                         Not yet implemented (and may be it will be 
+                         never implemented) for bagging and boosting.
+                         default: 0.0
+               svm_tol   For svm: tollerance parameter.
+                         default: 0.001
+               svm_eps   For svm: epsilon.
+                         default: 0.001
+               svm_l1o   For svm: leave 1 out error estimate.
+                         options: 0,1
+                         default: 0
+          svm_maxloops   For svm: maximum number of optimization steps.
+                         default: 1000
+           svm_verbose   For svm: if it is set to 1 the number of loops will 
+                         be printed.
+                         options: 0,1
+                         default: 0
+                  nn_k   For nn: Number of neighbor to be considered during 
+                         the test phase.
+                         default: 1
+\end{verbatim}
+
+
+\section*{i.pr\_classify}
+Classifica mappe raster GRASS sulla base di un modello di
+classificazione. Dato un numero di mappe raster GRASS in input
+(parametr input\_map) in cui l'ordine deve essere lo stesso utilizzato
+per l'estrazione di dati di training(!!!!), ed un modello di
+classificazione (parametro model), viene prodotta una mappa raster
+GRASS contenente il risultato della classifcazione.
+
+Valori della mappa per tipo di modello:
+
+\noindent
+gaussian mixture binaria: probabilit\`{a} a posteriori della classe pi\`{u} probabile moltiplicata per la classe stessa $\{-1,1\}$
+
+\noindent
+gaussian mixture multiclasse: classe pi\`{u} probabile
+
+\noindent
+nearest neighbor binaria: proporzione di dati della classe pi\`{u} probabile moltiplicata per la classe stessa $\{-1,1\}$
+
+\noindent
+nearest neighbor multiclasse: classe pi\`{u} probabile
+
+\noindent
+classification trees binaria: proporzione di dati della classe pi\`{u} probabile nel nodo terminale moltiplicata per la classe stessa $\{-1,1\}$
+
+\noindent
+classification trees multiclasse: classe pi\`{u} probabile
+
+\noindent
+support vector machines binaria: output della support vector machine stessa $(-\infty,\infty)$
+
+\noindent
+bagging classification trees multiclasse: classe pi\`{u} probabile
+
+\noindent
+bagging classification trees binaria: somma pesata di modelli $(-1,1)$
+
+\noindent
+boosting classification trees (solo binaria): somma pesata di modelli $(-1,1)$
+
+\noindent
+bagging support vector machines (solo binaria): somma pesata di modelli $(-1,1)$
+
+\noindent
+boosting support vector machines(solo binaria) : somma pesata di modelli $(-1,1)$
+
+\subsection*{Help}
+\begin{verbatim}
+Usage:
+ i.pr_classify input_map=name[,name,...] model=name output_map=name
+
+Parameters:
+   input_map   Input raster maps to be classified.
+                It is required a number of maps at least equal to the number 
+                of maps used for the training. If this number is greater 
+                the last maps will be ignored.
+                WARNING: the order in which the maps are given should 
+                be compared  with that used for the training.
+       model   Input file containing the model (output of i .pr_model).
+                If the data used for model development are not GRASS_data 
+                the program will abort.
+  output_map   Name of the output raster map conaining the resulting 
+               classification.
+\end{verbatim}
+
+
+\section*{i.pr\_subsets}
+Crea features file per esperimenti a partire da un file di features
+(opzione features) implementando cross-validation (flag c) o bootstrap
+resampling (flag b). L'opzione n\_sets setta il numero di bootstap
+subsets o il numero di folder per cross-validation. L'opzione seed permette di creare insiemi differenti.
+
+\subsection*{Help}
+\begin{verbatim}
+Usage:
+ i.pr_subsets [-cb] features=name n_sets=value seed=value
+
+Flags:
+  -c   selected method: cross-validation.
+  -b   selected method: bootstrap.
+
+Parameters:
+  features   Input file containing the features (output of i.pr_features).
+    n_sets   Number of subsets (>=1). If you set n_sets=1 and select 
+             cross-validation, leave one out cv will be implemented.
+      seed   Seed for the initialization (>=0), which specifies a 
+             starting point for the random number sequence. Replicate
+             same experiment.
+             default: 0
+\end{verbatim}
+
+\section*{i.pr\_features\_additional}
+Dato un file di features (opzione features) applica le regole che
+hanno creato quelle features a una lista di training files (opzione
+training) e crea da questi un nuovo file di features (opzione
+features\_out).
+
+\subsection*{Help}
+\begin{verbatim}
+Usage:
+ i.pr_features_additional training=name[,name,...] features=name
+   features_out=name
+
+Parameters:
+      training   Input files (max 50) containing training data.
+                2 formats are currently supported:
+                1) GRASS_data (output of i.pr_training)
+                2) TABLE_data.
+      features   Name of the input file containing the features.
+  features_out   Name of the output file containing the features.
+\end{verbatim}
+\end{document}
+
+

Added: grass-addons/grass7/imagery/i.pr/doc/usage_EN.txt
===================================================================
--- grass-addons/grass7/imagery/i.pr/doc/usage_EN.txt	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/doc/usage_EN.txt	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,204 @@
+[machine translated from usage.txt - please revise and update]
+
+Environment PR (Pattern Recognition)
+
+i.pr.training
+Graphical interface for extracting data from training raster maps
+GRASS. Given a list of maps (parameter map), where the first
+Viewing will be used if not set the
+parameter vismap, you select by clicking on the map
+Examples of training that will dimension rows cols
+(Parameters and rows cols respectively). The examples selected
+Class will be assigned to input by choice (parameter
+Class), which must be a positive integer progressive. A
+An alternative procedure (and not graphic) and to give input to
+a program files sites GRASS (parameter sitefile) and the program
+Examples will create training at the same sites.
+The class will be assigned to the examples described in the file
+sites. The output of the program and a series of maps of raster
+Cols dimension rows whose name will be the type xy.z
+Ye where the name of the raster maps from which was extracted,
+Z while a meter x will be the name of a file that
+will created (parameter training) and that will be generated as the
+
+The following calls:
+EXAMPLE: i.prtraining map = ammcom, genesis rows = 11 cols = 11 training class AAA = = 1
+EXAMPLE: i.prtraining map = ammcom, genesis rows = 11 cols = 11 training class AAA = = 2
+FILE: AAA
+
+
+* Help
+
+i.pr.features
+Process data and extracts training features. Given a training file
+Input (paretro training), which contains the name of raster maps
+Relating to different layers allows eleborare of normalizing
+Map of selected layers (normalize parameter) to calculate the
+Average (mean parameter), the variance (parameter variance). In addition to
+Each layer selected allows to calculate the main components
+(Parameter princomp), the main component model can
+Be calculated on all data (default) or only on data
+Selected classes (parameter classpc). Whether you
+Standardize features extracted (parameter standardize); this
+Parameter is not linked to the number of layers in files
+But training and linked to the number of features previously
+Calculated. The output of the program and a file (parameter features)
+such as that generated by the following call:
+EXAMPLE: i.prfeatures training features = = AAA BBB normalize = 1 mean = 1.2
+FILE BBB:
+
+If none opearazione is selected, the features extracted will be the same.
+
+The program i.prfeatures can perform the same operation
+Data not GRASS, or on a table of data. The format of the data
+Must be like the following:
+FILE AAA:
+
+
+In this case the data are interpreted as a single layer (so for
+example if you sect mean = 1, the extracted feature will be the
+average of data).
+
+The output will be as follows:
+EXAMPLE: i.prfeatures training features = = AAA BBB mean = 1
+FILE: BBB
+* Help
+
+
+i.pr.statistics
+Calculate statistics features. Given a file input features
+(Parameter features), and calculates kolgomorov-smirnov test for ttest
+Each class features of each. If the features are present
+Main components, calculates the variance explained by them. If there
+Most models are main components (for more layers)
+The analysis is performed on a single layer (layer parameter). The
+Parameter npc serves to limit the analissi the first npc components
+Princiapli.
+
+i.pr.model
+Create a classification model from file features. The type
+Model design is chosen setting of a flag g (gaussian mixture) n (nearest
+Neighbor) t (classification trees) s (support vector machines). We
+Then the general parameters such as file features (parameter
+Features), the name of the file containing the model
+(Parameter model), the name of a file features addizioanle on
+For calculating the values of prediction during training
+(Parameter validation), the name of a file features addizioanle on
+For calculating the values of prediction in addition to training in September
+(Parameter test) and the number of principal components to be used
+In the model (parameter npc) if they are in features.
+Then there are specific model parameters. None the gaussian
+Mixture. The number of nearest neighbors for neighbor (parameter
+Nnk), even if this parameter is used only for the assessment of
+In model when the model itself are the same. For
+Classification trees can decide whether to make a single trees
+Node (stamps) or no (parameter treestamps), or decide how many
+Data must contain at least one node to be splitted (parameter
+Treeminsize). Furthermore, the parameter treecosts allows
+Unbalancing classes (style rpart). For support vector machines
+The user must set the type of kernel (parameter svmkernel,
+It can take the values linear gaussian and 2pbk) and the scale of the kernel
+If both Gaussian (parameter (svmkp), the parameter
+Regularization (svmC), the convergence svmeps,
+Svmtolerance and svmmaxloops. It suggereisce not change
+The first two while the maximum number of loops ottimizazione can
+Be amended (with care). For support vector machines are
+It can decide to calculate an estimate of leave-one-out model error
+Using paramtro svml1o. The output of the procedure and
+Files containing the model selected. A standard output will be
+Describing the performance of the model on the training set and optionally
+On a test in September. For support vector machines also optionally
+Estimated cross-validation. For models classification trees and
+Support vecor machines are also available combinations of models
+(Bagging and boosting). The number of models and choice
+(Parameters bagging and boosting respectively). For the boosting and
+Also available version cost-sensitive, whose parameter and
+Costboosting. If you use boosting, and may be obtained dynamic
+Weight boosting using parameter weightsboosting. Always
+For boosting the trees and can be developed (and all
+Experimental) soft version of the model with parameter
+Softmarginboosting. A version cost-sensitive for support
+Single vector machine and accomplished using the parameter
+Svmcost.
+It can also use a version regularized dell'algoritmo
+AdaBoost specifying the number of intervals (reg parameter) where
+Divide the misclassification ratio (the number of
+Training in September generated), in which case the validation set and
+indispensabile,
+Alternatively it is possible to manually select the value of misclassification
+Ratio above which the samples are removed from training in September
+(Parameter misclassratio).
+Some models are required for classification
+Binary according to the following schedule:
+
+Gaussian mixture: multiclasse
+
+Nearest neighbor: multiclasse
+
+Classification trees: multiclasse
+
+Support vector machines: binary
+
+Bagging classification trees: multiclasse
+
+Boosting classification trees: binary
+
+Bagging support vector machines: binary
+
+Boosting support vector machines: binary
+* Help
+
+
+
+* i.pr.classify
+Goal GRASS raster maps on the basis of a model
+Classification. Given a number of raster maps GRASS input
+(Parametr inputmap) in which the order must be the same used
+For extracting data training (!!!!), and a model
+Classification (parameter model), produced a map raster
+GRASS containing the result of classifcazione.
+Map values by type of model:
+
+Gaussian mixture binary probability post class most likely multiplied
+by the same class
+
+Gaussian mixture multiclasse: class most likely
+
+Nearest neighbor binary data proportion of the class most likely
+multiplied by the same class
+
+Nearest neighbor multiclasse: class most likely
+
+Classification trees binary data proportion of the class most likely
+in the terminal node multiplied by the same class
+
+Classification trees multiclasse: class most likely
+
+Support vector machines binary output of the support vector machine itself
+
+Bagging classification trees multiclasse: class most likely
+
+Bagging classification trees binary weighted sum of models
+
+Boosting classification trees (binary): Total weighing models
+
+Bagging support vector machines (binary): Total weighing models
+
+Boosting support vector machines (binary): Total weighing models
+* Help
+
+* i.pr.subsets
+Features Create files for experiments starting from a file features
+(Optional features) implementing cross-validation (c flag) or bootstrap
+Resampling (b flag). The option nsets sect number bootstap
+Subsets or the number of folder for cross-validation. The seed option
+allows you to create different sets.
+
+* Help
+
+* i.pr.featuresadditional
+Given a file features (optional features) apply the rules
+Those features have created a list of training files (option
+Training) and by creating a new file these features (option
+Featuresout).
+* Help

Added: grass-addons/grass7/imagery/i.pr/i.pr_blob/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_blob/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_blob/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.blob
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_blob/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_classify/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_classify/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_classify/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.classify
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_classify/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_features/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_features/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_features/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.features
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_features/description.html
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_features/description.html	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_features/description.html	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,20 @@
+<h2>DESCRIPTION</h2>
+
+<em>i.pr.features</em> This module is used to preprocess and extract the training features. It is necessary to specify the training file, which contains the names of the raster maps (explanatory variables) to be used in subsequent modules. The training file can either be the output from from <em><a href="i.pr.training.html">i.pr.training</a></em> (Recommended) or an ascii file containing the names of rasters.  
+<p>
+This module allows for the calculation of a range of statistics pertaining to the explanatory variables, which include the mean and variance. In addition the features can be normalized to a similar scale. In each case, it is possible to specify the numbers of features for which these statistics should be computed (i.e. number in list). There is also the possibility to compute principal components for the explanatory variables. The default calculates them for all layers, or else only on selected classes specified by 'class_pc'. Variables can be standardised using parameter 'standardize', this is linked to the features previously calculated and not layers in the training file. 
+
+<h2>NOTES</h2>
+
+
+<h2>SEE ALSO</h2>
+
+<em><a href="i.pr.training.html">i.pr.training</a></em><br>
+<em><a href="i.pca.html">i.pca</a></em><br>
+
+<h2>AUTHORS</h2>
+
+Stefano Merler, FBK, Trento, Italy<br>
+Documentation: Daniel McInerney (daniel.mcinerney ucd.ie)
+<p>
+<p><i>Last changed: $Date: 2011-11-08 22:56:45 +0100 (Tue, 08 Nov 2011) $</i>

Added: grass-addons/grass7/imagery/i.pr/i.pr_features/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_features_additional/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_features_additional/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_features_additional/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.features_additional
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_features_additional/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_features_extract/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_features_extract/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_features_extract/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.features_extract
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_features_extract/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_features_selection/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_features_selection/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_features_selection/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.features_selection
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_features_selection/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_model/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_model/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_model/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.model
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_model/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = $(VECT_CFLAGS) -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.sites_aggregate
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_sites_aggregate/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_statistics/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_statistics/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_statistics/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.statistics
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_statistics/cell.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_statistics/localproto.h
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_statistics/localproto.h	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_statistics/localproto.h	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,2 @@
+/* cell.c */
+int Dcell(char *, char *, int);

Added: grass-addons/grass7/imagery/i.pr/i.pr_statistics/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_subsets/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_subsets/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_subsets/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.subsets
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_subsets/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_subsets/old/main_orig.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_subsets/old/main_orig_2.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.training
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_training/conv.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/defs.h
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/defs.h	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/defs.h	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,18 @@
+#include <grass/imagery.h>
+
+/* this is a graphics structure */
+typedef struct
+{
+    int top, bottom, left, right;
+    int nrows, ncols;
+    struct
+    {
+	int configured;
+	struct Cell_head head;
+	struct Colors colors;
+	char name[100];
+	char mapset[100];
+	int top, bottom, left, right;
+	double ew_res, ns_res;	/* original map resolution */
+    } cell;
+} View;

Added: grass-addons/grass7/imagery/i.pr/i.pr_training/description.html
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/description.html	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/description.html	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,88 @@
+<h2>NAME</h2>
+<em><b>i.pr.training</b></em>  - Module to generate the training samples for use in i.pr.* modules. i.pr: Pattern Recognition environment for image processing. Includes <i>k</i>NN, Decision Tree and SVM classification techniques. Also includes cross-validation and bagging methods for model validation. 
+<h2>SYNOPSIS</h2>
+<b>i.pr.training</b>
+<b>i.pr.training</b> <b>map</b>=<em>string</em>[,<i>string</i>,...] [<b>vis_map</b>=<em>string</em>]  <b>training</b>=<em>string</em> [<b>site_file</b>=<em>string</em>] <b>rows</b>=<em>value</em> <b>cols</b>=<em>value</em> [<b>class</b>=<em>value</em>] [<b>--verbose</b>] [<b>--quiet</b>]  
+
+
+<h3>Flags:</h3>
+<dl>
+<dd><b>Flags:</b></dd>
+<dd>--v	Verbose module output</dd>
+<dd>--q Quiet module output</dd>
+</dl>
+
+<h3>Parameters:</h3>
+<dl>
+<dt><b>input</b>=<em>string[,<i>string</i>,...]</em>
+<dd>Input raster maps (max 25) for extracting the training examples. The first one will be used for graphical output, where 'vis_map' is specified</dd>
+
+<dt><b>vis_map</b>=<em>string</em>
+<dd>Raster Map for visualisation</dd>
+
+<dt><b>training</b>=<em>string</em>
+<dd>Name of the output file containing the training raster maps. If this file already exists, the new data will be appended to the end of the file.<dd>
+
+<dt><b>site_file</b>=<em>string</em>
+<dd>Name of the site file containing the labelled location. Typically a point vector layer or polygon centroids</dd>
+
+<dt><b>rows</b>=<em>value</em>
+<dd>Number of rows (required odd) of the training samples</dd>
+
+<dt><b>cols</b>=<em>value</em>
+<dd>Number of columns (required odd) of the training samples</dd>
+
+<dt><b>class</b>=<em>value</em>
+<dd>Numerical label to be attached to the training examples. Option not required with the site_file option.</dd>
+</dl>
+<h2>DESCRIPTION</h2>
+
+
+<em>i.pr.training</em> This module is the first to be run when using i.pr.* modules. It is necessary to list all maps that will be used as explanatory variables and whose values will be assigned to the training samples. Two options for extracting data for the training samples are available. The first can be done interactively using the graphical interface. In this instance, the first GRASS raster map specified in the list is visualised in the GRASS monitor, however, this can be altered by specifying the 'vis_map' option. In this case, the user must digitise locations training samples in the GRASS monitor. A Class parameter will be assigned to each training sample, the class labels must be positive integers and must progressively increase. 
+<pr>
+The second option for generating the training sample file can be done non-interactively. This is done by specifying a GRASS sites file. This file should represent the locations of training samples and ought to have been previously generated either by digitising (<em><a href="v.digit">v.digit</a></em>) or else by <em><a href="v.in.ascii">v.in.ascii</a></em>. Features will be extracted for these locations in a similar fashion as previously described. The class will be assigned to the examples based on the information stored in the sites file. 
+<p>
+The output of this module will be an ascii file of type xy.z. The number of columns will relate to the number of rasters specified on the command line. If the output file already exists, the new data values will be appended to it. 
+
+<h3>Flags:</h3>
+<dl>
+<dd><b>--v</b>	Verbose module output. Print information pertaining to module progress and completion.</dd>
+<dd><b>--p</b>	Run Quietly. Suppress program output that would include program percent complete messages and time elapsed.</dd>
+<h3>Parameters:</h3>
+
+
+<dt><b>input=</b><em>name,name</em>[<em>,name,name</em>,...]</dt> 
+<dd>Name of raster maps (maximum 25) for extracting the training examples. The first will be used for graphical output. The extent of all raster maps should be the same. CELL, DCELL and FCELL raster maps can be used. </dd>
+
+
+<dt><b>vis_map</b><em>name</em> 
+<dd>This parameter is optional. If used, the raster that is specified will be displayed in the GRASS monitor and used as a background raster file. It should be used to identify the location of training samples.</dd> 
+
+<dt><b>training=</b><em>name</em> 
+<dd>This parameter is required. It creates the training file, which is an ascii file containing all of the x,y locations of the traning samples and their associated class labels and values from the explanatory variables (GRASS raster maps). If the name specified on the command line refers to a training file that already exists in the working directory, the new data are appended to it. </dd> 
+
+<dt><b>site_file=</b><em>name</em> 
+<dd>This parameter is required if the non-interactive mode is required. It should relate to a GRASS Vector map (Version 6 vector data) and there should be a class label (numeric value) for each site. This file should be created prior to running i.pr.training either using v.digit or v.in.ascii. The latter is more straightforward provided the input ascii file contains data in the following format: x,y,z(class label). 
+</dd>
+
+<dt><b>rows=</b><em>value</em> 
+<dd>The number of rows in the training samples, this must be odd.</dd>
+<dt><b>cols=</b><em>value</em> 
+<dd>The number of colums in the training samples, this must be odd.</dd>
+
+<dt><b>class=</b><em>value</em> 
+<dd>The numerical label to be attached to the training examples. This is only required when the interactive mode of i.pr.training is used. </dd>
+
+<h2>NOTES</h2>
+
+
+<h2>SEE ALSO</h2>
+
+<em><a href="i.features.html">i.cca</a></em><br>
+
+<h2>AUTHORS</h2>
+
+Stefano Merler, FBK, Trento, Italy<br>
+Documentation: Daniel McInerney (daniel.mcinerney ucd.ie)
+
+<p><i>Last changed: $Date: 2011-11-08 22:56:45 +0100 (Tue, 08 Nov 2011) $</i>

Added: grass-addons/grass7/imagery/i.pr/i.pr_training/globals.h
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/globals.h	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/globals.h	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,45 @@
+#include "defs.h"
+
+#ifndef GLOBAL
+#define GLOBAL extern
+#define INIT(x)
+#else
+#define INIT(x) = x
+#endif
+
+
+GLOBAL int G_get_color();
+
+GLOBAL int SCREEN_TOP;
+GLOBAL int SCREEN_BOTTOM;
+GLOBAL int SCREEN_LEFT;
+GLOBAL int SCREEN_RIGHT;
+
+GLOBAL View *VIEW_MAP1;
+GLOBAL View *VIEW_TITLE1;
+GLOBAL View *VIEW_MAP1_ZOOM;
+GLOBAL View *VIEW_TITLE1_ZOOM;
+GLOBAL View *VIEW_IMAGE;
+GLOBAL View *VIEW_TITLE_IMAGE;
+GLOBAL View *VIEW_INFO;
+GLOBAL View *VIEW_EXIT;
+GLOBAL View *VIEW_EMPTY;
+GLOBAL View *VIEW_MENU;
+
+GLOBAL int dotsize INIT(4);
+
+GLOBAL int THE_COLORS[10];
+
+#define BLACK	THE_COLORS[0]
+#define BLUE	THE_COLORS[1]
+#define BROWN	THE_COLORS[2]
+#define GREEN	THE_COLORS[3]
+#define GREY	THE_COLORS[4]
+#define ORANGE	THE_COLORS[5]
+#define PURPLE	THE_COLORS[6]
+#define RED	THE_COLORS[7]
+#define WHITE	THE_COLORS[8]
+#define YELLOW	THE_COLORS[9]
+
+
+#undef INIT

Added: grass-addons/grass7/imagery/i.pr/i.pr_training/graphics.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/loc_func.h
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_training/loc_func.h	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_training/loc_func.h	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,37 @@
+void Mouse_pointer();
+void display_one_point();
+int point_in_view();
+void rectangle();
+void point();
+int read_points_from_file();
+void display_title();
+void Configure_view();
+int In_view();
+void Erase_view();
+double magnification();
+void write_map();
+void compute_temp_region2();
+void compute_temp_region();
+void Outline_box();
+void Init_graphics2();
+void Init_graphics();
+
+int Text_width();
+void Text();
+void Uparrow();
+void Downarrow();
+void display_map();
+void drawcell();
+void exit_button();
+void info_button();
+
+void row_to_northing();
+void col_to_easting();
+void northing_to_row();
+void easting_to_col();
+void from_screen_to_geo();
+int view_to_col();
+int view_to_row();
+int col_to_view();
+int row_to_view();
+void dot();

Added: grass-addons/grass7/imagery/i.pr/i.pr_training/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/mouse.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/points.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/sites.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/title.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/view.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/write_map.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/zoom.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_training/zoom2.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/i.pr_uxb/Makefile
===================================================================
--- grass-addons/grass7/imagery/i.pr/i.pr_uxb/Makefile	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/i.pr_uxb/Makefile	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,14 @@
+MODULE_TOPDIR = ../../..
+
+PRINCLUDE = ../include/
+EXTRA_CFLAGS = -I$(PRINCLUDE)
+PRLIB = -lgrass_pr
+
+PGM = i.pr.uxb
+
+LIBES     = $(PRLIB) $(IMAGERYLIB) $(D_LIB) $(DISPLAYLIB) $(RASTERLIB) $(GISLIB) $(DATETIMELIB)
+DEPENDENCIES= $(PRDEP) $(IMAGERYDEP) $(D_DEP) $(DISPLAYDEP) $(RASTERDEP) $(GISDEP) $(DATETIMEDEP)
+
+include $(MODULE_TOPDIR)/include/Make/Module.make
+
+default: cmd

Added: grass-addons/grass7/imagery/i.pr/i.pr_uxb/main.c
===================================================================
Added: grass-addons/grass7/imagery/i.pr/include/func.h
===================================================================
--- grass-addons/grass7/imagery/i.pr/include/func.h	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/include/func.h	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,274 @@
+/*
+   tree.c
+ */
+
+void compute_tree();
+void write_tree();
+void compute_tree_boosting();
+void compute_tree_boosting_reg();
+void regularized_boosting();
+double test_regularized_boosting();
+void test_btree_reg();
+void shaving_and_compute();
+void compute_tree_bagging();
+void write_bagging_boosting_tree();
+int predict_tree_multiclass();
+double predict_tree_2class();
+void test_tree();
+double predict_btree_2class();
+int predict_btree_multiclass();
+void test_btree();
+void test_btree_progressive();
+double predict_btree_2class_progressive();
+int predict_btree_multiclass_progressive();
+void compute_tree_boosting_parallel();
+
+/*
+   features_selection.c
+ */
+
+void compute_valoriDJ();
+void free_svm();
+void e_rfe_lin();
+void e_rfe_gauss();
+void one_rfe_lin();
+void one_rfe_gauss();
+void rfe_lin();
+void rfe_gauss();
+void write_matrix();
+void compute_H();
+void compute_H_perdiff();
+void traslo();
+
+/*
+   soft_margin_boosting.c
+ */
+
+void maximize();
+
+/*
+   write_matrix.c
+ */
+
+void write_matrix();
+
+/*
+   entropy.c
+ */
+
+double Entropy();
+double Clog();
+void histo();
+void histo1();
+
+/*
+   min_quadratic.c
+ */
+
+void mqc();
+
+/*
+   blob.c
+ */
+
+void extract_sites_from_blob();
+void find_blob();
+
+/*
+   test.c
+ */
+
+void ksone_normal();
+void kstwo();
+double probks();
+double probks2();
+double normal_distribution();
+double cumulative_normal_distribution();
+double gammln();
+double betacf();
+double betai();
+void tutest();
+
+/*
+   read_models.c
+ */
+
+int read_model();
+
+/*
+   nn.c
+ */
+
+void compute_nn();
+void write_nn();
+int predict_nn_multiclass();
+double predict_nn_2class();
+void test_nn();
+
+/*
+   svm.c
+ */
+
+void compute_svm();
+void estimate_cv_error();
+void write_svm();
+void test_svm();
+double predict_svm();
+void compute_svm_bagging();
+void write_bagging_boosting_svm();
+void compute_svm_boosting();
+double predict_bsvm();
+void test_bsvm();
+void test_bsvm_progressive();
+double predict_bsvm_progressive();
+double dot_product();
+
+/*
+   features.c
+ */
+
+void compute_features();
+void write_features();
+void standardize_features();
+void write_header_features();
+void read_features();
+void read_header_features();
+
+/*
+   gm.c
+ */
+
+void compute_gm();
+void write_gm();
+void test_gm();
+void compute_test_gm();
+int predict_gm_multiclass();
+double predict_gm_2class();
+
+/*
+   training.c
+ */
+
+void inizialize_training();
+void read_training();
+
+/*
+   matrix.c
+ */
+
+void product_double_matrix_double_matrix();
+void product_double_matrix_double_vector();
+void product_double_vector_double_matrix();
+void transpose_double_matrix();
+void double_matrix_to_vector();
+void extract_portion_of_double_matrix();
+void transpose_double_matrix_rectangular();
+
+/*
+   pca.c
+ */
+
+void inizialize_pca();
+void write_pca();
+void read_pca();
+
+/*
+   random.c
+ */
+
+double ran1();
+double gasdev();
+double gamdev();
+double expdev();
+
+/*
+   bootstrap.c
+ */
+
+void Bootsamples();
+void Bootsamples_rseed();
+
+/*
+   dist.c
+ */
+
+double squared_distance();
+double euclidean_distance();
+double scalar_product();
+double euclidean_norm();
+
+/*
+   open.c
+ */
+
+int open_new_CELL();
+int open_new_DCELL();
+
+/*
+   percent.c
+ */
+
+void percent();
+
+/*
+   getline.c
+ */
+
+char *GetLine();
+
+/*
+   sort.c
+ */
+
+void shell();
+void indexx_1();
+
+/*
+   integration.c
+ */
+
+double trapzd();
+double trapzd1();
+double trapzd2();
+double qtrap();
+double qtrap1();
+double qtrap2();
+
+/*
+   eigen.c
+ */
+
+void tred2();
+int tqli();
+void eigen_of_double_matrix();
+void eigsrt();
+
+/*
+   stats.c
+ */
+
+double mean_of_double_array();
+double var_of_double_array();
+double sd_of_double_array();
+double var_of_double_array_given_mean();
+double sd_of_double_array_given_mean();
+void mean_and_var_of_double_matrix_by_row();
+void mean_and_sd_of_double_matrix_by_row();
+void mean_and_var_of_double_matrix_by_col();
+void mean_and_sd_of_double_matrix_by_col();
+double auto_covariance_of_2_double_array();
+void covariance_of_double_matrix();
+double entropy();
+double gaussian_kernel();
+double squared_gaussian_kernel();
+double min();
+double max();
+
+/*
+   lu.c
+ */
+
+void ludcmp();
+void lubksb();
+void inverse_of_double_matrix();
+double determinant_of_double_matrix();

Added: grass-addons/grass7/imagery/i.pr/include/func_help
===================================================================
--- grass-addons/grass7/imagery/i.pr/include/func_help	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/include/func_help	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,1624 @@
+#########################
+features_selection.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  and Maria Serafini
+
+  for
+  
+  Features Selction with SVM
+*/
+
+void compute_valoriDJ(svm,features,H_tot,H_tmp,valoriDJ)
+     SupportVectorMachine *svm;
+     Features *features;
+     double **H_tot,**H_tmp,**valoriDJ;
+void free_svm(svm)
+     SupportVectorMachine *svm;
+void e_rfe_lin(svm,features,names,selected,i,rimanenti,fp_fs_w,fp_fs_stats)
+     SupportVectorMachine *svm;
+     Features *features;
+     int *names, *selected;
+     int i;
+     int *rimanenti;
+     FILE *fp_fs_w,*fp_fs_stats;
+void e_rfe_gauss(valoriDJ,features,names,selected,i,H_tot,H_tmp,
+		 rimanenti,svm_kp,fp_fs_w,fp_fs_stats)
+     double *valoriDJ;
+     Features *features;
+     double **H_tot,**H_tmp;
+     int *names, *selected;
+     int i;
+     int *rimanenti;
+     double svm_kp;
+     FILE *fp_fs_w,*fp_fs_stats;
+void one_rfe_lin(svm,names,selected,fp_fs_w)
+     SupportVectorMachine *svm;
+     int *names, *selected;
+     FILE *fp_fs_w;
+void one_rfe_gauss(valoriDJ,names,selected,n,fp_fs_w)
+     double *valoriDJ;
+     int *names, *selected;
+     int n;
+     FILE *fp_fs_w;
+void rfe_lin(svm,features,names,selected,i,fp_fs_w)
+     SupportVectorMachine *svm;
+     Features *features;
+     int *names, *selected;
+     int i;
+     FILE *fp_fs_w;
+void rfe_gauss(valoriDJ,features,names,selected,i,H_tot,H_tmp,svm_kp,fp_fs_w)
+     Features *features;
+     double *valoriDJ;
+     int *names, *selected;
+     double **H_tot,**H_tmp;
+     int i;
+     double svm_kp;
+     FILE *fp_fs_w;
+void write_matrix(outfile,matrix,r,c)
+     char *outfile;
+     double **matrix;
+     int r,c;
+void compute_H(matrix,XX,y,ndati,nfeat,sigma)
+     double **matrix,**XX;
+     int *y;
+     double sigma;
+     int ndati,nfeat;
+void compute_H_perdiff(Hvecchia,Hnuova,XX,ndati,sigma,featdaelim)
+     double **Hvecchia,**Hnuova,**XX;
+     double sigma;
+     int ndati,featdaelim;
+
+     // featdaelim e' la variabile numerata come numera C (0...nfeat-1)
+void traslo(x,n)
+     double *x;
+     int n;
+
+#########################
+soft_margin_boosting.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  Soft Boosting implementation (quadratic programming)
+*/
+
+void maximize(alpha,N,beta,T,M)
+     double *alpha,*beta,**M;
+     int N,T;
+
+#########################
+write_matrix.c
+#########################
+
+void write_matrix(outfile,matrix,r,c)
+     char *outfile;
+     double **matrix;
+     int r,c;
+
+#########################
+entropy.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  Entropy management
+*/
+
+double Entropy(data,n,zero)
+     double *data;
+     int n;
+     double zero;
+double Clog(x,zero)
+     double x;
+     double zero;
+void histo(data,n,h,nbin)
+     double *data, *h;
+     int n,nbin;
+void histo1(data,n,h,nbin)
+     double *data;
+     int n,nbin;
+     int *h;
+
+
+#########################
+min_quadratic.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  quadratic programming
+*/
+
+void mqc(M,m,n,H,h,mH,K,k,mK,eps,x,minvalue)
+     double **M,*m;
+     double **H,*h;
+     double **K,*k;
+     int n,mH,mK;
+     double eps;
+     double *x;
+     double *minvalue;
+{
+  int i,j,l;
+
+  double **invM;
+  double **HM,**HMH,*tnH,**HMK,**KM,**KMK,*tnK,**tH,**tK;  
+  double mMm;
+  double gap;
+  double *alpha,*beta;
+  double L,f;
+  double tmpalpha,tmpbeta,tmpL,tmpf;
+
+  /*alloc memory*/
+  invM=(double**)calloc(n,sizeof(double*));
+  for(i=0;i<n;i++)
+    invM[i]=(double*)calloc(n,sizeof(double));
+
+  if(mH>0){
+    HM=(double**)calloc(mH,sizeof(double*));
+    for(i=0;i<mH;i++)
+      HM[i]=(double*)calloc(n,sizeof(double));
+    
+    HMH=(double**)calloc(mH,sizeof(double*));
+    for(i=0;i<mH;i++)
+      HMH[i]=(double*)calloc(mH,sizeof(double));
+    
+    tnH=(double*)calloc(mH,sizeof(double));
+    
+    tH=(double**)calloc(n,sizeof(double*));
+    for(i=0;i<n;i++)
+      tH[i]=(double*)calloc(mH,sizeof(double));
+    
+    for(i=0;i<mH;i++)
+      for(j=0;j<n;j++)
+	tH[j][i]=H[i][j];
+  }
+
+  if(mH>0 && mK>0){
+    HMK=(double**)calloc(mH,sizeof(double*));
+    for(i=0;i<mH;i++)
+      HMK[i]=(double*)calloc(mK,sizeof(double));
+  }
+
+  if(mK>0){
+    KM=(double**)calloc(mK,sizeof(double*));
+    for(i=0;i<mK;i++)
+      KM[i]=(double*)calloc(n,sizeof(double));
+    
+    KMK=(double**)calloc(mK,sizeof(double*));
+    for(i=0;i<mK;i++)
+      KMK[i]=(double*)calloc(mK,sizeof(double));
+    
+    tnK=(double*)calloc(mK,sizeof(double));
+
+    tK=(double**)calloc(n,sizeof(double*));
+    for(i=0;i<n;i++)
+      tK[i]=(double*)calloc(mK,sizeof(double));
+    
+    for(i=0;i<mK;i++)
+      for(j=0;j<n;j++)
+	tK[j][i]=K[i][j];
+  }
+
+  /*compute inverse of M*/
+  inverse_of_double_matrix(M,invM,n);
+
+  /*compute matrices products*/
+  if(mH>0){
+    product_double_matrix_double_matrix(H,invM,mH,n,n,HM);
+    product_double_matrix_double_matrix(HM,tH,mH,n,mH,HMH);
+    product_double_matrix_double_vector(HM,m,mH,n,tnH);
+    for(i=0;i<mH;i++)
+      tnH[i] += 2.*h[i];
+  }
+
+  if(mH>0 && mK>0)
+    product_double_matrix_double_matrix(HM,tK,mH,n,mK,HMK);
+
+  if(mK>0){  
+    product_double_matrix_double_matrix(K,invM,mK,n,n,KM);
+    product_double_matrix_double_matrix(KM,tK,mK,n,mK,KMK);
+    product_double_matrix_double_vector(KM,m,mK,n,tnK);
+    for(i=0;i<mK;i++)
+      tnK[i] += 2.*k[i];
+  }
+  
+ 
+  mMm=0.0;
+  for(i=0;i<n;i++)
+    for(j=0;j<n;j++)
+      mMm+=m[i]*m[j]*invM[i][j];
+  mMm *= -.5;
+
+  if(mH>0)
+    alpha=(double*)calloc(mH,sizeof(double));
+  if(mK>0)
+    beta=(double*)calloc(mK,sizeof(double));
+
+  gap=eps+1;
+  /*gradient ascendent on the dual Lagrangian*/
+  while(gap>eps){
+    if(mH>0 && mK>0){
+      for(l=0;l<mH;l++){
+	
+	tmpalpha=.0;
+	for(i=0;i<mH;i++)
+	  if(alpha[i]>0)
+	    tmpalpha += HMH[i][l]*alpha[i];
+	
+	tmpalpha += tnH[l];
+	
+	
+	for(i=0;i<mK;i++)
+	  tmpalpha += HMK[l][i]*beta[i];
+	
+	alpha[l] -= tmpalpha/HMH[l][l];
+	
+	if(alpha[l] < .0)
+	  alpha[l] = .0;
+      }
+
+      for(l=0;l<mK;l++){
+	tmpbeta=.0;
+	for(i=0;i<mK;i++)
+	  tmpbeta += KMK[i][l]*beta[i];
+	
+	tmpbeta += tnK[l];
+	
+	
+	for(i=0;i<mH;i++)
+	  if(alpha[i]>0)
+	    tmpbeta += HMK[i][l]*alpha[i];
+	
+	beta[l] -= tmpbeta/KMK[l][l];
+
+      }
+    }else if(mH>0 && mK==0){
+      for(l=0;l<mH;l++){
+	
+	tmpalpha=.0;
+	for(i=0;i<mH;i++)
+	  if(alpha[i]>0)
+	    tmpalpha += HMH[i][l]*alpha[i];
+	
+	tmpalpha += tnH[l];
+	
+	alpha[l] -= tmpalpha/HMH[l][l];
+	if(alpha[l] < .0)
+	  alpha[l] = .0;
+      }
+    }else if(mH==0 && mK>0){
+      for(l=0;l<mK;l++){
+	tmpbeta=.0;
+	for(i=0;i<mK;i++)
+	  tmpbeta += KMK[i][l]*beta[i];
+	
+	tmpbeta += tnK[l];
+	
+	beta[l] -= tmpbeta/KMK[l][l];
+
+      }
+    }
+
+    /*value of the dual Lagrangian*/
+    L=mMm;
+
+    tmpL=.0;
+    for(i=0;i<mH;i++)
+      if(alpha[i]>0)
+	for(j=0;j<mH;j++)
+	  if(alpha[j]>0)
+	    tmpL += alpha[i]*alpha[j]*HMH[i][j];
+    L -= .5*tmpL;
+
+    tmpL=.0;
+    for(i=0;i<mH;i++)
+      if(alpha[i]>0)
+	tmpL += alpha[i]*tnH[i];
+    L -= tmpL;
+
+    tmpL=.0;
+    for(i=0;i<mK;i++)
+      for(j=0;j<mK;j++)
+	tmpL += beta[i]*beta[j]*KMK[i][j];
+    L -= .5*tmpL;
+    
+    tmpL=.0;
+    for(i=0;i<mK;i++)
+      tmpL += beta[i]*tnK[i];
+    L -= tmpL;
+   
+    tmpL=.0;
+    for(i=0;i<mH;i++)
+      if(alpha[i]>0)
+	for(j=0;j<mK;j++)
+	  tmpL += alpha[i]*beta[j]*HMK[i][j];
+    L -= tmpL;
+
+    L *= .5;
+    
+    /*value of the objective function*/
+    f=mMm-L;
+
+    tmpf=.0;
+    for(i=0;i<mH;i++)
+      if(alpha[i]>0)
+	tmpf += alpha[i]*tnH[i];
+    f -= .5*tmpf;
+
+    tmpf=.0;
+    for(i=0;i<mK;i++)
+      tmpf += beta[i]*tnK[i];
+    f -= .5*tmpf;
+    
+    /* gap between dual Lagrangian and objective function (stopping criteria)*/
+    gap=fabs((f-L)/(f+1.));
+    printf("%f\n",gap);
+
+  }
+
+  /*minimum*/
+
+  for(l=0;l<n;l++){
+    x[l] = .0;
+    
+    for(i=0;i<mH;i++)
+      if(alpha[i]>0)
+	x[l] +=HM[i][l]*alpha[i];
+
+    for(i=0;i<mK;i++)
+      x[l] +=KM[i][l]*beta[i];
+    
+    for(i=0;i<n;i++)
+      x[l] +=invM[l][i]*m[i];
+
+    x[l] *= -.5;
+  }
+  for(i=0;i<mH;i++)
+    printf("a[%d]=%f\n",i,alpha[i]);
+  for(i=0;i<mK;i++)
+    printf("b[%d]=%f\n",i,beta[i]);
+
+  /*value of the function*/
+  *minvalue=f;
+  
+
+  /*free memory*/
+  for(i=0;i<n;i++)
+    free(invM[i]);
+  free(invM);
+
+  if(mH>0){
+    free(alpha);
+    free(tnH);
+    for(i=0;i<mH;i++){
+      free(HM[i]);
+      free(HMH[i]);
+    }
+    free(HM);
+    free(HMH);
+    for(i=0;i<n;i++)
+      free(tH[i]);
+    free(tH);
+  }
+
+  if(mK>0){
+    free(beta);
+    free(tnK);
+    for(i=0;i<mK;i++){
+      free(KM[i]);
+      free(KMK[i]);
+    }
+    free(KM);
+    free(KMK);
+    for(i=0;i<n;i++)
+      free(tK[i]);
+    free(tK);
+  }
+
+  if(mK>0 && mH>0){
+    for(i=0;i<mH;i++)
+      free(HMK[i]);
+    free(HMK);
+  }
+    
+}
+
+
+#########################
+blob.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  Blob and BlobSites structure management
+*/
+
+void extract_sites_from_blob(blobs,npoints,nblobs,cellhd,sites,matrix)
+     /*extract geographical coordinates of the blob centers
+       and store results in a BlobSites structure, containing the minimum 
+       value of the blob too (computation based on matrix)*/
+     Blob *blobs;
+     int npoints,nblobs;
+     struct Cell_head *cellhd;
+     BlobSites *sites;
+     double **matrix;
+void find_blob(matrix,r,c,blobs,npoints,nblobs,tm,tM)
+     /*find blobs within a matrix and add to structure blob. A blob is
+       a set of contiguous cells of a matrix, all of them with value <=
+       tM and >= tm.  npoints is just a counter of cells belonging to the blob.
+       nblobs is the total number of blobs.*/
+     double **matrix;
+     int r,c;
+     Blob **blobs;
+     double tm,tM;
+     int *nblobs;
+     int *npoints;
+
+#########################
+test.c
+#########################
+
+/*
+  The following routines are borrowed from "Numerical Recipes in C"
+  and rearranged by Stefano Merler
+
+  for 
+  
+  statistical test computation
+
+  Supported functions for:
+  - KS test the normal distribution of data
+  - KS test for equality of 2 distribution
+  - t-test for mean
+*/
+
+void ksone_normal(data,n,p1,p2,d,prob)
+     /*
+       KS test for normal distribution. data is the array of data 
+       of length n. p1 and p2 mean and sd of the normal distribution
+       tested. On output d is the value of the test and prob
+       the p-value
+     */
+     double *data,*d,*prob;
+     int n;
+     double p1,p2;
+     
+void kstwo(data1,n1,data2,n2,d,prob)
+     /*
+       KS test for testing 2 distribution. data1 is the first 
+       array of data of length n1. data2 is the second array
+       of data of length n2. On output d is the value of the
+       test and prob the p-value
+     */
+     double *data1, *data2, *d, *prob;
+     int n1,n2;
+double normal_distribution(x,mu,sigma)
+     /*
+       normal distribution with mean mu and
+       standard deviation sigma computed at point x
+
+       1/(sigma*sqrt(PIG) exp(-(x-mu)^2/2sigma^2)
+     */
+     double x,mu,sigma;
+double cumulative_normal_distribution(mu,sigma,x)
+     /*
+       cumulative probability of the normal
+       distribution with mean mu and
+       standard deviation sigma, i.e.
+       integral from -Inf to x
+  
+     */
+     double mu,sigma,x;
+void tutest(data1,n1,data2,n2,t,prob)
+     /*
+      */
+     double *data1, *data2, *t, *prob;
+     int n1,n2;
+
+#########################
+read_models.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  loading different model types
+*/
+
+int read_model(file,features,nn,gm,tree,svm,btree,bsvm)
+     /*read a model from file and fill the structure according to the
+       model type. Moreover load the features*/
+     char *file;
+     NearestNeighbor *nn;
+     GaussianMixture *gm;
+     Tree  *tree;
+     SupportVectorMachine *svm;
+     BTree *btree;
+     BSupportVectorMachine *bsvm;
+     Features *features;
+
+#########################
+nn.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structure NearestNeighbor management
+*/
+
+void compute_nn(nn,nsamples,nvar,data,data_class)
+     /*
+       Compute nn model, given a matrix of examples data of dimension
+       nsamples x nvar. Classes of each example are contained in data_class.
+     */
+     NearestNeighbor *nn;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+void write_nn(file,nn,features)
+     /*
+       write nn structure to a file 
+     */
+     char *file;
+     NearestNeighbor *nn;
+     Features *features;
+int predict_nn_multiclass(nn,x,k,nclasses,classes)
+     /* 
+	multiclass problems: given a nn model, return the predicted class of a test point x 
+	using k-nearest neighbor for the prediction. the array classes (of length nclasses)
+	shall contain all the possible classes to be predicted
+     */
+     NearestNeighbor *nn;	
+     double *x;
+     int k;
+     int *classes;
+     int nclasses;
+double predict_nn_2class(nn,x,k,nclasses,classes)
+     /* 
+	2 class problems: given a nn model, return the majority of the class (with sign) 
+	of a test point x using k-nearest neighbor for the prediction. 
+	the array classes (of length nclasses)	shall contain all the possible 
+	classes to be predicted
+     */
+     NearestNeighbor *nn;	
+     double *x;
+     int k;
+     int *classes;
+     int nclasses;
+void test_nn(nn,features,k,file)
+     /*
+       test nn model on a set of data (features) using k-nearest neighbor 
+       and write the results into a file. To standard output accuracy 
+       and error on each class
+     */
+     NearestNeighbor *nn;
+     Features *features;
+     char *file;
+     int k;
+
+#########################
+svm.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structures SupportVectorMachine adn  BSupportVectorMachine management
+*/
+
+
+void compute_svm(svm,n,d,x,y,svm_kernel,svm_kp,svm_C,svm_tol,svm_eps,
+		 svm_maxloops,svm_W)
+     SupportVectorMachine *svm;
+     int n,d;
+     double **x;
+     int *y;
+     int svm_kernel;
+     double svm_kp,svm_C,svm_tol,svm_eps;
+     int svm_maxloops;
+     double *svm_W;
+void estimate_cv_error(SVM)
+     SupportVectorMachine *SVM;
+void write_svm(file,svm,features)
+     /*
+       write svm structure to a file 
+     */
+     SupportVectorMachine *svm;
+     char *file;
+     Features *features;
+void test_svm(svm,features,file)
+     /*
+       test svm model on a set of data (features) and write the results
+       into a file. To standard output accuracy and error on each class
+     */
+     SupportVectorMachine *svm;
+     Features *features;
+     char *file;
+double predict_svm(svm,x)
+     /* 
+	given a svm model, return the predicted margin of a test point x
+     */
+     SupportVectorMachine *svm;
+     double *x;
+void compute_svm_bagging(bsvm,bagging,nsamples,nvar,data,data_class,
+			 svm_kernel,kp,C,tol,eps,maxloops,svm_W)
+     BSupportVectorMachine *bsvm;
+     int bagging;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+     int svm_kernel;
+     double kp;
+     double C;
+     double tol;
+     double eps;
+     int maxloops;
+     double *svm_W;
+void write_bagging_boosting_svm(file,bsvm,features)
+     /*
+       write a bagging or boosting svm to a file
+     */
+     char *file;
+     BSupportVectorMachine *bsvm;
+     Features *features;
+void compute_svm_boosting(bsvm,boosting,w,nsamples,nvar,data,data_class,
+			  nclasses,classes, svm_kernel,kp,C,tol,svm_eps,
+			  maxloops,svm_W,weights_boosting)
+
+     BSupportVectorMachine *bsvm;
+     int boosting;
+     double w;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+     int *classes;
+     int nclasses;
+     int svm_kernel;
+     double kp;
+     double C;
+     double svm_eps;
+     double tol;
+     int maxloops;
+     double *svm_W;
+     int weights_boosting;
+
+double predict_bsvm(bsvm,x)
+     /* 
+	given a bsvm model, return the predicted margin of a test point x
+     */
+     BSupportVectorMachine *bsvm;	
+     double *x;
+void test_bsvm(bsvm,features,file)
+     /*
+       test bagging or boosting svm model on a set of data (features) 
+       and write the results into a file. To standard output accuracy 
+       and error on each class
+     */
+     BSupportVectorMachine *bsvm;
+     Features *features;
+     char *file;
+double dot_product(x,y,n)
+     double *x,*y;
+     int n;
+
+
+#########################
+features.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structure Feature management
+*/
+void compute_features(features)
+     /*
+       given a training structure in input, fill the features structure
+       according to specification lyke
+       features->f_mean
+       features->f_variance
+       features->f_pca
+       features->f_texture (not yet implemented)
+     */
+     Features *features;
+  space_for_each_layer=(int *)G_calloc(features->training.nlayers,
+				       sizeof(int));
+  features->examples_dim = 0;
+      features->p_classes=(int *)realloc(features->p_classes,
+					 features->nclasses * sizeof(int));
+      features->p_classes[features->nclasses-1] = features->class[i];
+    }
+  }
+
+  /*space for pca*/
+void write_features(file,features)
+     /*
+       write the features into a file
+     */
+     char *file;
+     Features *features;
+void standardize_features(features)
+     /*
+       standardize fetures accordining to the fetures.f_standardize array
+     */
+     Features *features;
+void write_header_features(fp,features)
+     /*
+       write the header features into the pointed  file
+     */
+     FILE *fp;
+     Features *features;
+void read_features(file,features,npc)
+     /*
+       read the features from a file. If pc structure is contained
+       within features, only load the first npc component. If npc < 0
+       all the pc will be loaded.
+     */
+     char *file;
+     Features *features;
+     int npc;
+      features->value[i]=(double *)G_calloc(features->examples_dim,
+					    sizeof(double));
+    }
+    features->class=(int *)G_calloc(features->nexamples,sizeof(int));
+    
+    line=GetLine(fp);
+    line=GetLine(fp);
+void read_header_features(fp,features)
+     /*
+       read the hearder features from the file pointed
+     */
+     FILE *fp;
+     Features *features;
+
+#########################
+gm.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structure GaussianMixture management
+*/
+
+void compute_gm(gm,nsamples,nvar,data,data_class,nclasses,classes)
+     /*
+       Compute gm model, given a matrix of examples data of dimension
+       nsamples x nvar. Classes of each example are contained in data_class.
+       the array classes (of length nclasses) shall contain all the possible
+       classes of the array data_class
+     */
+     GaussianMixture *gm;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+     int *classes;
+     int nclasses;
+void write_gm(file,gm,features)
+     /*
+       write gm structure to a file 
+     */
+     char *file;
+     GaussianMixture *gm;
+     Features *features;
+void test_gm(gm,features,file)
+     /*
+       test gm model on a set of data (features) and write the results
+       into a file. To standard output accuracy and error on each class
+     */
+     GaussianMixture *gm;
+     Features *features;
+     char *file;
+void compute_test_gm(gm)
+     /*
+       compute inverse and determinant of each covariance matrix of a gm model
+     */
+     GaussianMixture *gm;
+int predict_gm_multiclass(gm,x)
+     /* 
+	multiclass problems: given a gm model, return the predicted class 
+	of a test point x
+     */
+     GaussianMixture *gm;
+     double *x;
+double predict_gm_2class(gm,x)
+     /* 
+	2 class problems: given a gm model , return the posterior of class (with sign) for 
+	a test point x
+     */
+     GaussianMixture *gm;
+     double *x;
+
+#########################
+training.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structure Training management
+*/
+
+void inizialize_training(training)
+     /* 
+	alloc memory for training (see global.h for details)
+     */
+     Training *training;
+void read_training(file,training)
+     /*
+       read training structure from a file. Supported formats
+       GRASS_data:list of labelled raster maps
+       TABLE_data:list of labelled vecors
+     */
+     char *file;
+     Training *training;
+      training->data[training->nexamples]=(double *)G_calloc(training->cols,
+							     sizeof(double));
+
+#########################
+tree.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structure Tree and BTree management
+*/
+
+void  compute_tree(tree,nsamples,nvar,data,data_class,nclasses,
+		   classes,stamps,minsize,costs)
+     /*
+       receives in input training data of dimensions nsamples x nvar, 
+       with class labels data_class, the possible classes (of length nclasses)
+       and computes a tree model; optionally, the user can build stamps 
+       and decide the minimal number of cases within a node as 
+       stopping criteria. 
+     */
+     Tree *tree;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+     int *classes;
+     int nclasses;
+     int stamps;
+     int minsize;
+     double *costs;
+void write_tree(file,tree,features)
+     /*
+       write a tree model to a file
+     */
+     char *file;
+     Tree *tree;
+     Features *features;
+void compute_tree_boosting(btree,boosting,w,nsamples,nvar,data,data_class,
+			   nclasses,classes, stamps,minsize,weights_boosting,
+			   costs)
+     /*
+       receives in input training data of dimensions nsamples x nvar, 
+       with class labels data_class, the possible classes (of length nclasses)
+       and computes a boosting tree model (number of models = boosting) using w
+       as parameter for the cost sensitive procedure;
+       optionally, the user can build stamps and decide the 
+       minimal number of cases within a node as stopping criteria. 
+     */
+     BTree *btree;
+     int boosting;
+     double w;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+     int *classes;
+     int nclasses;
+     int stamps;
+     int minsize;
+     int weights_boosting;
+     double *costs;
+void compute_tree_bagging(btree,bagging,nsamples,nvar,data,data_class,
+			 nclasses,classes,stamps,minsize,costs)
+     /*
+       receives in input training data of dimensions nsamples x nvar, 
+       with class labels data_class, the possible classes (of length nclasses)
+       and computes a bagging tree model (number of models = bagging);
+       optionally, the user can build stamps and decide the 
+       minimal number of cases within a node as stopping criteria. 
+     */
+     BTree *btree;
+     int bagging;
+     int nsamples,nvar;
+     double **data;
+     int *data_class;
+     int *classes;
+     int nclasses;
+     int stamps;
+     int minsize;
+     double *costs;
+void write_bagging_boosting_tree(file,btree,features)
+     /*
+       write a bagging or boosting tree model to a file
+     */
+     char *file;
+     BTree *btree;
+     Features *features;
+int predict_tree_multiclass(tree,x)
+     /* 
+	multiclass problems: given a tree model, return the predicted class 
+	of a test point x
+     */
+     Tree *tree;	
+     double *x;
+double predict_tree_2class(tree,x)
+     /* 
+	2 class problems: given a tree model, return the proportion of data
+	in the terminal node (with sign) of a test point x
+     */
+     Tree *tree;	
+     double *x;
+void test_tree(tree,features,file)
+     /*
+       test a tree model on a set of data (features) and write the results
+       into a file. To standard output accuracy and error on each class
+     */
+     Tree *tree;
+     Features *features;
+     char *file;
+double predict_btree_2class(btree,x)
+     /* 
+	for 2 classes problems: given a btree model, return the predicted
+	margin of a test point x
+     */
+     BTree *btree;	
+     double *x;
+int predict_btree_multiclass(btree,x,nclasses,classes)
+     /* 
+	for multiclasses problems: given a btree model, return the predicted
+	class of a test point x
+     */
+     BTree *btree;	
+     double *x;
+     int *classes;
+     int nclasses;
+void test_btree(btree,features,file)
+     /*
+       test a btree model on a set of data 
+       (features) and write the results into a file. To standard output
+       accuracy and error on each class
+     */
+     BTree *btree;
+     Features *features;
+     char *file;
+
+#########################
+matrix.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  management of matrices and arrays
+
+  Supported function for 
+  - product matrix matrix or vector matrix
+  - transpose matrix
+  - conversion of matrix to array
+  - extraction of portion of matrix
+*/
+
+void product_double_matrix_double_matrix(x,y,r,cr,c,out)
+     /*
+       product of matrices x * y, 
+       r = rows of x 
+       cr= cols of x = rows of y
+       c = cols of y
+       out is the r x c matrix. 
+     */
+     double **x, **y, **out;
+     int r,cr,c;
+void product_double_matrix_double_vector(x,y,r,cr,out)
+     /*
+       vector x matrix y * x, 
+       r = rows of x 
+       cr= cols of x = elements of y
+       out is the output vector (r elements) . Memory for out is not stored.
+     */
+     double **x, *y, *out;
+     int r,cr;
+void product_double_vector_double_matrix(x,y,rr,c,out)
+     /*
+       vector x matrix y * x, 
+       rr = rows of x = elements of y 
+       c= cols of x 
+       out is the output vector (c elements) . Memory for out is not stored.
+     */
+     double **x, *y, *out;
+     int rr,c;
+void transpose_double_matrix(x,n)
+     /*
+       transpose, and overwrite, the input matrix x 
+       of dimension n x n
+     */
+     double **x;
+     int  n;
+void double_matrix_to_vector(mat,rows,cols,vect)
+     /*
+       transform matrix mat of dimension rows x cols in vector
+       vect of length rows x cols.
+       matrix is scanned by row
+     */
+     double **mat;
+     int rows, cols;
+     double *vect;
+void extract_portion_of_double_matrix(r,c,br,bc,mat,wind)
+     /*
+       extract a squared portion of a matrix mat
+       given a the indeces of the center [r,c] 
+       and the semilength of the borders [br,bc]
+       Output to array wind
+     */
+     int r, c, br, bc;
+     double **mat, **wind;
+void transpose_double_matrix_rectangular(x,n,m,trans)
+     /*
+       transpose the input matrix x  of dimension n x m
+       output to pointer to matrix trans
+     */
+     double **x,***trans;
+     int  n,m;
+
+#########################
+pca.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  structure Pca management
+*/
+
+
+void inizialize_pca(pca,dim)
+     /* 
+	alloc memory for Pca structure pca of dimension dim
+     */
+     Pca *pca;
+     int dim;
+void write_pca(fp,pca)
+     /* write a pca structure into the file pointed*/
+     FILE *fp;
+     Pca *pca;
+void read_pca(fp,pca)
+     /* raed a pca structure from the file pointed*/
+     FILE *fp;
+     Pca *pca;
+
+#########################
+random.c
+#########################
+
+/*
+  The following routines are borrowed from "Numerical Recipes in C"
+  
+  for 
+  
+  extraction of samples from normal and uniform distributions
+*/
+
+double ran1(idum)
+     /*
+       return a double from a uniform distributio over [0,1].
+       Idum inizialize the procedure
+     */
+     int *idum;
+double gasdev(idum)
+     /*
+       return a double from a normal distribution (m=0, v=1).
+       Idum inizialize the procedure
+     */
+     int *idum;
+
+#########################
+bootstrap.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  bootstrap, probabily based, samples estraction
+*/
+
+void Bootsamples(n,prob,random_labels)
+     /*
+       given an array of probabilities of length n, extract a bootstrap sample
+       of n elements according to the vector of probabilities
+     */
+     int n;
+     double *prob;
+     int *random_labels;
+     
+void Bootsamples_rseed(n,prob,random_labels,idum)
+     /*
+       given an array of probabilities of length n, extract a bootstrap sample
+       of n elements according to the vector of probabilities
+     */
+     int n;
+     double *prob;
+     int *random_labels;
+     int *idum;
+     
+
+#########################
+dist.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  Distance between arrays computation
+*/
+
+double squared_distance(x,y,n)
+     /*
+       squared euclidean distance between vectors x and y of length n
+     */
+     double *x;
+     double *y;
+     int n;
+double euclidean_distance(x,y,n)
+     /*
+       euclidean distance between vectors x and y of length n
+     */
+     double *x, *y;
+     int n;
+double scalar_product(x,y,n)
+     /*
+       scalar product between vector x and y of length n
+     */
+     double *x,*y;
+     int n;
+double euclidean_norm(x,n)
+     /*
+       euclidean norm of a  vector x of length n
+     */
+     double *x;
+     int n;
+
+#########################
+open.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  open new raster maps
+*/
+
+int open_new_CELL(name)
+     /* 
+	open a new raster map of name name in CELL format
+     */
+     char *name;
+int open_new_DCELL(name)
+     /* 
+	open a new raster map of name name in DELL format
+     */
+     char *name;
+
+#########################
+percent.c
+#########################
+
+/*
+  The following routines are written and tested by Stefano Merler
+
+  for
+  
+  status of a loop computation
+*/
+
+void percent (n,d,s)
+     /*
+       compute percentage (and print to stderr)
+       of work done within a loop. 
+       n actual number, d total number, s step
+     */
+     int n,d,s;
+     
+
+#########################
+getline.c
+#########################
+
+/*
+  The following routine is written and tested by Stefano Merler
+
+  for
+  
+  getting a line from a buffered stream
+*/
+
+char *GetLine(fp)
+     /*
+       get a line from a buffered stream (pointed from fp)
+     */
+     FILE    *fp;
+
+#########################
+sort.c
+#########################
+
+/*
+  The following routines is borrowed from "Numerical Recipes in C"
+  
+  for
+
+  sortinf of an array 
+*/
+
+void shell(n,arr)
+     /*  
+	 sort and rearranges an array arr of length n 
+	 into ascending order
+     */
+     double *arr;
+     int n;
+void indexx_1(n,arrin,indx)
+     /*
+       sort array arrin of length n into ascending order,
+       without modify it. The order of the sording will be
+       contained into the indx array
+     */
+     int n, indx[];	
+     double arrin[];	
+
+#########################
+integration.c
+#########################
+
+/*
+  Same of the following routines are borrowed from "Numerical Recipes in C"
+  other are written and tested by Stefano Merler
+
+  for
+  
+  integration of function using the trapezoidal rule
+
+  Supported function for 
+  - non-parametric functions
+  - functions depending from 1 parameter
+  - functions depending from 2 parameters
+*/
+
+
+double trapzd(func,a,b,n)
+     /* 
+	trapezoidal rule for func=func(x) on interval [a,b]
+	n = steps number
+     */
+     double a,b;
+     double (*func)();
+     int n;
+double trapzd1(func,p1,a,b,n)
+     /* 
+	trapezoidal rule for func=func(x; p1) on interval [a,b]
+	p1 free parameter
+	n = steps number
+     */
+     double a,b;
+     double p1;
+     double (*func)();
+     int n;
+double trapzd2(func,p1,p2,a,b,n)
+     /* 
+	trapezoidal rule for func=func(x; p1,p2) on interval [a,b]
+	p1 and p2 free parameters
+	n = steps number
+     */
+     double a,b;
+     double p1,p2;
+     double (*func)();
+     int n;
+double qtrap(func,a,b)
+     /* 
+	trapezoidal rule for func=func(x) with stopping rule
+     */
+     double a,b;
+     double (*func)();
+double qtrap1(func,p1,a,b)
+     /* 
+	trapezoidal rule for func=func(x) on interval [a,b]
+	with internal stopping rule
+	p1  free parameter
+     */
+     double a,b;
+     double p1;
+     double (*func)();
+double qtrap2(func,p1,p2,a,b)
+     /* 
+	trapezoidal rule for func=func(x) on interval [a,b]
+	with internal stopping rule
+	p1 and p2 free parameters
+     */
+     double a,b;
+     double p1,p2;
+     double (*func)();
+
+#########################
+eigen.c
+#########################
+
+/*
+  Same of the following routines are borrowed from "Numerical Recipes in C"
+  other are written and tested by Stefano Merler
+
+  for
+
+  Eigenvalues and eigenvectors of simmetric matrices compution
+  and management
+*/
+
+void tred2(a,n,d,e)
+     /*
+       Houserholder method for reduction of simmetric n x n matrix a to 
+       tridiagonal form: on output a contains the ortogonal transformation
+       matrix, d contains the diagonal elements, and e the off-diagonal.
+      */
+     double **a,d[],e[];
+     int n;
+int tqli(d,e,n,z)
+     /*
+       QL algorithm: compute eigenvalues and eigenvectors 
+       of simmetric tridiagonal matrix. On input, d diagonal 
+       and e off-diagonal elements of the matrix (usually the 
+       output of tred2), z the matrix output of tred2.
+       On output d eigenvalues, z eigenvectors.
+      */
+     double d[],e[],**z;
+     int n;
+void eigen_of_double_matrix(M, Vectors, lambda, n) 
+     /* 
+	Computes eigenvalues (and eigen vectors if desired) for	
+	symmetric matrix M of dimension n x n.
+ 	Vectors and lambda contain the (obvious) output.
+     */
+     double 	**M;	
+     double  **Vectors; 
+     double  *lambda;   
+     int	n;	
+void eigsrt(d,z,bands)
+     /* sort eigenvalues d in descending order, and rearranges 
+	eigenvectors z correspondingly. bands contains the number 
+	of eigenvalues = rows of z = cols of z
+     */
+     double *d,**z;
+     long   bands;
+
+#########################
+stats.c
+#########################
+
+/*
+  The following routing are written and tested by Stefano Merler
+
+  for 
+
+  statistical description of data
+
+  Supported function for:
+  - mean computation
+  - standard deviation and variance computation
+  - autocovariance computation
+  - covariance matrix computation
+  -min-max of an array
+*/
+
+double mean_of_double_array(x,n)
+     /* 
+	compute the mean of an array x of lenth n
+     */
+     double *x;
+     int n;
+double var_of_double_array(x,n)
+     /* 
+	compute the var of an array x of length n
+     */
+     double *x;
+     int n;
+double sd_of_double_array(x,n)
+     /* 
+	compute the sd of an array x of length n
+     */
+     double *x;
+     int n;
+double var_of_double_array_given_mean(x,n,mean)
+     /* 
+	compute the var of an array x of length n
+	without computation of the mean mean, 
+	given in input
+     */
+     double *x;
+     double mean;
+     int n;
+double sd_of_double_array_given_mean(x,n,mean)
+     /* 
+	compute the sd of an array x of length n
+	without computation of the mean, 
+	given in input
+     */
+     double *x;
+     double mean;
+     int n;
+void mean_and_var_of_double_matrix_by_row(x,n,m,mean,var)
+     /* 
+	each row of the input matrix x (dimension n x m)
+	is considered an independent array of data. 
+	The function compute mean and var of each row, 	
+	stored within the array mean and var. 
+     */
+     double **x;
+     int n;
+     int m;
+     double *mean;
+     double *var;
+void mean_and_sd_of_double_matrix_by_row(x,n,m,mean,sd)
+     /* 
+	each row of the input matrix x (dimension n x m)
+	is considered an independent array of data. 
+	The function compute mean and sd of each row, 	
+	stored within the array mean and sd. 
+     */
+     double **x;
+     int n;
+     int m;
+     double *mean;
+     double *sd;
+void mean_and_var_of_double_matrix_by_col(x,n,m,mean,var)
+     /* 
+	each col of the input matrix x (dimension n x m)
+	is considered an independent array of data. 
+	The function compute mean and var of each col, 	
+	stored within the array mean and sd. 
+     */
+     double **x;
+     int n;
+     int m;
+     double *mean;
+     double *var;
+void mean_and_sd_of_double_matrix_by_col(x,n,m,mean,sd)
+     /* 
+	each col of the input matrix x (dimension n x m)
+	is considered an independent array of data. 
+	The function compute mean and sd of each col, 	
+	stored within the array mean and sd. 
+     */
+     double **x;
+     int n;
+     int m;
+     double *mean;
+     double *sd;
+double auto_covariance_of_2_double_array(x,y,n)
+     /* 
+	compute the auto covariance of 2 array x and y of length n
+     */
+     double *x;
+     double *y;
+     int n;
+void covariance_of_double_matrix(x,n,m,cov)
+     /*
+       compute covariance matrix of a matrix x of dimension n x m.
+       Output to matrix cov.
+     */
+     double **x;
+     double **cov;
+     int n,m;
+double entropy(p,n)
+     /*
+       compute and return entropy of an array p (his components to be intended
+       as proportions) of length n
+     */
+     double *p;	
+     int n;
+double gaussian_kernel(x,y,n,kp)
+     /*
+       compute e return gaussian kernel exp(-sqrt(||x-y||)/kp),
+       x and y array of length n
+     */
+     double *x,*y;
+     int n;
+     double kp;
+double squared_gaussian_kernel(x,y,n,kp)
+     /*
+       compute e return gaussian kernel exp(-||x-y||/kp),
+       x and y array of length n
+     */
+     double *x,*y;
+     int n;
+     double kp;
+double min(x,n)
+     double *x;
+     int n;
+double max(x,n)
+     double *x;
+     int n;
+
+#########################
+lu.c
+#########################
+
+/*
+  Same of the following routines are borrowed from "Numerical Recipes in C"
+  other are written and tested by Stefano Merler
+
+  for
+  
+  LU matrix decomposition, linear equation solution (Ax=b), inversion
+  of matrices and deteminant computation
+*/
+
+void ludcmp(a,n,indx,d)
+     /*
+       LU decomposition of n x n matrix a.
+     */
+     int n,*indx;
+     double **a,*d;
+void lubksb(a,n,indx,b)
+     /* 
+	Solve linear equation Ax=B
+	a has to be a LU decomposed n x n matrix, and indx 
+	is usually the output of ludcmp.
+	On output, b contains the solution
+     */
+     double **a,b[];
+     int n,*indx;
+void inverse_of_double_matrix(A,inv_A,n)
+     /* 
+	Inverse of a matrix A of dimension n x n.
+	Output stored in inv_A
+     */	
+     double **A,**inv_A;
+     int n;
+double determinant_of_double_matrix(A,n)
+     /* 
+	determinant of a double matrix A of dimension n x n
+     */
+     double **A;
+     int n;

Added: grass-addons/grass7/imagery/i.pr/include/global.h
===================================================================
--- grass-addons/grass7/imagery/i.pr/include/global.h	                        (rev 0)
+++ grass-addons/grass7/imagery/i.pr/include/global.h	2014-12-02 20:19:54 UTC (rev 63335)
@@ -0,0 +1,231 @@
+#include <grass/gis.h>
+#include "func.h"
+
+#define PIG M_PI
+
+#define TRUE 1
+#define FALSE 0
+
+#define TRAINING_MAX_INPUTFILES 50
+#define TRAINING_MAX_LAYERS 25
+#define TRAINING_MAX_EXAMPLES 100000
+#define BUFFSIZE 500000		/* MAX NUMBER OF BITES FOR EACH ROW */
+
+#define NN_model  1
+#define GM_model  2
+#define CT_model  3
+#define SVM_model  4
+#define BCT_model  5
+#define BSVM_model  6
+
+#define GRASS_data  1
+#define TABLE_data  2
+
+#define SVM_KERNEL_LINEAR 1
+#define SVM_KERNEL_GAUSSIAN 2
+#define SVM_KERNEL_DIRECT 3
+
+
+#define FS_RFE 1
+#define FS_E_RFE 2
+#define FS_ONE_RFE 3
+#define FS_SQRT_RFE 4
+
+typedef struct
+{
+    char *file;			/*source data */
+    int data_type;		/*GRASS_data or TABLE_data */
+    int nlayers;		/*number of layers (for GRASS_data) */
+    int nexamples;		/*number of examples */
+    char ***mapnames;		/*name of the raster maps (for GRASS_data)
+				   nlayers maps in each row */
+    int *class;			/*class label of the examples */
+    double *east;		/*east coordinate of centers of the maps (for GRASS_data) */
+    double *north;		/*north coordinate of centers of the maps (for GRASS_data) */
+    double **data;		/*matrix of data (for TABLE_data) */
+    double ew_res;		/*resolution e-w (for GRASS_data) */
+    double ns_res;		/*resolution n-s (for GRASS_data) */
+    int rows;			/*rows of the examples (1 for for GRASS_data) */
+    int cols;			/*number of colums of the examples */
+} Training;
+
+typedef struct
+{
+    int n;			/*number of elements */
+    double *mean;		/*the mean value of the examples, stored in an
+				   array of dimension rows x cols */
+    double *sd;			/*the standard deviation of the examples, stored in an
+				   array of dimension rows x cols */
+    double **covar;		/*covariance matrix of the examples, stored in a
+				   matrix of dimension (rows x cols)^2 */
+    double *eigval;		/*eigenvalues of the covariance matrix */
+    double **eigmat;		/*eigenvectors matrix of the covariance matrix.
+				   Each column is the eigenvector corresponding to  
+				   an eigenvalues */
+} Pca;
+
+
+typedef struct
+{
+    char *file;			/*source data */
+    int nexamples;		/*number of examples */
+    int examples_dim;		/*dimension of the examples */
+    double **value;		/*matrix of the data */
+    int *class;			/*class labels */
+    int *p_classes;		/*all the class present in the class array */
+    int nclasses;		/*number of classes */
+    double *mean;		/*mean of the vars (in case of standardization) */
+    double *sd;			/*sd of the vars (in case of standardization) */
+    int *f_normalize;		/*for normalising a datum: TRUE or FALSE */
+    int *f_standardize;		/*for standardize variables: TRUE or FALSE */
+    int *f_mean;		/*for computing the mean of a datum: TRUE or FALSE */
+    int *f_variance;		/*for computing the variance of a datum: TRUE or FALSE */
+    int *f_pca;			/*for computing pc on the data: TRUE or FALSE */
+    int *pca_class;		/*use only this classes for computing the pc */
+    Pca *pca;			/*the pc structure (if f_pca) */
+    Training training;		/*some information regarding training data */
+    int npc;			/* number of pc to be (eventually) used for the model development */
+} Features;
+
+
+typedef struct
+{
+    double **data;		/*data contained into the node */
+    int *classes;		/*classes of the data */
+    int npoints;		/*number of data into the data */
+    int nvar;			/*dimension of the data */
+    int nclasses;		/*number of classes */
+    int *npoints_for_class;	/*number of elements for each class */
+    double *priors;		/*prior probabilities for each class */
+    int class;			/*class associated to the ciurrent node */
+    int terminal;		/*is the node terminal? TRUE or FALSE */
+    int left;			/*his left child */
+    int right;			/*his right child */
+    int var;			/*variable used to split this node (if not terminal) */
+    double value;		/*value of the variable for splitting the data */
+} Node;
+
+typedef struct
+{
+    Node *node;			/*the nodes */
+    int nnodes;			/*number of nodes */
+    int stamps;			/*if it is stamps: TRUE or FALSE */
+    int minsize;		/*minsize for splitting a node */
+    Features features;		/*the features used for the model development */
+} Tree;
+
+typedef struct
+{
+    Tree *tree;			/*the trees */
+    int ntrees;			/*number of trees */
+    double *weights;		/*their wieghts */
+    double w;			/*cost-sensitive parameter use (for boosting) */
+    double **w_evolution;
+    Features features;		/*the features used for the model development */
+} BTree;
+
+typedef struct
+{
+    int nclasses;		/*number of classes */
+    int *classes;		/*array of the class names */
+    int *npoints_for_class;	/*number of examples contained in each class */
+    int nvars;			/*number of predictor variables */
+    double **mean;		/*for each class, the mean value of the examples stored
+				   in an array of length nvars */
+    double ***covar;		/*for each class, the covariance matrix of the esamples
+				   stored in a matrix of dimension nvars x nvars */
+    double ***inv_covar;	/*for each class, the inverse of the covariance matrix
+				   stored in a matrix of dimension nvars x nvars */
+    double *priors;		/* prior probabilities of each class */
+    double *det;		/*for each class, the determinant of the inverse of the
+				   covariance matrix */
+    Features features;		/*the features used for the model development */
+} GaussianMixture;
+
+typedef struct
+{
+    int nsamples;		/*number of examples */
+    int nvars;			/*number of variables */
+    double **data;		/*the data */
+    int *class;			/*their classes */
+    int k;
+    Features features;		/*the features used for the model development */
+} NearestNeighbor;
+
+typedef struct
+{
+    int d;
+    int i1;
+    double *x1;
+    int y1;
+    int i2;
+    double *x2;
+    int y2;
+    double w_coeff;
+    double b;
+} SVM_direct_kernel;
+
+typedef struct
+{
+    int N;			/*number of examples */
+    int d;			/*number of features */
+    int orig_d;
+    double C;			/*bias/variance parameter */
+    double tolerance;		/*tolerance for testing KKT conditions */
+    double eps;			/*convergence parameters:used in both takeStep and mqc functions */
+    double two_sigma_squared;	/*kernel parameter */
+    double *alph;		/*lagrangian coefficients */
+    double b;			/*offset */
+    double *w;			/*hyperplane parameters (linearly separable  case) */
+    double *error_cache;	/*error for each training point */
+    double **dense_points;	/*training data */
+    int *target;		/*class labels */
+    int kernel_type;		/*kernel type:1 linear, 2 gaussian, 3 squared gaussian */
+    int end_support_i;		/*set to N, never changed */
+    double (*learned_func) ();	/*the SVM */
+    double (*kernel_func) ();	/*the kernel */
+    double delta_b;		/*gap between old and updated offset */
+    double *precomputed_self_dot_product;	/*squared norm of the training data */
+    double *Cw;			/*weighted bias/variance parameter (sen/spe tuning) */
+    SVM_direct_kernel *models;
+    double **dot_prod;
+    double **H;
+    int n_direct_kernel;
+    int non_bound_support;	/*number of non bound SV */
+    int bound_support;		/*number of bound SV */
+    int maxloops;
+    int convergence;
+    int verbose;
+    double cost;		/*sen/spe cost (only for single svm) */
+    Features features;		/*the features used for the model development */
+} SupportVectorMachine;
+
+
+typedef struct
+{
+    SupportVectorMachine *svm;	/*the svm */
+    int nsvm;			/*number of svm */
+    double *weights;		/*their weights */
+    double w;			/*cost-sensitive parameter use (for boosting) */
+    double **w_evolution;
+    Features features;		/*the features used for the model development */
+} BSupportVectorMachine;
+
+typedef struct
+/*indeces of a matrix (row,col) and blob thay belog to (number) */
+{
+    int row;			/*row index of a point belonging to a blob */
+    int col;			/*row index of a point belonging to a blob */
+    int number /* blob number the point belong to */ ;
+} Blob;
+
+typedef struct
+/*geographical coordinates of the center of a blob and minimum 
+   value of the blob itself */
+{
+    double east;		/*east value of the center */
+    double north;		/*north value of the center */
+    double min;			/*minimum value of the blob */
+    double max;			/*minimum value of the blob */
+    int n;			/*number of points whitin the blob */
+} BlobSites;



More information about the grass-commit mailing list