PLearn 0.1
|
#include <StrTableVMatrix.h>
Public Member Functions | |
StrTableVMatrix (const StringTable &st) | |
StrTableVMatrix () | |
virtual void | loadAllStringMappings () |
Loads the appropriate string map file for every column. | |
virtual string | classname () const |
virtual OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual StrTableVMatrix * | deepCopy (CopiesMap &copies) const |
Static Public Member Functions | |
static string | _classname_ () |
MemoryVMatrix. | |
static OptionList & | _getOptionList_ () |
static RemoteMethodMap & | _getRemoteMethodMap_ () |
static Object * | _new_instance_for_typemap_ () |
static bool | _isa_ (const Object *o) |
static void | _static_initialize_ () |
static const PPath & | declaringFile () |
Static Public Attributes | |
static StaticInitializer | _static_initializer_ |
Private Types | |
typedef MemoryVMatrix | inherited |
Definition at line 47 of file StrTableVMatrix.h.
typedef MemoryVMatrix PLearn::StrTableVMatrix::inherited [private] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 49 of file StrTableVMatrix.h.
PLearn::StrTableVMatrix::StrTableVMatrix | ( | const StringTable & | st | ) |
Definition at line 51 of file StrTableVMatrix.cc.
References PLearn::MemoryVMatrix::build(), PLearn::MemoryVMatrix::data, PLearn::VMatrix::declareField(), PLearn::TVec< T >::end(), PLearn::VMatrix::find(), PLearn::StringTable::getFieldName(), i, PLearn::is_missing(), j, PLearn::StringTable::length(), PLearn::VMatrix::map_rs, PLearn::VMatrix::map_sr, PLearn::pl_isnumber(), PLearn::TVec< T >::resize(), PLearn::VMField::UnknownType, and PLearn::StringTable::width().
: inherited(Mat(st.length(),st.width())) { map<string,real>::iterator it; double dbl; TVec<int> mapnum(st.width(),0); TVec<string> vec(st.width()); TVec<bool> hasreal; Vec colmax; hasreal.resize(st.width()); colmax.resize(st.width()); for(int j=0;j<st.width();j++) { hasreal[j]=false; colmax[j]=0; } map_sr.resize(st.width()); map_rs.resize(st.width()); for(int j=0;j<st.width();j++) declareField(j,st.getFieldName(j), VMField::UnknownType); // 1st pass to detect maximums for(int i=0;i<st.length();i++) { vec=st(i); for(int j=0;j<st.width();j++) if(pl_isnumber(vec[j],&dbl)) { hasreal[j]=true; if(!is_missing(dbl)) if(colmax[j]<dbl) colmax[j]=dbl; } } for(int j=0;j<st.width();j++) if(hasreal[j]) mapnum[j]=(int)ceil((double)colmax[j])+1; for(int i=0;i<st.length();i++) { vec=st(i); for(int j=0;j<st.width();j++) if(!pl_isnumber(vec[j],&dbl)) { if((it=map_sr[j].find(vec[j]))==map_sr[j].end()) { data(i,j)=mapnum[j]; map_sr[j][vec[j]]=mapnum[j]; map_rs[j][mapnum[j]]=vec[j]; mapnum[j]++; } else data(i,j)=it->second; } else data(i,j)=dbl; } // We have modified the 'data' option. inherited::build(); }
PLearn::StrTableVMatrix::StrTableVMatrix | ( | ) |
Definition at line 44 of file StrTableVMatrix.cc.
{}
string PLearn::StrTableVMatrix::_classname_ | ( | ) | [static] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
OptionList & PLearn::StrTableVMatrix::_getOptionList_ | ( | ) | [static] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
RemoteMethodMap & PLearn::StrTableVMatrix::_getRemoteMethodMap_ | ( | ) | [static] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
Object * PLearn::StrTableVMatrix::_new_instance_for_typemap_ | ( | ) | [static] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
StaticInitializer StrTableVMatrix::_static_initializer_ & PLearn::StrTableVMatrix::_static_initialize_ | ( | ) | [static] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
string PLearn::StrTableVMatrix::classname | ( | ) | const [virtual] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
static const PPath& PLearn::StrTableVMatrix::declaringFile | ( | ) | [inline, static] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 57 of file StrTableVMatrix.h.
StrTableVMatrix * PLearn::StrTableVMatrix::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
OptionList & PLearn::StrTableVMatrix::getOptionList | ( | ) | const [virtual] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
OptionMap & PLearn::StrTableVMatrix::getOptionMap | ( | ) | const [virtual] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
RemoteMethodMap & PLearn::StrTableVMatrix::getRemoteMethodMap | ( | ) | const [virtual] |
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 124 of file StrTableVMatrix.cc.
void PLearn::StrTableVMatrix::loadAllStringMappings | ( | ) | [virtual] |
Loads the appropriate string map file for every column.
It is virtual because StrTableVMatrix will need to override it.
Reimplemented from PLearn::VMatrix.
Definition at line 117 of file StrTableVMatrix.cc.
{ // For a StrTableVMatrix, smap are already created return; }
Reimplemented from PLearn::MemoryVMatrix.
Definition at line 57 of file StrTableVMatrix.h.