mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01:00
Merge branch 'master' into new_fit
This commit is contained in:
commit
c52c80ceae
13
lib/Math.cpp
13
lib/Math.cpp
@ -24,6 +24,19 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace Latan;
|
using namespace Latan;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Custom math functions *
|
||||||
|
******************************************************************************/
|
||||||
|
DMat MATH_NAMESPACE::varToCorr(const DMat &var)
|
||||||
|
{
|
||||||
|
DMat res = var, invDiag = res.diagonal();
|
||||||
|
|
||||||
|
invDiag = invDiag.cwiseInverse().cwiseSqrt();
|
||||||
|
res = (invDiag*invDiag.transpose()).cwiseProduct(res);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Standard C functions *
|
* Standard C functions *
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
@ -68,6 +68,9 @@ namespace MATH_NAMESPACE
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert variance matrix to correlation matrix
|
||||||
|
DMat varToCorr(const DMat &var);
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const double pi = 3.1415926535897932384626433832795028841970;
|
const double pi = 3.1415926535897932384626433832795028841970;
|
||||||
const double e = 2.7182818284590452353602874713526624977572;
|
const double e = 2.7182818284590452353602874713526624977572;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user