1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-06-22 08:52:01 +01:00

3 Commits

3 changed files with 14 additions and 10 deletions

View File

@ -1,6 +1,6 @@
name: Build macOS name: Build macOS
on: [push] on: [push, workflow_dispatch]
jobs: jobs:
build: build:

View File

@ -7,7 +7,7 @@
using namespace std; using namespace std;
using namespace Latan; using namespace Latan;
constexpr Index size = 8; constexpr Index n = 8;
constexpr Index nDraw = 20000; constexpr Index nDraw = 20000;
constexpr Index nSample = 2000; constexpr Index nSample = 2000;
const string stateFileName = "exRand.seed"; const string stateFileName = "exRand.seed";
@ -40,14 +40,14 @@ int main(void)
p << PlotFunction(compile("return exp(-x_0^2/2)/sqrt(2*pi);", 1), -5., 5.); p << PlotFunction(compile("return exp(-x_0^2/2)/sqrt(2*pi);", 1), -5., 5.);
p.display(); p.display();
DMat var(size, size); DMat var(n, n);
DVec mean(size); DVec mean(n);
DMatSample sample(nSample, size, 1); DMatSample sample(nSample, n, 1);
cout << "-- generating " << nSample << " Gaussian random vectors..." << endl; cout << "-- generating " << nSample << " Gaussian random vectors..." << endl;
var = DMat::Random(size, size); var = DMat::Random(n, n);
var *= var.adjoint(); var *= var.adjoint();
mean = DVec::Random(size); mean = DVec::Random(n);
RandomNormal mgauss(mean, var, rd()); RandomNormal mgauss(mean, var, rd());
sample[central] = mgauss(); sample[central] = mgauss();
FOR_STAT_ARRAY(sample, s) FOR_STAT_ARRAY(sample, s)

View File

@ -24,7 +24,7 @@ int main(int argc, char *argv[])
{ {
// parse arguments ///////////////////////////////////////////////////////// // parse arguments /////////////////////////////////////////////////////////
OptParser opt; OptParser opt;
bool parsed, doLaplace, doPlot, doHeatmap, doCorr, fold, doScan; bool parsed, doLaplace, doPlot, doHeatmap, doCorr, fold, doScan, noGuess;
string corrFileName, model, outFileName, outFmt, savePlot; string corrFileName, model, outFileName, outFmt, savePlot;
Index ti, tf, shift, nPar, thinning; Index ti, tf, shift, nPar, thinning;
double svdTol; double svdTol;
@ -59,6 +59,8 @@ int main(int argc, char *argv[])
"show the fit plot"); "show the fit plot");
opt.addOption("h", "heatmap" , OptParser::OptType::trigger, true, opt.addOption("h", "heatmap" , OptParser::OptType::trigger, true,
"show the fit correlation heatmap"); "show the fit correlation heatmap");
opt.addOption("", "no-guess" , OptParser::OptType::trigger, true,
"do not try to guess fit parameters");
opt.addOption("", "save-plot", OptParser::OptType::value, true, opt.addOption("", "save-plot", OptParser::OptType::value, true,
"saves the source and .pdf", ""); "saves the source and .pdf", "");
opt.addOption("", "scan", OptParser::OptType::trigger, true, opt.addOption("", "scan", OptParser::OptType::trigger, true,
@ -87,6 +89,7 @@ int main(int argc, char *argv[])
fold = opt.gotOption("fold"); fold = opt.gotOption("fold");
doPlot = opt.gotOption("p"); doPlot = opt.gotOption("p");
doHeatmap = opt.gotOption("h"); doHeatmap = opt.gotOption("h");
noGuess = opt.gotOption("no-guess");
savePlot = opt.optionValue("save-plot"); savePlot = opt.optionValue("save-plot");
doScan = opt.gotOption("scan"); doScan = opt.gotOption("scan");
switch (opt.optionValue<unsigned int>("v")) switch (opt.optionValue<unsigned int>("v"))
@ -167,13 +170,14 @@ int main(int argc, char *argv[])
fitter.setThinning(thinning); fitter.setThinning(thinning);
// set initial values ****************************************************** // set initial values ******************************************************
if (modelPar.type != CorrelatorType::undefined) if ((modelPar.type != CorrelatorType::undefined) and !noGuess)
{ {
init = CorrelatorModels::parameterGuess(corr, modelPar); init = CorrelatorModels::parameterGuess(corr, modelPar);
} }
else else
{ {
init.fill(0.1); init.fill(1.);
init(0) = 0.2;
} }
// set limits for minimisers *********************************************** // set limits for minimisers ***********************************************