mxnet
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
dmlc Namespace Reference

namespace for dmlc More...

Namespaces

 io
 
 lua_stack
 
 parameter
 
 serializer
 internal namespace for serializers
 

Classes

class  array_view
 Read only data structure to reference continuous memory region of array. Provide unified view for vector, array and C style array. This data structure do not guarantee aliveness of referenced array. More...
 
class  BlockingQueueThread
 Blocking queue thread class. More...
 
class  ConcurrentBlockingQueue
 Cocurrent blocking queue. More...
 
class  Config
 class for config parser More...
 
class  DataIter
 data iterator interface this is not a C++ style iterator, but nice for data pulling:) This interface is used to pull in the data The system can do some useful tricks for you like pre-fetching from disk and pre-computation. More...
 
class  FunctionRegEntryBase
 Common base class for function registry. More...
 
struct  has_saveload
 whether a type have save/load function More...
 
struct  IfThenElseType
 template to select type based on condition For example, IfThenElseType<true, int, float>::Type will give int More...
 
class  InputSplit
 input split creates that allows reading of records from split of data, independent part that covers all the dataset More...
 
class  InputSplitShuffle
 class to construct input split with global shuffling More...
 
struct  is_arithmetic
 whether a type is arithemetic type More...
 
struct  is_floating_point
 whether a type is floating point type More...
 
struct  is_integral
 whether a type is integer type More...
 
struct  is_pod
 whether a type is pod type More...
 
class  istream
 a std::istream class that can can wrap Stream objects, can use istream with that output to underlying Stream More...
 
class  JSONObjectReadHelper
 Helper class to read JSON into a class or struct object. More...
 
class  JSONReader
 Lightweight JSON Reader to read any STL compositions and structs. The user need to know the schema of the. More...
 
class  JSONWriter
 Lightweight json to write any STL compositions. More...
 
class  LuaRef
 an reference to lua object More...
 
class  LuaState
 A Lua state. More...
 
class  ManualEvent
 Simple manual-reset event gate which remains open after signalled. More...
 
struct  MemoryFixedSizeStream
 A Stream that operates on fixed region of memory This class allows us to read/write from/to a fixed memory region. More...
 
class  MemoryPool
 A memory pool that allocate memory of fixed size and alignment. More...
 
struct  MemoryStringStream
 A in memory stream that is backed by std::string. This class allows us to read/write from/to a std::string. More...
 
struct  nullopt_t
 dummy type for assign null to optional More...
 
class  OMPException
 OMP Exception class catches, saves and rethrows exception from OMP blocks. More...
 
class  optional
 c++17 compatible optional class. More...
 
class  ostream
 a std::ostream class that can can wrap Stream objects, can use ostream with that output to underlying Stream More...
 
class  Parser
 parser interface that parses input data used to load dmlc data format into your own data format Difference between RowBlockIter and Parser: RowBlockIter caches the data internally that can be used to iterate the dataset multiple times, Parser holds very limited internal state and was usually used to read data only once More...
 
struct  ParserFactoryReg
 registry entry of parser factory More...
 
class  RecordIOChunkReader
 reader of binary recordio from Blob returned by InputSplit This class divides the blob into several independent parts specified by caller, and read from one segment. The part reading can be used together with InputSplit::NextChunk for multi-threaded parsing(each thread take a RecordIOChunkReader) More...
 
class  RecordIOReader
 reader of binary recordio to reads in record from stream More...
 
class  RecordIOWriter
 writer of binary recordio binary format for recordio recordio format: magic lrecord data pad More...
 
class  Registry
 Registry class. Registry can be used to register global singletons. The most commonly use case are factory functions. More...
 
class  Row
 one row of training instance More...
 
struct  RowBlock
 a block of data, containing several rows in sparse matrix This is useful for (streaming-sxtyle) algorithms that scans through rows of data examples include: SGD, GD, L-BFGS, kmeans More...
 
