diff --git a/pub/lib/commands.cpp b/pub/lib/commands.cpp index 86d3c7d8b2b5cd7f094c3af6322a06ba8cf9fcb0..9a3af9640b9ed0ca6e67b4b70cb5e72a434268a7 100644 --- a/pub/lib/commands.cpp +++ b/pub/lib/commands.cpp @@ -85,19 +85,24 @@ bool frida_command( string cmd ) " ! operate in place (overwrite)\n" "More help:\n" " \\h help on meta commands and macros\n" - " hf print list of functions of scalar arguments\n" - " ho print list of operators by precedence\n" - " hg generalized integrals\n" - " hi curve functionals\n" + " hf functions of scalar arguments\n" + " ho operators by precedence\n" + " hid dimension-reducing functionals of data (replacing 'oio')\n" + " hic dimension-reducing functionals of curves\n" ; } else if (cmd == "hf") { GFuncRegistry->display_functions(); } else if (cmd == "ho") { GFuncRegistry->display_operators(); - } else if (cmd == "hg") { - NGeni::display_genis(); } else if (cmd == "hi") { + cout << + " hid dimension-reducing functionals of data (replacing 'oio')\n" + " hic dimension-reducing functionals of curves\n" + ; + } else if (cmd == "hid" || cmd == "oio") { + NGeni::display_genis(); + } else if (cmd == "hic") { NCvin::display_cvins(); } else if (cmd == "b") { diff --git a/pub/lib/geni.cpp b/pub/lib/geni.cpp index 4b98d75afa62b6cd33f74e5c3e1fb30f564df3f7..8361456e83c66eca681f351653cd5207dc3779d0 100644 --- a/pub/lib/geni.cpp +++ b/pub/lib/geni.cpp @@ -244,16 +244,16 @@ namespace NGeni { // internals: vector<const CGeni*> glist; // sorted array, for help text } -CGeni::CGeni( string _name, int _narg, string _def, geni_eval _eval, string _com ) - : name(_name), narg(_narg), eval(_eval), com(_com) +CGeni::CGeni( string _name, int _narg, string _default_arg_str, geni_eval _eval, string _com ) + : name(_name), narg(_narg), default_arg_str(_default_arg_str), eval(_eval), com(_com) { - vector<string> def_expr; - triv::split( _def, def_expr, "," ); - if ( def_expr.size()!=narg ) - throw "BUG: invalid default "+_def+" for CGeni "+name; - def_arg.resize(narg); + vector<string> default_expr; + triv::split( _default_arg_str, default_expr, "," ); + if ( default_expr.size()!=narg ) + throw "BUG: invalid default "+_default_arg_str+" for CGeni "+name; + default_arg.resize(narg); for ( int iarg=0; iarg<narg; ++iarg ) - def_arg[iarg] = user_xaxparse( def_expr[iarg].c_str() ); + default_arg[iarg] = user_xaxparse( default_expr[iarg].c_str() ); } const CGeni* NGeni::find( string key ) @@ -270,12 +270,19 @@ void CGeni::register_me() const void NGeni::display_genis() { - cout << "Generalized integrals:\n"; + cout << "Dimension-reducing functionals of data sets.\n"; + cout << "Usage:\n"; + cout << " - most typically in command 'oi'\n"; + cout << " - also directly at the command prompt (pocket-calculator mode, only for nj=1)\n"; + cout << " - or as part of more complex expressions (e.g. 'oy y/integral(x,y)')\n"; + cout << "Arguments:\n"; + cout << " - most typically just 'x' or 'y',\n"; + cout << " but any other array is allowed, e.g. 'y[,0]' or 'z0[k+2]'\n"; + cout << " - list shows default arguments that are assumed when functional name is not\n"; + cout << " followed by a parenthesis: 'integral' is shorthand for 'integral(x,y)'\n"; + cout << "Implemented functionals:\n"; for( auto g = glist.begin(); g!=glist.end(); ++g ) { - string s1 = (*g)->name + "(a"; - if( (*g)->narg>1 ) - s1 += ",b"; - s1 += ")"; + string s1 = (*g)->name + "(" + (*g)->default_arg_str + ")"; cout << " " << str( format("%-14s") % s1 ) << (*g)->com << "\n"; } } @@ -284,29 +291,29 @@ void NGeni::initialize() { // operators by precedence (as in xax_yacc.ypp): (new CGeni( "valmin", 1, "y", geni_valmin, - "minimum value of a" ))->register_me(); + "minimum value of y" ))->register_me(); (new CGeni( "valmax", 1, "y", geni_valmax, - "maximum value of a" ))->register_me(); + "maximum value of y" ))->register_me(); (new CGeni( "argmin", 2, "x,y", geni_argmin, - "value of a for which b is minimal" ))->register_me(); + "value of x for which y is minimal" ))->register_me(); (new CGeni( "argmax", 2, "x,y", geni_argmax, - "value of a for which b is maximal" ))->register_me(); + "value of x for which y is maximal" ))->register_me(); (new CGeni( "idxmin", 1, "y", geni_idxmin, - "index for which a is minimal" ))->register_me(); + "index for which x is minimal" ))->register_me(); (new CGeni( "idxmax", 1, "y", geni_idxmax, - "index for which a is maximal" ))->register_me(); + "index for which y is maximal" ))->register_me(); (new CGeni( "sum", 1, "y", geni_sum, - "sum of a" ))->register_me(); + "sum of y" ))->register_me(); (new CGeni( "avge", 1, "y", geni_avge, - "average of a" ))->register_me(); + "average of y" ))->register_me(); (new CGeni( "stdv", 1, "y", geni_stdv, - "corrected sample standard deviation of a" ))->register_me(); + "corrected sample standard deviation of x" ))->register_me(); (new CGeni( "integral", 2, "x,y", geni_integral, - "integral d(a) of b" ))->register_me(); + "integral d(x) of y" ))->register_me(); (new CGeni( "cog", 2, "x,y", geni_cog, - "center of gravity of a weighed with b" ))->register_me(); + "center of gravity of x weighed with y" ))->register_me(); (new CGeni( "width", 2, "x,y", geni_width, - "standard variation in a weighed with b" ))->register_me(); + "standard variation in x weighed with y" ))->register_me(); (new CGeni( "corr", 2, "x,y", geni_corr, - "correlation coefficient of a and b" ))->register_me(); -} \ No newline at end of file + "correlation coefficient of x and y" ))->register_me(); +} diff --git a/pub/lib/geni.hpp b/pub/lib/geni.hpp index eee19e692ac0f41c745abe8f169e87672bfb22a6..0d3b02fff4fcb3bedb2321613cb73ac903b458c0 100644 --- a/pub/lib/geni.hpp +++ b/pub/lib/geni.hpp @@ -19,12 +19,13 @@ class CGeni { public: string name; int narg; + string default_arg_str; geni_eval eval; string com; - vector<RNode> def_arg; + vector<RNode> default_arg; class CCoord coord( class CCoord *co ) const; class CCoord coord( class CCoord *co1, class CCoord *co2 ) const; - CGeni( string _txt, int _narg, string _def, geni_eval _eval, string _com="" ); + CGeni( string _txt, int _narg, string _default_arg_str, geni_eval _eval, string _com="" ); void register_me() const; }; diff --git a/pub/lib/node.cpp b/pub/lib/node.cpp index bee056b19b56b7f7b6f721e4ee0173cbb5285b3f..0a49ad5347688517ec3b870151c430197b14b3d7 100644 --- a/pub/lib/node.cpp +++ b/pub/lib/node.cpp @@ -504,7 +504,7 @@ CNodeGeni::CNodeGeni( const class CGeni *_geni, RRef _ref ) { arg.resize(narg); for ( int iarg=0; iarg<narg; ++iarg ) - arg[iarg] = geni->def_arg[iarg]; + arg[iarg] = geni->default_arg[iarg]; } CNodeGeni::CNodeGeni( const class CGeni *_geni, RNode _a0 )