MLPACK
1.0.8
|
Go to the source code of this file.
Classes | |
class | mlpack::CLI |
Parses the command line for parameters and holds user-specified parameters. More... | |
struct | mlpack::ParamData |
Aids in the extensibility of CLI by focusing potential changes into one structure. More... | |
Namespaces | |
mlpack | |
Linear algebra utility functions, generally performed on matrices or vectors. | |
mlpack::util | |
Macros | |
#define | PARAM(T, ID, DESC, ALIAS, DEF, REQ) |
Define an input parameter. More... | |
#define | PARAM_DOUBLE(ID, DESC, ALIAS, DEF) PARAM(double, ID, DESC, ALIAS, DEF, false) |
Define a double parameter. More... | |
#define | PARAM_DOUBLE_REQ(ID, DESC, ALIAS) |
Define a required double parameter. More... | |
#define | PARAM_FLAG(ID, DESC, ALIAS) PARAM_FLAG_INTERNAL(ID, DESC, ALIAS); |
Define a flag parameter. More... | |
#define | PARAM_FLOAT(ID, DESC, ALIAS, DEF) PARAM(float, ID, DESC, ALIAS, DEF, false) |
Define a floating-point parameter. More... | |
#define | PARAM_FLOAT_REQ(ID, DESC, ALIAS) |
Define a required floating-point parameter. More... | |
#define | PARAM_INT(ID, DESC, ALIAS, DEF) PARAM(int, ID, DESC, ALIAS, DEF, false) |
Define an integer parameter. More... | |
#define | PARAM_INT_REQ(ID, DESC, ALIAS) PARAM(int, ID, DESC, ALIAS, 0, true) |
Define a required integer parameter. More... | |
#define | PARAM_STRING(ID, DESC, ALIAS, DEF) PARAM(std::string, ID, DESC, ALIAS, DEF, false) |
Define a string parameter. More... | |
#define | PARAM_STRING_REQ(ID, DESC, ALIAS) |
Define a required string parameter. More... | |
#define | PARAM_VECTOR(T, ID, DESC, ALIAS) PARAM(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), false) |
Define a vector parameter. More... | |
#define | PARAM_VECTOR_REQ(T, ID, DESC, ALIAS) |
Define a required vector parameter. More... | |
#define | PROGRAM_INFO(NAME, DESC) |
Document an executable. More... | |
#define | TYPENAME(x) (std::string(typeid(x).name())) |
The TYPENAME macro is used internally to convert a type into a string. More... | |
This file implements the CLI subsystem which is intended to replace FX. This can be used more or less regardless of context. In the future, it might be expanded to include file I/O.
This file is part of MLPACK 1.0.8.
MLPACK is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
MLPACK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details (LICENSE.txt).
You should have received a copy of the GNU General Public License along with MLPACK. If not, see http://www.gnu.org/licenses/.
Definition in file cli.hpp.
#define PARAM | ( | T, | |
ID, | |||
DESC, | |||
ALIAS, | |||
DEF, | |||
REQ | |||
) |
Define an input parameter.
Don't use this function; use the other ones above that call it. Note that we are using the LINE macro for naming these actual parameters when COUNTER does not exist, which is a bit of an ugly hack... but this is the preprocessor, after all. We don't have much choice other than ugliness.
T | Type of the parameter. |
ID | Name of the parameter. |
DESC | Description of the parameter (1-2 sentences). |
ALIAS | Alias for this parameter (one letter). |
DEF | Default value of the parameter. |
REQ | Whether or not parameter is required (boolean value). |
#define PARAM_DOUBLE | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM(double, ID, DESC, ALIAS, DEF, false) |
Define a double parameter.
The parameter can then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_DOUBLE_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) |
Define a required double parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_FLAG | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM_FLAG_INTERNAL(ID, DESC, ALIAS); |
Define a flag parameter.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_FLOAT | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM(float, ID, DESC, ALIAS, DEF, false) |
Define a floating-point parameter.
You should use PARAM_DOUBLE instead.
The parameter can then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_FLOAT_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) |
Define a required floating-point parameter.
You should probably use a double instead.
The parameter must then be specified on the command line with –ID=value. If ALIAS is equal to DEF_MOD (which is set using the PROGRAM_INFO() macro), the parameter can be specified with just –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_INT | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM(int, ID, DESC, ALIAS, DEF, false) |
Define an integer parameter.
The parameter can then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_INT_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) | PARAM(int, ID, DESC, ALIAS, 0, true) |
Define a required integer parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_STRING | ( | ID, | |
DESC, | |||
ALIAS, | |||
DEF | |||
) | PARAM(std::string, ID, DESC, ALIAS, DEF, false) |
Define a string parameter.
The parameter can then be specified on the command line with –ID=value. If ALIAS is equal to DEF_MOD (which is set using the PROGRAM_INFO() macro), the parameter can be specified with just –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_STRING_REQ | ( | ID, | |
DESC, | |||
ALIAS | |||
) |
Define a required string parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PARAM_VECTOR | ( | T, | |
ID, | |||
DESC, | |||
ALIAS | |||
) | PARAM(std::vector<T>, ID, DESC, ALIAS, std::vector<T>(), false) |
Define a vector parameter.
The parameter can then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
DEF | Default value of the parameter. |
#define PARAM_VECTOR_REQ | ( | T, | |
ID, | |||
DESC, | |||
ALIAS | |||
) |
Define a required vector parameter.
The parameter must then be specified on the command line with –ID=value.
ID | Name of the parameter. |
DESC | Quick description of the parameter (1-2 sentences). |
ALIAS | An alias for the parameter (one letter). |
#define PROGRAM_INFO | ( | NAME, | |
DESC | |||
) |
Document an executable.
Only one instance of this macro should be present in your program! Therefore, use it in the main.cpp (or corresponding executable) in your program.
NAME | Short string representing the name of the program. |
DESC | Long string describing what the program does and possibly a simple usage example. Newlines should not be used here; this is taken care of by CLI (however, you can explicitly specify newlines to denote new paragraphs). |