class  RowBlockIter
 Data structure that holds the data Row block iterator interface that gets RowBlocks Difference between RowBlockIter and Parser: RowBlockIter caches the data internally that can be used to iterate the dataset multiple times, Parser holds very limited internal state and was usually used to read data only once. More...
 
class  ScopedThread
 Wrapper class to manage std::thread; uses RAII pattern to automatically join std::thread upon destruction. More...
 
class  SeekStream
 interface of i/o stream that support seek More...
 
class  Serializable
 interface for serializable objects More...
 
class  Spinlock
 Simple userspace spinlock implementation. More...
 
class  Str2T
 Interface class that defines a single method get() to convert a string into type T. Define template specialization of this class to define the conversion method for a particular type. More...
 
class  Str2T< double >
 Template specialization of Str2T<> interface for double type. More...
 
class  Str2T< float >
 Template specialization of Str2T<> interface for float type. More...
 
class  Str2T< int32_t >
 Template specialization of Str2T<> interface for signed 32-bit integer. More...
 
class  Str2T< int64_t >
 Template specialization of Str2T<> interface for signed 64-bit integer. More...
 
class  Str2T< uint32_t >
 Template specialization of Str2T<> interface for unsigned 32-bit integer. More...
 
class  Str2T< uint64_t >
 Template specialization of Str2T<> interface for unsigned 64-bit integer. More...
 
class  Stream
 interface of stream I/O for serialization More...
 
class  TemporaryDirectory
 Manager class for temporary directories. Whenever a new TemporaryDirectory object is constructed, a temporary directory is created. The directory is deleted when the object is deleted or goes out of scope. Note: no symbolic links are allowed inside the temporary directory. More...
 
class  ThreadedIter
 a iterator that was backed by a thread to pull data eagerly from a single producer into a bounded buffer the consumer can pull the data at its own rate More...
 
class  ThreadGroup
 Thread lifecycle management group. More...
 
class  ThreadlocalAllocator
 A thread local allocator that get memory from a threadlocal memory pool. This is suitable to allocate objects that do not cross thread. More...
 
struct  ThreadlocalSharedPtr
 a shared pointer like type that allocate object from a threadlocal object pool. This object is not thread-safe but can be faster than shared_ptr in certain usecases. More...
 
class  ThreadLocalStore
 A threadlocal store to store threadlocal variables. Will return a thread local singleton of type T. More...
 
class  TimerThread
 Managed timer thread. More...
 
struct  type_name_helper
 helper class to construct a string that represents type name More...
 
struct  type_name_helper< mxnet::Tuple< T > >
 
struct  type_name_helper< nnvm::Tuple< T > >
 

Typedefs

typedef float real_t
 this defines the float point that will be used to store feature values More...
 
typedef unsigned index_t
 this defines the unsigned integer type that can normally be used to store feature index More...
 
using SharedMutex = std::recursive_mutex
 Standard mutex for C++ < 14. More...
 
using WriteLock = std::unique_lock< SharedMutex >
 Standard unique lock for C++ < 14. More...
 
using ReadLock = std::unique_lock< SharedMutex >
 Standard unique lock for C++ < 14. More...
 

Enumerations

enum  ConcurrentQueueType { ConcurrentQueueType::kFIFO, ConcurrentQueueType::kPriority }
 type of concurrent queue More...
 

Functions

template<typename T >
T * BeginPtr (std::vector< T > &vec)
 safely get the beginning address of a vector More...
 
template<typename T >
const T * BeginPtr (const std::vector< T > &vec)
 get the beginning address of a const vector More...
 
char * BeginPtr (std::string &str)
 get the beginning address of a string More...
 
const char * BeginPtr (const std::string &str)
 get the beginning address of a const string More...
 
std::vector< std::string > Split (const std::string &s, char delim)
 Split a string by delimiter. More...
 
template<typename T >
size_t HashCombine (size_t key, const T &value)
 hash an object and combines the key with previous keys More...
 
template<>
size_t HashCombine< size_t > (size_t key, const size_t &value)
 specialize for size_t More...
 
void ByteSwap (void *data, size_t elem_bytes, size_t num_elems)
 A generic inplace byte swapping function. More...
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const optional< T > &t)
 serialize an optional object to string. More...
 
