PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types
PLearn::StrTableVMatrix Class Reference

#include <StrTableVMatrix.h>

Inheritance diagram for PLearn::StrTableVMatrix:
Inheritance graph
[legend]
Collaboration diagram for PLearn::StrTableVMatrix:
Collaboration graph
[legend]

List of all members.

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 OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual StrTableVMatrixdeepCopy (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 PPathdeclaringFile ()

Static Public Attributes

static StaticInitializer _static_initializer_

Private Types

typedef MemoryVMatrix inherited

Detailed Description

Definition at line 47 of file StrTableVMatrix.h.


Member Typedef Documentation

Reimplemented from PLearn::MemoryVMatrix.

Definition at line 49 of file StrTableVMatrix.h.


Constructor & Destructor Documentation

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();

}

Here is the call graph for this function:

PLearn::StrTableVMatrix::StrTableVMatrix ( )

Definition at line 44 of file StrTableVMatrix.cc.

{}

Member Function Documentation

string PLearn::StrTableVMatrix::_classname_ ( ) [static]

MemoryVMatrix.

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.

bool PLearn::StrTableVMatrix::_isa_ ( const Object o) [static]

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;
}

Member Data Documentation

Reimplemented from PLearn::MemoryVMatrix.

Definition at line 57 of file StrTableVMatrix.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines