33 static const tFlag STRING_TYPE;
34 static const tFlag REAL_TYPE;
49 SP::MMSD_DoubleFullMatrix mProperties;
82 inline static SP::MMSD_DataSet
New() {
98 return mPropertiesName.
getSize();
104 return mProperties->getColumnsNumber();
109 return mSamplesNumber;
116 int i,n=mPropertiesName.
getSize();
118 if (mPropertiesName[i].compare(name)==0)
return i;
127 if (propIndex==-1)
return "";
128 if (mPropertiesType[propIndex]!=STRING_TYPE)
return "";
129 return mStringProperties(mPropertiesIndex[propIndex])[sampleIndex];
136 return mStringProperties(mPropertiesIndex[index])[sampleIndex];
144 if (propIndex==-1)
return 0;
145 if (mPropertiesType[propIndex]!=REAL_TYPE)
return 0;
146 return (*mProperties.get())(sampleIndex,mPropertiesIndex[propIndex]);
150 inline double getProperty(
const int& index,
const int& sampleIndex)
const {
153 return (*mProperties.get())(sampleIndex,mPropertiesIndex[index]);
159 return *mProperties.
get();
173 mProperties->setValues(n,p,values);
177 for (
int i=0;i<p;i++) {
178 mPropertiesName[i]=
"";
179 mPropertiesIndex[i]=i;
180 mPropertiesType[i]=REAL_TYPE;
200 vector<tString> names;
201 return load(file,names);
221 vector<tString> names;
222 int n=indices.size();
224 return load(file,names);
241 int loadCSVFile(
const tString& file,
const vector<tString>& names);
252 int loadTXTFile(
const tString& file,
const vector<tString>& names);
274 return save(file,12);
297 if (mProperties.get()!=
null) ret+=mProperties->toString()+
"\n";
tBoolean save(const tString &file, const int &ndigits) const
load the data set from txt file
Definition: MMSD_DataSet.cpp:540
int getPropertyIndex(const tString &name) const
get the property index of property with name
Definition: MMSD_DataSet.h:114
void setProperties(const int &n, const int &p, const double *values)
set the properties values is an array of size n x p
Definition: MMSD_DataSet.h:171
double get(const tLVectorIndex &i, const tLVectorIndex &j) const
get the value taking into account the view
Definition: LAP_DoubleMatrix.h:172
tString toString() const
return the string associated to the string
Definition: CORE_String.h:150
int getPropertiesNumber() const
get the properties number of real properties
Definition: MMSD_DataSet.h:103
virtual tString toString() const
turn the class into string
Definition: MMSD_DataSet.h:294
int getTotalPropertiesNumber() const
get the properties number of real + string properties
Definition: MMSD_DataSet.h:97
virtual void loadFromUIClass(const UI_Class &mclass)
how to load the object from a Meta Model class
Definition: MMSD_DataSet.cpp:52
This class describes the FullMatrix class.
Definition: MMSD_DoubleFullMatrix.h:17
const MMSD_DoubleFullMatrix & getProperties() const
get real properties
Definition: MMSD_DataSet.h:158
This class describes the main interface class for a soft user interface (R,matlab,python etc...) class.
Definition: UI_Class.h:38
#define tBoolean
Definition: types.h:48
CORE_Array< tString > CORE_StringArray
Definition: CORE_Array.h:619
DEFINE_SPTR(MMSD_DataSet)
tBoolean load(const tString &file)
load a data set from txt file
Definition: MMSD_DataSet.h:199
#define null
Definition: types.h:13
This class describes a data set.
Definition: MMSD_DataSet.h:26
virtual ~MMSD_DataSet(void)
destroy an object.
Definition: MMSD_DataSet.cpp:20
static SP::MMSD_DataSet New()
Definition: MMSD_DataSet.h:82
double getProperty(const int &index, const int &sampleIndex) const
get the real value of index - property at index sampleIndex
Definition: MMSD_DataSet.h:150
tBoolean save(const tString &file) const
load the data set from txt file
Definition: MMSD_DataSet.h:273
tString getStringProperty(const int &index, const int &sampleIndex) const
get the string value of index - property at index sampleIndex
Definition: MMSD_DataSet.h:133
tString getStringProperty(const tString &name, const int &sampleIndex) const
get the string property of name at index sampleIndex
Definition: MMSD_DataSet.h:124
void setSize(const tArrayIndex &n)
set the size of the array
Definition: CORE_Array.hpp:149
tLVectorIndex getSamplesNumber() const
get the samples number
Definition: MMSD_DataSet.h:108
#define tLVectorIndex
Definition: lapack_types.h:13
MMSD_DataSet(void)
create an object
Definition: MMSD_DataSet.cpp:13
#define tString
Definition: types.h:49
double getProperty(const tString &name, const int &sampleIndex) const
get the real property of name at index sampleIndex
Definition: MMSD_DataSet.h:141
void scale()
scale the data set
Definition: MMSD_DataSet.cpp:24
const tArrayIndex & getSize() const
return the size of the array
Definition: CORE_Array.h:223
tBoolean load(const tString &file, const vector< int > &indices)
load a data set from csv file and select only the properties whose name is in names list ...
Definition: MMSD_DataSet.h:220
void getProperties(SPC::MMSD_DoubleFullMatrix &y) const
get real properties
Definition: MMSD_DataSet.h:163
#define ASSERT_IN(a)
Definition: types.h:96
virtual void saveToUIClass(UI_Class &mclass) const
how to save the object from a mate model class
Definition: MMSD_DataSet.cpp:40
This class is the base class of all Mixture of Multiple Scaled Distribution package.
Definition: MMSD_Object.h:20
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:106
#define tFlag
Definition: types.h:14