template<typename T >
std::istream & operator>> (std::istream &is, optional< T > &t)
 parse a string object into optional<T> More...
 
std::istream & operator>> (std::istream &is, optional< bool > &t)
 specialization of '>>' istream parsing for optional<bool> More...
 
 DMLC_DECLARE_TYPE_NAME (optional< int >,"int or None")
 description for optional int More...
 
 DMLC_DECLARE_TYPE_NAME (optional< bool >,"boolean or None")
 description for optional bool More...
 
 DMLC_DECLARE_TYPE_NAME (optional< float >,"float or None")
 description for optional float More...
 
 DMLC_DECLARE_TYPE_NAME (optional< double >,"double or None")
 description for optional double More...
 
bool isspace (char c)
 Inline implementation of isspace(). Tests whether the given character is a whitespace letter. More...
 
bool isblank (char c)
 Inline implementation of isblank(). Tests whether the given character is a space or tab character. More...
 
bool isdigit (char c)
 Inline implementation of isdigit(). Tests whether the given character is a decimal digit. More...
 
bool isalpha (char c)
 Inline implementation of isalpha(). Tests whether the given character is an alphabet letter. More...
 
bool isdigitchars (char c)
 Tests whether the given character is a valid letter in the string representation of a floating-point value, i.e. decimal digits, signs (+/-), decimal point (.), or exponent marker (e/E). More...
 
template<typename FloatType , bool CheckRange = false>
FloatType ParseFloat (const char *nptr, char **endptr)
 Common implementation for dmlc::strtof() and dmlc::strtod() TODO: the current version does not support hex number. More...
 
float strtof (const char *nptr, char **endptr)
 A faster implementation of strtof(). See documentation of std::strtof() for more information. Note that this function does not check for overflow. Use strtof_check_range() to check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
float strtof_check_range (const char *nptr, char **endptr)
 A faster implementation of strtof(). See documentation of std::strtof() for more information. This function will check for overflow. If the converted value is outside the range for the float type, errno is set to ERANGE and HUGE_VALF is returned. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
double strtod (const char *nptr, char **endptr)
 A faster implementation of strtod(). See documentation of std::strtof() for more information. Note that this function does not check for overflow. Use strtod_check_range() to check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
double strtod_check_range (const char *nptr, char **endptr)
 A faster implementation of strtod(). See documentation of std::strtod() for more information. This function will check for overflow. If the converted value is outside the range for the double type, errno is set to ERANGE and HUGE_VAL is returned. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
template<typename SignedIntType >
SignedIntType ParseSignedInt (const char *nptr, char **endptr, int base)
 A fast string-to-integer convertor, for signed integers TODO: the current version supports only base <= 10. More...
 
template<typename UnsignedIntType >
UnsignedIntType ParseUnsignedInt (const char *nptr, char **endptr, int base)
 A fast string-to-integer convertor, for unsigned integers TODO: the current version supports only base <= 10. More...
 
uint64_t strtoull (const char *nptr, char **endptr, int base)
 A faster implementation of strtoull(). See documentation of std::strtoull() for more information. Note that this function does not check for overflow. TODO: the current version supports only base <= 10. More...
 
long atol (const char *p)
 A faster implementation of atol(). See documentation of std::atol() for more information. This function will use base 10. Note that this function does not check for overflow. More...
 
float atof (const char *nptr)
 A faster implementation of atof(). Unlike std::atof(), this function returns float type. Note that this function does not check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
float stof (const std::string &value, size_t *pos=nullptr)
 A faster implementation of stof(). See documentation of std::stof() for more information. This function will test for overflow and invalid arguments. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
double stod (const std::string &value, size_t *pos=nullptr)
 A faster implementation of stod(). See documentation of std::stod() for more information. This function will test for overflow and invalid arguments. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either. More...
 
template<typename T >
Str2Type (const char *begin, const char *end)
 Convenience function for converting string into type T. More...
 
