SAGA API v9.10
Loading...
Searching...
No Matches
mat_tools.h File Reference
#include "geo_tools.h"

Go to the source code of this file.

Classes

class  CSG_Index
class  CSG_Index::CSG_Index_Compare
class  CSG_PriorityQueue
class  CSG_PriorityQueue::CSG_PriorityQueueItem
class  CSG_Vector
class  CSG_Matrix
class  CSG_Grid_Radius
class  CSG_Random
class  CSG_Simple_Statistics
class  CSG_Unique_Value_Statistics
class  CSG_Unique_Number_Statistics
class  CSG_Unique_String_Statistics
class  CSG_Category_Statistics
class  CSG_Histogram
class  CSG_Natural_Breaks
class  CSG_Cluster_Analysis
class  CSG_Classifier_Supervised
class  CSG_Spline
class  CSG_Thin_Plate_Spline
class  CSG_Test_Distribution
class  CSG_Regression
class  CSG_Regression_Multiple
class  CSG_Regression_Weighted
class  CSG_Formula
struct  CSG_Formula::SSG_Function
class  CSG_Trend
class  CSG_Trend_Polynom

Macros

#define M_PI   3.141592653589793
#define M_PI_045   (M_PI / 4.)
#define M_PI_090   (M_PI / 2.)
#define M_PI_135   (M_PI * 3. / 4.)
#define M_PI_180   (M_PI)
#define M_PI_225   (M_PI * 5. / 4.)
#define M_PI_270   (M_PI * 3. / 2.)
#define M_PI_315   (M_PI * 7. / 4.)
#define M_PI_360   (M_PI * 2.)
#define M_RAD_TO_DEG   (180. / M_PI)
#define M_DEG_TO_RAD   (M_PI / 180.)
#define M_EULER   2.718281828459045
#define N_MEGABYTE_BYTES   0x100000
#define M_FLT_EPSILON   1.192092896e-07F
#define M_DBL_EPSILON   2.2204460492503131e-016
#define M_ALMOST_ZERO   (1.e-03)
#define M_TINY   (1.e-20)
#define M_SQR(x)
#define M_SQRT(x)
#define M_GET_LENGTH(x, y)
#define M_GET_MIN(a, b)
#define M_GET_MAX(a, b)
#define M_SET_MINMAX(min, max, x)
#define M_SET_SIGN(x, sign)
#define M_HAS_DECIMALS(x)
#define SG_ROUND_TO_BYTE(x)
#define SG_ROUND_TO_CHAR(x)
#define SG_ROUND_TO_WORD(x)
#define SG_ROUND_TO_SHORT(x)
#define SG_ROUND_TO_DWORD(x)
#define SG_ROUND_TO_INT(x)
#define SG_ROUND_TO_LONG(x)
#define SG_ROUND_TO_ULONG(x)
#define SG_ROUND_TO_SLONG(x)

Typedefs

typedef int(* TSG_PFNC_Compare) (const sLong a, const sLong b)
typedef double(* TSG_Formula_Function_0) (void)
typedef double(* TSG_Formula_Function_1) (double)
typedef double(* TSG_Formula_Function_2) (double, double)
typedef double(* TSG_Formula_Function_3) (double, double, double)

Enumerations

