grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

n_tools.c File Reference
#include <math.h>
#include <grass/N_pde.h>
#include <grass/glocale.h>
Include dependency graph for n_tools.c:

Go to the source code of this file.

Functions

double N_calc_arith_mean (double a, double b)
 Calculate the arithmetic mean of values a and b. More...
 
double N_calc_arith_mean_n (double *a, int size)
 Calculate the arithmetic mean of the values in vector a of size n. More...
 
double N_calc_geom_mean (double a, double b)
 Calculate the geometrical mean of values a and b. More...
 
double N_calc_geom_mean_n (double *a, int size)
 Calculate the geometrical mean of the values in vector a of size n. More...
 
double N_calc_harmonic_mean (double a, double b)
 Calculate the harmonical mean of values a and b. More...
 
double N_calc_harmonic_mean_n (double *a, int size)
 Calculate the harmonical mean of the values in vector a of size n. More...
 
double N_calc_quad_mean (double a, double b)
 Calculate the quadratic mean of values a and b. More...
 
double N_calc_quad_mean_n (double *a, int size)
 Calculate the quadratic mean of the values in vector a of size n. More...
 

Function Documentation

◆ N_calc_arith_mean()

double N_calc_arith_mean ( double  a,
double  b 
)

Calculate the arithmetic mean of values a and b.

MODULE: Grass PDE Numerical Library AUTHOR(S): Soeren Gebbert, Berlin (GER) Dec 2006 soerengebbert <at> gmx <dot> de

PURPOSE: Array management functions part of the gpde library

COPYRIGHT: (C) 2000 by the GRASS Development Team

          This program is free software under the GNU General Public
          License (>=v2). Read the file COPYING that comes with GRASS
          for details.

mean = (a+b)/2

Parameters
adouble
bdouble
Returns
val double

Definition at line 33 of file n_tools.c.

References a, and b.

Referenced by N_callback_gwflow_2d().

◆ N_calc_arith_mean_n()

double N_calc_arith_mean_n ( double *  a,
int  size 
)

Calculate the arithmetic mean of the values in vector a of size n.

n = [0 ... size[ mean = (a[0] + a[1] + ... + a[n])/size

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double

Definition at line 53 of file n_tools.c.

References a.

◆ N_calc_geom_mean()

double N_calc_geom_mean ( double  a,
double  b 
)

Calculate the geometrical mean of values a and b.

mean = sqrt(a*b)

Parameters
adouble
bdouble
Returns
val double

Definition at line 76 of file n_tools.c.

References a, and b.

Referenced by N_callback_solute_transport_2d().

◆ N_calc_geom_mean_n()

double N_calc_geom_mean_n ( double *  a,
int  size 
)

Calculate the geometrical mean of the values in vector a of size n.

n = [0 ... size[ mean = pow((a[0] * a[1] * ... * a[n]), 1.0/size)

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double

Definition at line 96 of file n_tools.c.

References a.

◆ N_calc_harmonic_mean()

double N_calc_harmonic_mean ( double  a,
double  b 
)

Calculate the harmonical mean of values a and b.

mean = 2*(a*b)/(a + b)

Parameters
adouble
bdouble
Returns
val double – if (a + b) == 0, a 0 is returned

Definition at line 119 of file n_tools.c.

References a, and b.

Referenced by N_callback_gwflow_2d(), N_callback_gwflow_3d(), N_callback_solute_transport_2d(), N_callback_solute_transport_3d(), N_compute_gradient_field_2d(), and N_compute_gradient_field_3d().

◆ N_calc_harmonic_mean_n()

double N_calc_harmonic_mean_n ( double *  a,
int  size 
)

Calculate the harmonical mean of the values in vector a of size n.

n = [0 ... size[ mean = 1/(1/size *(1/a[0] + 1/a[1] + ... + 1/a[n]))

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double – if one division with 0 is detected, 0 will be returned

Definition at line 140 of file n_tools.c.

References a.

◆ N_calc_quad_mean()

double N_calc_quad_mean ( double  a,
double  b 
)

Calculate the quadratic mean of values a and b.

mean = sqrt((a*a + b*b)/2)

Parameters
adouble
bdouble
Returns
val double

Definition at line 169 of file n_tools.c.

References a, and b.

◆ N_calc_quad_mean_n()

double N_calc_quad_mean_n ( double *  a,
int  size 
)

Calculate the quadratic mean of the values in vector a of size n.

n = [0 ... size[ mean = sqrt((a[0]*a[0] + a[1]*a[1] + ... + a[n]*a[n])/size)

Parameters
adouble * – the value vector
sizeint – the size of the vector a
Returns
val double

Definition at line 189 of file n_tools.c.

References a.