template<typename T1 , typename T2 >
int ParsePair (const char *begin, const char *end, const char **endptr, T1 &v1, T2 &v2)
 Parse colon seperated pair v1[:v2]. More...
 
template<typename T1 , typename T2 , typename T3 >
int ParseTriple (const char *begin, const char *end, const char **endptr, T1 &v1, T2 &v2, T3 &v3)
 Parse colon seperated triple v1:v2[:v3]. More...
 
template<typename Duration , typename TimerFunction >
bool CreateTimer (const std::string &timer_name, const Duration &duration, ThreadGroup *owner, TimerFunction timer_function)
 Utility function to easily create a timer. More...
 
double GetTime (void)
 return time in seconds More...
 
template<typename T >
std::string type_name ()
 the string representation of type name More...
 
 DMLC_DECLARE_TRAITS (has_saveload, mxnet::NDArray, true)
 traits More...
 
 DMLC_DECLARE_TYPE_NAME (mxnet::TShape,"Shape(tuple)")
 
 DMLC_DECLARE_TYPE_NAME (mxnet::Tuple< int >,"Shape(tuple)")
 
 DMLC_DECLARE_TYPE_NAME (mxnet::Tuple< dmlc::optional< int >>,"Shape(tuple)")
 
 DMLC_DECLARE_TYPE_NAME (nnvm::Tuple< int >,"Shape(tuple)")
 
 DMLC_DECLARE_TYPE_NAME (nnvm::Tuple< dmlc::optional< int >>,"Shape(tuple)")
 
 DMLC_DECLARE_TYPE_NAME (optional< mxnet::TShape >,"Shape or None")
 description for optional TShape More...
 
 DMLC_DECLARE_TYPE_NAME (optional< mxnet::Tuple< int >>,"Shape or None")
 
 DMLC_DECLARE_TYPE_NAME (optional< nnvm::TShape >,"Shape or None")
 description for optional TShape More...
 

Variables

constexpr const nullopt_t nullopt = nullopt_t(0)
 
const int kStrtofMaxDigits = 19
 Maximum number of decimal digits dmlc::strtof() / dmlc::strtod() will process. Trailing digits will be ignored. More...
 

Detailed Description

namespace for dmlc

Typedef Documentation

typedef unsigned dmlc::index_t

this defines the unsigned integer type that can normally be used to store feature index

using dmlc::ReadLock = typedef std::unique_lock<SharedMutex>

Standard unique lock for C++ < 14.

typedef float dmlc::real_t

this defines the float point that will be used to store feature values

using dmlc::SharedMutex = typedef std::recursive_mutex

Standard mutex for C++ < 14.

using dmlc::WriteLock = typedef std::unique_lock<SharedMutex>

Standard unique lock for C++ < 14.

Enumeration Type Documentation

type of concurrent queue

Enumerator
kFIFO 

FIFO queue.

kPriority 

queue with priority

Function Documentation

float dmlc::atof ( const char *  nptr)
inline

A faster implementation of atof(). Unlike std::atof(), this function returns float type. Note that this function does not check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
nptrBeginning of the string that's to be converted into float
Returns
Converted value, in float type
long dmlc::atol ( const char *  p)
inline

A faster implementation of atol(). See documentation of std::atol() for more information. This function will use base 10. Note that this function does not check for overflow.

Parameters
pBeginning of the string that's to be converted into integer of type long
Returns
Converted value, as long integer (width is system-dependent)
template<typename T >
T* dmlc::BeginPtr ( std::vector< T > &  vec)
inline

safely get the beginning address of a vector

Parameters
vecinput vector
Returns
beginning address of a vector
template<typename T >
const T* dmlc::BeginPtr ( const std::vector< T > &  vec)
inline

get the beginning address of a const vector

Parameters
vecinput vector
Returns
beginning address of a vector
char* dmlc::BeginPtr ( std::string &  str)
inline

get the beginning address of a string

Parameters
strinput string
Returns
beginning address of a string
const char* dmlc::BeginPtr ( const std::string &  str)
inline

get the beginning address of a const string

Parameters
strinput string
Returns
beginning address of a string
void dmlc::ByteSwap ( void *  data,
size_t  elem_bytes,
size_t  num_elems 
)
inline

A generic inplace byte swapping function.

Parameters
dataThe data pointer.
elem_bytesThe number of bytes of the data elements
num_elemsNumber of elements in the data.
Note
Always try pass in constant elem_bytes to enable compiler optimization
template<typename Duration , typename TimerFunction >
bool dmlc::CreateTimer ( const std::string &  timer_name,
const Duration &  duration,
ThreadGroup owner,
TimerFunction  timer_function 
)
inline

Utility function to easily create a timer.

Template Parameters
DurationDuration type (i.e. std::chrono::milliseconds)
TimerFunctionFunction to call each time the timer expires
Parameters
timer_nameName of the timer. Must be unique per ThreadGroup object
durationDuration of the timer between calls to timer_function
ownerThreadGroup owner of the timer
timer_functionFunction to call each time the timer expires
Returns
true if the timer was successfully created
dmlc::DMLC_DECLARE_TRAITS ( has_saveload  ,
mxnet::NDArray  ,
true   
)

traits

dmlc::DMLC_DECLARE_TYPE_NAME ( optional< int >  ,
"int or None"   
)

description for optional int

dmlc::DMLC_DECLARE_TYPE_NAME ( optional< bool >  ,
"boolean or None"   
)

description for optional bool

dmlc::DMLC_DECLARE_TYPE_NAME ( optional< float >  ,
"float or None"   
)

description for optional float

dmlc::DMLC_DECLARE_TYPE_NAME ( optional< double >  ,
"double or None"   
)

description for optional double

dmlc::DMLC_DECLARE_TYPE_NAME ( mxnet::TShape  ,
"Shape(tuple)"   
)
dmlc::DMLC_DECLARE_TYPE_NAME ( mxnet::Tuple< int >  ,
"Shape(tuple)"   
)
dmlc::DMLC_DECLARE_TYPE_NAME ( mxnet::Tuple< dmlc::optional< int >>  ,
"Shape(tuple)"   
)
dmlc::DMLC_DECLARE_TYPE_NAME ( nnvm::Tuple< int >  ,
"Shape(tuple)"   
)
dmlc::DMLC_DECLARE_TYPE_NAME ( nnvm::Tuple< dmlc::optional< int >>  ,
"Shape(tuple)"   
)
dmlc::DMLC_DECLARE_TYPE_NAME ( optional< nnvm::TShape ,
"Shape or None"   
)

description for optional TShape

dmlc::DMLC_DECLARE_TYPE_NAME ( optional< mxnet::TShape ,
"Shape or None"   
)

description for optional TShape

dmlc::DMLC_DECLARE_TYPE_NAME ( optional< mxnet::Tuple< int >>  ,
"Shape or None"   
)
double dmlc::GetTime ( void  )
inline

return time in seconds

template<typename T >
size_t dmlc::HashCombine ( size_t  key,
const T &  value 
)
inline

hash an object and combines the key with previous keys

template<>
size_t dmlc::HashCombine< size_t > ( size_t  key,
const size_t &  value 
)
inline

specialize for size_t

bool dmlc::isalpha ( char  c)
inline

Inline implementation of isalpha(). Tests whether the given character is an alphabet letter.

Parameters
cCharacter to test
Returns
Result of the test
bool dmlc::isblank ( char  c)
inline

Inline implementation of isblank(). Tests whether the given character is a space or tab character.

Parameters
cCharacter to test
Returns
Result of the test
bool dmlc::isdigit ( char  c)
inline

Inline implementation of isdigit(). Tests whether the given character is a decimal digit.

Parameters
cCharacter to test
Returns
Result of the test
bool dmlc::isdigitchars ( char  c)
inline

Tests whether the given character is a valid letter in the string representation of a floating-point value, i.e. decimal digits, signs (+/-), decimal point (.), or exponent marker (e/E).

Parameters
cCharacter to test
Returns
Result of the test
bool dmlc::isspace ( char  c)
inline

