mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-11-05 08:29:32 +00:00
Compare commits
2 Commits
9a27a58bf2
...
e4861e7b50
| Author | SHA1 | Date | |
|---|---|---|---|
| e4861e7b50 | |||
| ee60d083c8 |
@@ -166,5 +166,17 @@ auto chi2CcdfVecFunc = [](const double arg[2])
|
||||
return gsl_cdf_chisq_Q(arg[0], arg[1]);
|
||||
};
|
||||
|
||||
auto hotellingT2PValueVecFunc = [](const double arg[3])
|
||||
{
|
||||
double T2 = arg[0];
|
||||
double n = arg[1];
|
||||
double p = arg[2];
|
||||
double F = (n - p) / (p * (n - 1)) * T2;
|
||||
double p_value = 1.0 - gsl_cdf_fdist_P(F, p, n - p);
|
||||
|
||||
return p_value;
|
||||
};
|
||||
|
||||
DoubleFunction MATH_NAMESPACE::chi2PValue(chi2PValueVecFunc, 2);
|
||||
DoubleFunction MATH_NAMESPACE::chi2Ccdf(chi2CcdfVecFunc, 2);
|
||||
DoubleFunction MATH_NAMESPACE::hotellingT2PValue(hotellingT2PValueVecFunc, 3);
|
||||
|
||||
@@ -160,6 +160,7 @@ namespace MATH_NAMESPACE
|
||||
{
|
||||
extern DoubleFunction chi2PValue;
|
||||
extern DoubleFunction chi2Ccdf;
|
||||
extern DoubleFunction hotellingT2PValue;
|
||||
}
|
||||
|
||||
END_LATAN_NAMESPACE
|
||||
|
||||
@@ -511,6 +511,36 @@ PlotImpulses::PlotImpulses(const DVec &x, const DVec &y)
|
||||
setCommand("'" + tmpFileName + "' u 1:2 w impulses");
|
||||
}
|
||||
|
||||
// PlotGrid constructor ////////////////////////////////////////////////////////
|
||||
PlotGrid::PlotGrid(const DVec &x, const DVec &y, const DMat &value)
|
||||
{
|
||||
if (x.size() != value.rows())
|
||||
{
|
||||
LATAN_ERROR(Size, "x vector does not have the same size as value matrix rows");
|
||||
}
|
||||
if (y.size() != value.cols())
|
||||
{
|
||||
LATAN_ERROR(Size, "y vector does not have the same size as value matrix columns");
|
||||
}
|
||||
if (value.rows() < 2 || value.cols() < 2)
|
||||
{
|
||||
LATAN_ERROR(Size, "value matrix must have at least 2 rows and 2 columns");
|
||||
}
|
||||
DMat d(value.cols()+1, value.rows()+1);
|
||||
string tmpFileName;
|
||||
d(0,0) = value.cols();
|
||||
d.row(0).tail(value.cols()) = x;
|
||||
d.col(0).tail(value.rows()) = y;
|
||||
for (Index i = 0; i < value.rows(); ++i)
|
||||
for (Index j = 0; j < value.cols(); ++j)
|
||||
{
|
||||
d(i+1, j+1) = value(j, i);
|
||||
}
|
||||
tmpFileName = dumpToTmpFile(d);
|
||||
pushTmpFile(tmpFileName);
|
||||
setCommand("'" + tmpFileName + "' nonuniform matrix w image");
|
||||
}
|
||||
|
||||
// PlotMatrixNoRange constructor ///////////////////////////////////////////////
|
||||
PlotMatrixNoRange::PlotMatrixNoRange(const DMat &m)
|
||||
{
|
||||
|
||||
@@ -200,6 +200,15 @@ public:
|
||||
virtual ~PlotImpulses(void) = default;
|
||||
};
|
||||
|
||||
class PlotGrid: public PlotObject
|
||||
{
|
||||
public:
|
||||
// constructor
|
||||
PlotGrid(const DVec &x, const DVec &y, const DMat &value);
|
||||
// destructor
|
||||
virtual ~PlotGrid(void) = default;
|
||||
};
|
||||
|
||||
class PlotMatrixNoRange: public PlotObject
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user