enum  ESG_Cluster_Analysis_Method { SG_CLUSTERANALYSIS_Minimum_Distance = 0 , SG_CLUSTERANALYSIS_Hill_Climbing , SG_CLUSTERANALYSIS_Combined }
enum  ESG_Classify_Supervised {
  SG_CLASSIFY_SUPERVISED_BinaryEncoding = 0 , SG_CLASSIFY_SUPERVISED_ParallelEpiped , SG_CLASSIFY_SUPERVISED_MinimumDistance , SG_CLASSIFY_SUPERVISED_Mahalonobis ,
  SG_CLASSIFY_SUPERVISED_MaximumLikelihood , SG_CLASSIFY_SUPERVISED_SAM , SG_CLASSIFY_SUPERVISED_WTA , SG_CLASSIFY_SUPERVISED_SID ,
  SG_CLASSIFY_SUPERVISED_SVM
}
enum  TSG_Test_Distribution_Type { TESTDIST_TYPE_Left = 0 , TESTDIST_TYPE_Right , TESTDIST_TYPE_Middle , TESTDIST_TYPE_TwoTail }
enum  TSG_Regression_Correction {
  REGRESSION_CORR_None = 0 , REGRESSION_CORR_Smith , REGRESSION_CORR_Wherry_1 , REGRESSION_CORR_Wherry_2 ,
  REGRESSION_CORR_Olkin_Pratt , REGRESSION_CORR_Pratt , REGRESSION_CORR_Claudy_3
}
enum  TSG_Regression_Type {
  REGRESSION_Linear = 0 , REGRESSION_Rez_X , REGRESSION_Rez_Y , REGRESSION_Pow ,
  REGRESSION_Exp , REGRESSION_Log
}
enum  ESG_Multiple_Regression_Info_Vars {
  MLR_VAR_ID = 0 , MLR_VAR_NAME , MLR_VAR_RCOEFF , MLR_VAR_R ,
  MLR_VAR_R2 , MLR_VAR_R2_ADJ , MLR_VAR_SE , MLR_VAR_T ,
  MLR_VAR_SIG , MLR_VAR_P
}
enum  ESG_Trend_String {
  SG_TREND_STRING_Formula = 0 , SG_TREND_STRING_Function , SG_TREND_STRING_Formula_Parameters , SG_TREND_STRING_Complete ,
  SG_TREND_STRING_Compact
}

Functions

SAGA_API_DLL_EXPORT double SG_Get_Square (double Value)
SAGA_API_DLL_EXPORT double SG_Get_Rounded (double Value, int Decimals=0)
SAGA_API_DLL_EXPORT double SG_Get_Rounded_To_SignificantFigures (double Value, int Decimals)
SAGA_API_DLL_EXPORT int SG_Get_Digit_Count (int Number)
SAGA_API_DLL_EXPORT CSG_String SG_Get_Double_asString (double Number, int Width=-1, int Precision=-1, bool bScientific=false)
SAGA_API_DLL_EXPORT int SG_Compare_Int (const void *a, const void *b)
SAGA_API_DLL_EXPORT int SG_Compare_Double (const void *a, const void *b)
SAGA_API_DLL_EXPORT int SG_Compare_Char_Ptr (const void *a, const void *b)
SAGA_API_DLL_EXPORT double SG_Degree_To_Decimal (double Deg, double Min, double Sec)
SAGA_API_DLL_EXPORT void SG_Decimal_To_Degree (double Value, double &Deg, double &Min, double &Sec)
SAGA_API_DLL_EXPORT CSG_Vector operator* (double Scalar, const CSG_Vector &Vector)
SAGA_API_DLL_EXPORT bool SG_VectorR2_Rotate (double &x, double &y, double Angle)
SAGA_API_DLL_EXPORT bool SG_VectorR2_Rotate (double Vector[2], double Angle)
SAGA_API_DLL_EXPORT bool SG_VectorR2_Rotate (CSG_Vector &Vector, double Angle)
SAGA_API_DLL_EXPORT bool SG_VectorR3_Rotate (double Vector[3], size_t Axis, double Angle)
SAGA_API_DLL_EXPORT bool SG_VectorR3_Rotate (CSG_Vector &Vector, size_t Axis, double Angle)
SAGA_API_DLL_EXPORT CSG_Matrix operator* (double Scalar, const CSG_Matrix &Matrix)
SAGA_API_DLL_EXPORT CSG_Matrix SG_Matrix_Get_Rotation (double R, bool bDegree=false)
SAGA_API_DLL_EXPORT CSG_Matrix SG_Matrix_Get_Rotation (double Rx, double Ry, double Rz, bool bDegree=false)
SAGA_API_DLL_EXPORT bool SG_Matrix_LU_Decomposition (int n, int *Permutation, double **Matrix, bool bSilent=true, int *nRowChanges=NULL)
SAGA_API_DLL_EXPORT bool SG_Matrix_LU_Solve (int n, const int *Permutation, const double **Matrix, double *Vector, bool bSilent=true)
SAGA_API_DLL_EXPORT bool SG_Matrix_Solve (CSG_Matrix &Matrix, CSG_Vector &Vector, bool bSilent=true)
SAGA_API_DLL_EXPORT bool SG_Matrix_Eigen_Reduction (const CSG_Matrix &Matrix, CSG_Matrix &Eigen_Vectors, CSG_Vector &Eigen_Values, bool bSilent=true)
SAGA_API_DLL_EXPORT CSG_Matrix SG_Get_Correlation_Matrix (const CSG_Matrix &Values, bool bCovariances=false)
SAGA_API_DLL_EXPORT double SG_Regression_Get_Adjusted_R2 (double R2, int nSamples, int nPredictors, TSG_Regression_Correction Correction=REGRESSION_CORR_Wherry_1)

Detailed Description

Macro Definition Documentation

◆ M_ALMOST_ZERO

#define M_ALMOST_ZERO   (1.e-03)

Definition at line 131 of file mat_tools.h.

◆ M_DBL_EPSILON

#define M_DBL_EPSILON   2.2204460492503131e-016

Definition at line 127 of file mat_tools.h.

◆ M_DEG_TO_RAD

◆ M_EULER

#define M_EULER   2.718281828459045

Definition at line 112 of file mat_tools.h.

◆ M_FLT_EPSILON

#define M_FLT_EPSILON   1.192092896e-07F

◆ M_GET_LENGTH

#define M_GET_LENGTH ( x,
y )
Value:
sqrt((double)((x)*(x) + (y)*(y)))

Definition at line 139 of file mat_tools.h.

Referenced by CSG_Grid_Radius::Create().

◆ M_GET_MAX

#define M_GET_MAX ( a,
b )
Value:
(((a) > (b)) ? (a) : (b))

Definition at line 142 of file mat_tools.h.

Referenced by SG_Get_Crossing().

◆ M_GET_MIN

#define M_GET_MIN ( a,
b )
Value:
(((a) < (b)) ? (a) : (b))

Definition at line 141 of file mat_tools.h.

Referenced by CSG_Table_DBase::Set_Value(), CSG_Table_DBase::Set_Value(), and SG_Get_Crossing().

◆ M_HAS_DECIMALS

#define M_HAS_DECIMALS ( x)
Value:
(x - floor(x) > 0.)

Definition at line 147 of file mat_tools.h.

Referenced by CSG_Parameters_Grid_Target::On_Parameter_Changed(), and CSG_Parameters_Grid_Target::Set_User_Defined().

◆ M_PI

#define M_PI   3.141592653589793

Definition at line 96 of file mat_tools.h.

Referenced by f_pi(), CSG_Colors::Set_Default(), and SG_Get_Day_Length().

◆ M_PI_045

#define M_PI_045   (M_PI / 4.)

Definition at line 99 of file mat_tools.h.

◆ M_PI_090

#define M_PI_090   (M_PI / 2.)

◆ M_PI_135

#define M_PI_135   (M_PI * 3. / 4.)

Definition at line 101 of file mat_tools.h.

◆ M_PI_180

◆ M_PI_225

#define M_PI_225   (M_PI * 5. / 4.)

Definition at line 103 of file mat_tools.h.

◆ M_PI_270

#define M_PI_270   (M_PI * 3. / 2.)

◆ M_PI_315

#define M_PI_315   (M_PI * 7. / 4.)

Definition at line 105 of file mat_tools.h.

◆ M_PI_360

#define M_PI_360   (M_PI * 2.)

◆ M_RAD_TO_DEG

#define M_RAD_TO_DEG   (180. / M_PI)

Definition at line 108 of file mat_tools.h.

Referenced by SG_Get_Sun_Refraction().

◆ M_SET_MINMAX

#define M_SET_MINMAX ( min,
max,
x )
Value:
if( min > x ) { min = x; } else if( max < x ) { max = x; }

Definition at line 143 of file mat_tools.h.

◆ M_SET_SIGN

#define M_SET_SIGN ( x,
sign )
Value:
((sign) < 0 ? (x < 0 ? x : -x) : (x > 0 ? x : -x))

Definition at line 145 of file mat_tools.h.

Referenced by SG_Matrix_Tridiagonal_QL().

◆ M_SQR

#define M_SQR ( x)
Value:
((x) * (x))

Definition at line 137 of file mat_tools.h.

◆ M_SQRT

#define M_SQRT ( x)
Value:
sqrt((double)(x))

Definition at line 138 of file mat_tools.h.

◆ M_TINY

#define M_TINY   (1.e-20)

Definition at line 132 of file mat_tools.h.

◆ N_MEGABYTE_BYTES

#define N_MEGABYTE_BYTES   0x100000

◆ SG_ROUND_TO_BYTE

#define SG_ROUND_TO_BYTE ( x)
Value:
((BYTE )(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 150 of file mat_tools.h.

Referenced by CSG_Grid::asByte(), CSG_Grid::asByte(), CSG_Grids::asByte(), CSG_Grids::asByte(), and CSG_Grid::Set_Value().

◆ SG_ROUND_TO_CHAR

#define SG_ROUND_TO_CHAR ( x)
Value:
((char )(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 151 of file mat_tools.h.

Referenced by CSG_Grid::asChar(), CSG_Grid::asChar(), CSG_Grids::asChar(), CSG_Grids::asChar(), and CSG_Grid::Set_Value().

◆ SG_ROUND_TO_DWORD

#define SG_ROUND_TO_DWORD ( x)
Value:
((DWORD)(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 154 of file mat_tools.h.

Referenced by CSG_Grid::Set_Value().

◆ SG_ROUND_TO_INT

#define SG_ROUND_TO_INT ( x)
Value:
((int )(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 155 of file mat_tools.h.

Referenced by CSG_Grid::asInt(), CSG_Grid::asInt(), CSG_Grids::asInt(), CSG_Grids::asInt(), and CSG_Grid::Set_Value().

◆ SG_ROUND_TO_LONG

#define SG_ROUND_TO_LONG ( x)
Value:
((long )(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 156 of file mat_tools.h.

◆ SG_ROUND_TO_SHORT

#define SG_ROUND_TO_SHORT ( x)
Value:
((short)(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 153 of file mat_tools.h.

Referenced by CSG_Grid::asShort(), CSG_Grid::asShort(), CSG_Grids::asShort(), CSG_Grids::asShort(), and CSG_Grid::Set_Value().

◆ SG_ROUND_TO_SLONG

#define SG_ROUND_TO_SLONG ( x)
Value:
((sLong)(x < 0. ? x - 0.5 : x + 0.5))
signed long long sLong
Definition api_core.h:158

Definition at line 158 of file mat_tools.h.

Referenced by CSG_Grid::asLong(), CSG_Grid::asLong(), CSG_Grids::asLong(), CSG_Grids::asLong(), and CSG_Grid::Set_Value().

◆ SG_ROUND_TO_ULONG

#define SG_ROUND_TO_ULONG ( x)
Value:
((uLong)(x < 0. ? x - 0.5 : x + 0.5))
unsigned long long uLong
Definition api_core.h:159

Definition at line 157 of file mat_tools.h.

Referenced by CSG_Grid::Set_Value().

◆ SG_ROUND_TO_WORD

#define SG_ROUND_TO_WORD ( x)
Value:
((WORD )(x < 0. ? x - 0.5 : x + 0.5))

Definition at line 152 of file mat_tools.h.

Referenced by CSG_Grid::Set_Value().

Typedef Documentation

◆ TSG_Formula_Function_0

typedef double(* TSG_Formula_Function_0) (void)

Definition at line 1874 of file mat_tools.h.

◆ TSG_Formula_Function_1

typedef double(* TSG_Formula_Function_1) (double)

Definition at line 1875 of file mat_tools.h.

◆ TSG_Formula_Function_2

typedef double(* TSG_Formula_Function_2) (double, double)

Definition at line 1876 of file mat_tools.h.

◆ TSG_Formula_Function_3

typedef double(* TSG_Formula_Function_3) (double, double, double)

Definition at line 1877 of file mat_tools.h.

◆ TSG_PFNC_Compare

typedef int(* TSG_PFNC_Compare) (const sLong a, const sLong b)

Definition at line 196 of file mat_tools.h.

Enumeration Type Documentation

◆ ESG_Classify_Supervised

Enumerator
SG_CLASSIFY_SUPERVISED_BinaryEncoding 
SG_CLASSIFY_SUPERVISED_ParallelEpiped 
SG_CLASSIFY_SUPERVISED_MinimumDistance 
SG_CLASSIFY_SUPERVISED_Mahalonobis 
SG_CLASSIFY_SUPERVISED_MaximumLikelihood 
SG_CLASSIFY_SUPERVISED_SAM 
SG_CLASSIFY_SUPERVISED_WTA 
SG_CLASSIFY_SUPERVISED_SID 
SG_CLASSIFY_SUPERVISED_SVM 

Definition at line 1223 of file mat_tools.h.

◆ ESG_Cluster_Analysis_Method

Enumerator
SG_CLUSTERANALYSIS_Minimum_Distance 
SG_CLUSTERANALYSIS_Hill_Climbing 
SG_CLUSTERANALYSIS_Combined 

Definition at line 1157 of file mat_tools.h.

◆ ESG_Multiple_Regression_Info_Vars

Enumerator
MLR_VAR_ID 
MLR_VAR_NAME 
MLR_VAR_RCOEFF 
MLR_VAR_R 
MLR_VAR_R2 
MLR_VAR_R2_ADJ 
MLR_VAR_SE 
MLR_VAR_T 
MLR_VAR_SIG 
MLR_VAR_P 

Definition at line 1693 of file mat_tools.h.

◆ ESG_Trend_String

Enumerator
SG_TREND_STRING_Formula 
SG_TREND_STRING_Function 
SG_TREND_STRING_Formula_Parameters 
SG_TREND_STRING_Complete 
SG_TREND_STRING_Compact 

Definition at line 1981 of file mat_tools.h.

◆ TSG_Regression_Correction

Enumerator
REGRESSION_CORR_None 
REGRESSION_CORR_Smith 
REGRESSION_CORR_Wherry_1 
REGRESSION_CORR_Wherry_2 
REGRESSION_CORR_Olkin_Pratt 
REGRESSION_CORR_Pratt 
REGRESSION_CORR_Claudy_3 

Definition at line 1582 of file mat_tools.h.

◆ TSG_Regression_Type

Enumerator
REGRESSION_Linear 
REGRESSION_Rez_X 
REGRESSION_Rez_Y 
REGRESSION_Pow 
REGRESSION_Exp 
REGRESSION_Log 

Definition at line 1603 of file mat_tools.h.

◆ TSG_Test_Distribution_Type

Enumerator
TESTDIST_TYPE_Left 
TESTDIST_TYPE_Right 
TESTDIST_TYPE_Middle 
TESTDIST_TYPE_TwoTail 

Definition at line 1524 of file mat_tools.h.

Function Documentation

◆ operator*() [1/2]

SAGA_API_DLL_EXPORT CSG_Matrix operator* ( double Scalar,
const CSG_Matrix & Matrix )

Definition at line 1699 of file mat_matrix.cpp.

◆ operator*() [2/2]

SAGA_API_DLL_EXPORT CSG_Vector operator* ( double Scalar,
const CSG_Vector & Vector )

Definition at line 579 of file mat_matrix.cpp.

◆ SG_Compare_Char_Ptr()

SAGA_API_DLL_EXPORT int SG_Compare_Char_Ptr ( const void * a,
const void * b )

Definition at line 211 of file mat_tools.cpp.

◆ SG_Compare_Double()

SAGA_API_DLL_EXPORT int SG_Compare_Double ( const void * a,
const void * b )

◆ SG_Compare_Int()

SAGA_API_DLL_EXPORT int SG_Compare_Int ( const void * a,
const void * b )

Definition at line 187 of file mat_tools.cpp.

◆ SG_Decimal_To_Degree()

SAGA_API_DLL_EXPORT void SG_Decimal_To_Degree ( double Value,
double & Deg,
double & Min,
double & Sec )

Definition at line 233 of file mat_tools.cpp.

◆ SG_Degree_To_Decimal()

SAGA_API_DLL_EXPORT double SG_Degree_To_Decimal ( double Deg,
double Min,
double Sec )

Definition at line 224 of file mat_tools.cpp.

◆ SG_Get_Correlation_Matrix()

SAGA_API_DLL_EXPORT CSG_Matrix SG_Get_Correlation_Matrix ( const CSG_Matrix & Values,
bool bCovariances = false )

◆ SG_Get_Digit_Count()

SAGA_API_DLL_EXPORT int SG_Get_Digit_Count ( int Number)

Definition at line 144 of file mat_tools.cpp.

Referenced by CSG_Matrix::to_String().

◆ SG_Get_Double_asString()

SAGA_API_DLL_EXPORT CSG_String SG_Get_Double_asString ( double Number,
int Width = -1,
int Precision = -1,
bool bScientific = false )

Definition at line 159 of file mat_tools.cpp.

References CSG_String::Format().

Referenced by CSG_Matrix::to_String(), and CSG_Vector::to_String().

◆ SG_Get_Rounded()

SAGA_API_DLL_EXPORT double SG_Get_Rounded ( double Value,
int Decimals = 0 )

Definition at line 83 of file mat_tools.cpp.

Referenced by CSG_Grid_System::Create().

◆ SG_Get_Rounded_To_SignificantFigures()

◆ SG_Get_Square()

◆ SG_Matrix_Eigen_Reduction()

SAGA_API_DLL_EXPORT bool SG_Matrix_Eigen_Reduction ( const CSG_Matrix & Matrix,
CSG_Matrix & Eigen_Vectors,
CSG_Vector & Eigen_Values,
bool bSilent = true )

◆ SG_Matrix_Get_Rotation() [1/2]

SAGA_API_DLL_EXPORT CSG_Matrix SG_Matrix_Get_Rotation ( double R,
bool bDegree )

Returns a rotation matrix applicable to 2d vectors for given rotation angle (R).

Definition at line 1866 of file mat_matrix.cpp.

References M_DEG_TO_RAD.

◆ SG_Matrix_Get_Rotation() [2/2]

SAGA_API_DLL_EXPORT CSG_Matrix SG_Matrix_Get_Rotation ( double Rx,
double Ry,
double Rz,
bool bDegree )

Returns a rotation matrix applicable to 3d vectors for rotations about the x-, y-, and z-axis (Rx, Ry, Rz).

Definition at line 1885 of file mat_matrix.cpp.

References M_DEG_TO_RAD.

◆ SG_Matrix_LU_Decomposition()

SAGA_API_DLL_EXPORT bool SG_Matrix_LU_Decomposition ( int n,
int * Permutation,
double ** Matrix,
bool bSilent = true,
int * nRowChanges = NULL )

◆ SG_Matrix_LU_Solve()

SAGA_API_DLL_EXPORT bool SG_Matrix_LU_Solve ( int n,
const int * Permutation,
const double ** Matrix,
double * Vector,
bool bSilent = true )

Definition at line 2053 of file mat_matrix.cpp.

References SG_UI_Process_Set_Progress().

Referenced by CSG_Matrix::Set_Inverse(), and SG_Matrix_Solve().

◆ SG_Matrix_Solve()

◆ SG_Regression_Get_Adjusted_R2()

◆ SG_VectorR2_Rotate() [1/3]

SAGA_API_DLL_EXPORT bool SG_VectorR2_Rotate ( CSG_Vector & Vector,
double Angle )

Definition at line 770 of file mat_matrix.cpp.

References CSG_Vector::Get_Size(), and SG_VectorR2_Rotate().

◆ SG_VectorR2_Rotate() [2/3]

SAGA_API_DLL_EXPORT bool SG_VectorR2_Rotate ( double & x,
double & y,
double Angle )

Definition at line 750 of file mat_matrix.cpp.

Referenced by SG_VectorR2_Rotate(), and SG_VectorR2_Rotate().

◆ SG_VectorR2_Rotate() [3/3]

SAGA_API_DLL_EXPORT bool SG_VectorR2_Rotate ( double Vector[2],
double Angle )

Definition at line 764 of file mat_matrix.cpp.

References SG_VectorR2_Rotate().

◆ SG_VectorR3_Rotate() [1/2]

SAGA_API_DLL_EXPORT bool SG_VectorR3_Rotate ( CSG_Vector & Vector,
size_t Axis,
double Angle )

◆ SG_VectorR3_Rotate() [2/2]

SAGA_API_DLL_EXPORT bool SG_VectorR3_Rotate ( double Vector[3],
size_t Axis,
double Angle )

Definition at line 776 of file mat_matrix.cpp.

Referenced by SG_VectorR3_Rotate().