Inline implementation of isspace(). Tests whether the given character is a whitespace letter.

Parameters
cCharacter to test
Returns
Result of the test
template<typename T >
std::ostream& dmlc::operator<< ( std::ostream &  os,
const optional< T > &  t 
)

serialize an optional object to string.

std::cout << x; // None
x = 0;
std::cout << x; // 0
Parameters
osoutput stream
tsource optional<T> object
Returns
output stream
template<typename T >
std::istream& dmlc::operator>> ( std::istream &  is,
optional< T > &  t 
)

parse a string object into optional<T>

std::string s1 = "1";
std::istringstream is1(s1);
s1 >> x; // x == optional<int>(1)
std::string s2 = "None";
std::istringstream is2(s2);
s2 >> x; // x == optional<int>()
Parameters
isinput stream
ttarget optional<T> object
Returns
input stream
std::istream& dmlc::operator>> ( std::istream &  is,
optional< bool > &  t 
)
inline

specialization of '>>' istream parsing for optional<bool>

Permits use of generic parameter FieldEntry<DType> class to create FieldEntry<optional<bool>> without explicit specialization.

std::string s1 = "true";
std::istringstream is1(s1);
s1 >> x; // x == optional<bool>(true)
std::string s2 = "None";
std::istringstream is2(s2);
s2 >> x; // x == optional<bool>()
Parameters
isinput stream
ttarget optional<bool> object
Returns
input stream
template<typename FloatType , bool CheckRange = false>
FloatType dmlc::ParseFloat ( const char *  nptr,
char **  endptr 
)
inline

Common implementation for dmlc::strtof() and dmlc::strtod() TODO: the current version does not support hex number.

Parameters
nptrBeginning of the string that's to be converted into a floating-point number
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
Returns
Converted floating-point value, in FloatType
Template Parameters
FloatTypeType of floating-point number to be obtained. This must be either float or double.
CheckRangeWhether to check for overflow. If set to true, an out- of-range value will cause errno to be set to ERANGE and ParseFloat() to return HUGE_VAL / HUGE_VALF; otherwise, all out-of-range vlaues will be silently clipped.
template<typename T1 , typename T2 >
int dmlc::ParsePair ( const char *  begin,
const char *  end,
const char **  endptr,
T1 &  v1,
T2 &  v2 
)
inline

Parse colon seperated pair v1[:v2].

Parameters
beginpointer to string
endone past end of string
endptrAfter conversion, will be set to one past of parsed string
v1first value in the pair
v2second value in the pair
Returns
number of values parsed
Template Parameters
T1type of v1
T2type of v2
template<typename SignedIntType >
SignedIntType dmlc::ParseSignedInt ( const char *  nptr,
char **  endptr,
int  base 
)
inline

A fast string-to-integer convertor, for signed integers TODO: the current version supports only base <= 10.

Parameters
nptrBeginning of the string that's to be converted into a signed integer
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
baseBase to use for integer conversion
Returns
Converted value, in SignedIntType
Template Parameters
SignedIntTypeType of signed integer to be obtained.
template<typename T1 , typename T2 , typename T3 >
int dmlc::ParseTriple ( const char *  begin,
const char *  end,
const char **  endptr,
T1 &  v1,
T2 &  v2,
T3 &  v3 
)
inline

Parse colon seperated triple v1:v2[:v3].

Parameters
beginpointer to string
endone past end of string
endptrAfter conversion, will be set to one past of parsed string
v1first value in the triple
v2second value in the triple
v3third value in the triple
Returns
number of values parsed
Template Parameters
T1type of v1
T2type of v2
T3type of v3
template<typename UnsignedIntType >
UnsignedIntType dmlc::ParseUnsignedInt ( const char *  nptr,
char **  endptr,
int  base 
)
inline

A fast string-to-integer convertor, for unsigned integers TODO: the current version supports only base <= 10.

