Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

data.h

Go to the documentation of this file.
00001 //****************************************************
00002 //  April, 1993, University of Illinois
00003 // Copyright (C) 1993, 1994 Tianlin Wang
00004 /* Copyright (C) 1994-2003 Matvec Development Team. 
00005 
00006   This program is free software; you can redistribute it and/or
00007   modify it under the terms of the GNU Library General Public
00008   License as published by the Free Software Foundation; either
00009   version 2 of the License, or (at your option) any later version.
00010   
00011   This program is distributed in the hope that it will be useful,
00012   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014   Library General Public License for more details.
00015     
00016   You should have received a copy of the GNU Library General Public
00017   License along with this library; if not, write to the Free
00018   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019   MA 02111-1307, USA 
00020 */
00021 
00022 #ifndef MATVEC_DATA_H
00023 #define MATVEC_DATA_H
00024 
00025 #include "datanode.h"
00026 #include "field.h"
00027 
00028 namespace matvec {
00029 class doubleMatrix;
00030 /*!
00031  *  \class Data  Data.h
00032  *  \brief A set of rows of data records
00033  *
00034  */
00035 
00036 class Data {
00037    protected:
00038       int         data_on_disk, data_in_memory;
00039       unsigned    numcol,new_col,maxnumcol, numrec;
00040       std::string      tdfname;
00041 
00042       void       copyfrom(Data& A);
00043 
00044    public:
00045       HashTable    **hashtable;
00046       Field       *datasheet;
00047 
00048       Data(void);
00049       Data(Data& D);
00050       ~Data(void){release();}
00051 
00052       const Data&   operator=(Data& A);
00053       const Data&   operator=(const Field& V);
00054 
00055       Data&  resize(const unsigned nr,const unsigned nc,const unsigned mc=0);
00056       friend std::ostream&  operator<<(std::ostream& stream, Data& A);
00057 
00058       int        in_memory(void) const {return data_in_memory;}
00059       int        in_disk(void) const {return data_on_disk;}
00060       int        field_index(const std::string &colname) const;
00061       void       field_index_vec(Vector<int> &intvec,const std::string &fdname="");
00062       void       value_for_missing(const double vm);
00063 //      void     symbol_for_missing(const char sm[]);
00064       void       input(const std::string & fname,const std::string & recfmt);
00065       void       save_datasheet(const int relse=1);
00066       void       input_datasheet(void);
00067       void       release_datasheet(void);
00068       void       release(void);
00069       void       print(std::ostream& stream,const Vector<int> intvec, const int ic=0);
00070       void       save(const std::string &fname,
00071                       const int io_mode = std::ios::out);//SDK|ios::noreplace);
00072       void       display(const std::string &fieldnames="",const int ic=0);
00073       void       newcol(const std::string &cname,const Field& col);
00074       void       row(const unsigned i,DataNode* recd);
00075       Field      col(const std::string &cname);
00076       Data&      newcol(const std::string & cname);
00077       Data&      stack(Data& b);
00078       Data&      adjoin(Data& b);
00079 
00080       DataNode*   cell(const unsigned r,const unsigned c);
00081       DataNode*   rawcol(unsigned c);
00082       DataNode*   rawcol(const std::string &cname);
00083       unsigned    size(void) const {return numrec;}
00084       unsigned    num_cols(void) const {return numcol;}
00085       unsigned    num_rows(void) const {return numrec;}
00086       Field       mean(const std::string &cname = "");
00087       Field       variance(const std::string &cname = "");
00088       Field       sum(const std::string &cname = "");
00089       Field       sumsq(const std::string &cname = "");
00090       Field       product(const std::string &cname = "");
00091       Field       max(const std::string &cname = "");
00092       Field       min(const std::string &cname = "");
00093       void        stat(void);
00094       doubleMatrix      mat(void);
00095 };
00096 }
00097 
00098 #endif

Generated on Thu Jun 16 17:13:38 2005 for Matvec by doxygen1.2.16