Classes | |
class | Args |
Handle the command line arguments. More... | |
class | StreamTokenizer |
Can tokenize a stream. More... | |
struct | white_tab |
Set the whitespace to tabs and newlines only. More... | |
Enumerations | |
enum | ArgsOutType { AOT_OK, AOT_NO_ARGUMENTS, AOT_UNKOWN_ARGUMENT, AOT_TOO_FEW_VALUES } |
The enum returned by readArguments(). More... | |
Functions | |
void | skip_line (istream &inFile, const int nLines=1) |
Skip nLine lines of a given stream. | |
string | addAndCheckExtension (const string &file, const string &extension) |
Returns the file with the extension. | |
string | trim (const string &str) |
Trim a string on the left and on the right. | |
bool | cmp_nocase (const string &s1, const string &s2) |
Case insensitive comparison. | |
size_t | count_columns (istream &in) |
Count the number of columns from a stream. | |
template<typename T1, typename T2, typename Pred> | |
bool | comparePairOnSecond (const pair< T1, T2 > &el1, const pair< T1, T2 > &el2) |
Sort pairs on the second element. | |
template<typename T> | |
bool | is_zero (const T val, const T smallVal=1E-10) |
Checks if a number is equal to zero, between a positive and negative limit of smallVal. |
|
The enum returned by readArguments(). It gives informations about the status of the read arguments.
|
|
Returns the file with the extension. If the given extension already exist in the file name, then ignore it. Examples: addAndCheckExtension("hello.dat", "dat"); // -> "hello.dat" addAndCheckExtension("hello", "dat"); // -> "hello.dat" addAndCheckExtension("hello.txt", "dat"); // -> "hello.txt.dat"
|
|
Case insensitive comparison.
Definition at line 178 of file Utils.h. Referenced by UnSerialization::seekAndParseEnclosedValue(), UnSerialization::seekAndParseParamTag(), UnSerialization::seekAndParseVectorTag(), UnSerialization::seekParamTag(), and UnSerialization::seekSimpleTag(). |
|
Sort pairs on the second element. The predicate gives the sorting direction. To sort from small to big: vector< pair<int, double> > v; sort( v.begin(), v.end(), nor_utils::comparePairOnSecond< int, double, less<double> > ); vector< pair<int, double> > v; sort( v.begin(), v.end(), nor_utils::comparePairOnSecond< int, double, greater<double> > );
Definition at line 266 of file Utils.h. Referenced by SortedData::load(). |
|
Count the number of columns from a stream.
|
|
Checks if a number is equal to zero, between a positive and negative limit of smallVal. Should be used with floating numbers to overcome numerical problems.
Definition at line 282 of file Utils.h. Referenced by StumpLearner::doFullAbstention(), StumpLearner::doGreedyAbstention(), BaseLearner::getAlpha(), and StumpLearner::getEnergy(). |
|
Skip nLine lines of a given stream.
|
|
Trim a string on the left and on the right.
|