Parameters
nptrBeginning of the string that's to be converted into an unsigned integer
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
baseBase to use for integer conversion
Returns
Converted value, in UnsignedIntType
Template Parameters
UnsignedIntTypeType of unsigned integer to be obtained.
std::vector<std::string> dmlc::Split ( const std::string &  s,
char  delim 
)
inline

Split a string by delimiter.

Parameters
sString to be splitted.
delimThe delimiter.
Returns
a splitted vector of strings.
double dmlc::stod ( const std::string &  value,
size_t *  pos = nullptr 
)
inline

A faster implementation of stod(). See documentation of std::stod() for more information. This function will test for overflow and invalid arguments. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
valueThe string to convert into double
posIf not null, it will store the number of characters processed
Returns
Converted value, in double type
Exceptions
std::out_of_rangeIf the converted value would fall out of the range of the double type
std::invalid_argumentIf no conversion could be performed
float dmlc::stof ( const std::string &  value,
size_t *  pos = nullptr 
)
inline

A faster implementation of stof(). See documentation of std::stof() for more information. This function will test for overflow and invalid arguments. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
valueThe string to convert into float
posIf not null, it will store the number of characters processed
Returns
Converted value, in float type
Exceptions
std::out_of_rangeIf the converted value would fall out of the range of the double type
std::invalid_argumentIf no conversion could be performed
template<typename T >
T dmlc::Str2Type ( const char *  begin,
const char *  end 
)
inline

Convenience function for converting string into type T.

Parameters
beginBeginning of the string to convert
endEnd of the string to convert
Returns
Converted value, in type T
Template Parameters
Typeof converted value
double dmlc::strtod ( const char *  nptr,
char **  endptr 
)
inline

A faster implementation of strtod(). See documentation of std::strtof() for more information. Note that this function does not check for overflow. Use strtod_check_range() to check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
nptrBeginning of the string that's to be converted into double
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
Returns
Converted floating-point value, in double type
double dmlc::strtod_check_range ( const char *  nptr,
char **  endptr 
)
inline

A faster implementation of strtod(). See documentation of std::strtod() for more information. This function will check for overflow. If the converted value is outside the range for the double type, errno is set to ERANGE and HUGE_VAL is returned. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
nptrBeginning of the string that's to be converted into double
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
Returns
Converted floating-point value, in float type
float dmlc::strtof ( const char *  nptr,
char **  endptr 
)
inline

A faster implementation of strtof(). See documentation of std::strtof() for more information. Note that this function does not check for overflow. Use strtof_check_range() to check for overflow. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
nptrBeginning of the string that's to be converted into float
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
Returns
Converted floating-point value, in float type
float dmlc::strtof_check_range ( const char *  nptr,
char **  endptr 
)
inline

A faster implementation of strtof(). See documentation of std::strtof() for more information. This function will check for overflow. If the converted value is outside the range for the float type, errno is set to ERANGE and HUGE_VALF is returned. TODO: the current version does not support hex number TODO: the current version does not handle long decimals: you may only have up to 19 digits after the decimal point, and you cannot have too many digits before the decimal point either.

Parameters
nptrBeginning of the string that's to be converted into float
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
Returns
Converted floating-point value, in float type
uint64_t dmlc::strtoull ( const char *  nptr,
char **  endptr,
int  base 
)
inline

A faster implementation of strtoull(). See documentation of std::strtoull() for more information. Note that this function does not check for overflow. TODO: the current version supports only base <= 10.

Parameters
nptrBeginning of the string that's to be converted into integer of type unsigned long long
endptrAfter the conversion, this pointer will be set to point one past the last character used in the conversion.
baseBase to use for integer conversion
Returns
Converted value, as unsigned 64-bit integer
template<typename T >
std::string dmlc::type_name ( )
inline

the string representation of type name

Template Parameters
Tthe type to query
Returns
a const string of typename.

Variable Documentation

const int dmlc::kStrtofMaxDigits = 19

Maximum number of decimal digits dmlc::strtof() / dmlc::strtod() will process. Trailing digits will be ignored.

constexpr const nullopt_t dmlc::nullopt = nullopt_t(0)

Assign null to optional: optional<T> x = nullopt;