STK++ 0.9.13
|
The STKernel project is the low-level core library that forms the basis of the STK++ library.
This tutorial intent to give some help to the Developers who want to use the STK++ fundamental types and i-o facilities provided by the library.
In statistics, missing data, or missing values, occur when no data value is stored for the variable in the current observation. Missing data are a common occurrence and can have a significant effect on the conclusions that can be drawn from the data. Mixed Data is data from any number of sources, largely unknown and unlimited, and in many varying formats. In essence, it is a way to refer to data that id of an unknown format and/or content.
From a computational point of view, the programmer have to take care of these two aspects. It is desirable to
Theses goals have been achieved in STK++ by
Additionally, the STKernel project provides typedef of the std::basic_*
streams in the STK namespace domain for the predefined Char
type which can be either a char
or a wchar
. Thus a programmer can write
and compile the library using the flag -DSTK_UNICODE, without taking care all along the code if he has to use ifstream or wifstream.
Since version 0.5.3 of STK++ there exists 6 kinds of fundamental types: String, Real, Integer, Binary, Sign and Range. All these types are self-explaining except maybe Range which represents a range of integer in the form [first:end).
If we take the example of the Real type, we have
which can be replaced by float if the user need single precision rather that double precision.
If now we take the example of the Binary type, we have
and it is important to note that any integer type represents missing values with the MAX_INT macro.
The piece of code
will produce the following output
x =. b =.
The missing values are displayed using the dot (".") symbol. This is a global behavior that can be modified at runtime by using the global method setStringNa
. For example using:
all the input and output operation will be altered and NA value will be read/write using NA.
The Arithmetic struct inherit from all the static functions of the std::numeric_limits
struct and add static functions for handling the NA values of all STK++ type in a transparent way. For example for Real, it is specialized in the following way:
so that the piece of code
will produce the following output
x =. isNa(x) =1
typeToString
than the Proxy class for output. All fundamental STK++ types are defined by its IdType. Knowing the type of an object, it is possible to get its Id using the piece of code
The value returned is an IdType.
Knowing the Id of an object, it is possible to tune the code of your application. This RTTI mechanism is mainly used in STK++ in the Variable and DataFrame classes.