⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fullfeature.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
字号:
/*    Context       : Fuzzy Clustering Algorithms  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of class module FullFeature                    History       :      Comment       :     This file was generated automatically. DO NOT EDIT.  Copyright     : Copyright (C) 1999-2000 Frank Hoeppner    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA*//*  The University of Applied Sciences Oldenburg/Ostfriesland/Wilhelmshaven  hereby disclaims all copyright interests in the program package `fc'   (tool package for fuzzy cluster analysis) written by Frank Hoeppner.    Prof. Haass, President of Vice, 2000-Mar-10*/#ifndef FullFeature_SOURCE#define FullFeature_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "FullFeature.hpp"#include "stlstream.hpp"// data// implementationFullFeature::FullFeature  (    )  : m_weight(DEFAULT_FEATURE_WEIGHT)  , m_range(DEFAULT_FEATURE_NORANGE)  {  datum().adjust(0);  result().adjust(0);  start().adjust(0);  delta().adjust(0);  } boolFullFeature::consistent  (  int& a_data_dim,  const int a_act_depth,  int& a_data_depth  )  const  {  bool ok(true);  a_data_depth=max(a_data_depth,a_act_depth);  if ((a_data_dim==-1) && (datum().rows()>0))    {    a_data_dim = datum().rows();    }  if ((a_data_dim==-1) && (start().rows()>0) && (start().rows()==delta().rows()))    {    a_data_dim = start().rows();    }  a_data_depth=max(a_data_depth,a_act_depth);  list< FullFeature >::const_iterator i;  for (i=m_hierarchy.begin();i!=m_hierarchy.end();++i)    {    ok &= (*i).consistent(a_data_dim,a_act_depth+1,a_data_depth);    }  if ((datum().rows()!=a_data_dim) && (datum().rows()!=0))    {     ok=false;     error("feature datum size mismatch",*this);     }  if (    ((start().rows()!=a_data_dim) || (delta().rows()!=a_data_dim))        && (start().rows()!=0)     )    {     ok=false;    error("feature line start/delta size mismatch ",(*this));     }  return ok;  } voidFullFeature::self_include  (  bbox_type& a_bbox,  stat_type& a_stat  )  const  {  if (datum().rows()>0)     {     a_bbox.include(datum());     a_stat.include(datum());    }  if ((start().rows()>0) && (delta().rows()>0))    {     a_bbox.include(start());    tuple_type final(start());     matrix_inc(final,delta());    a_bbox.include(final);    }  list< FullFeature >::const_iterator i;  for (i=m_hierarchy.begin();i!=m_hierarchy.end();++i)    {     (*i).self_include(a_bbox,a_stat);    }  } real_typeFullFeature::select  (  const Selector& a_selector,  const FullFeature* ap_prev_data  )  const  {  const int index(a_selector.m_index[0]);  real_type value(0);  switch (a_selector.m_type)    {    case SELECT_ATTR : if (index>=0) {      if (datum().rows()>index) value = datum()(index);      else if (start().rows()>index) value = start()(index);       } break;    case SELECT_DELT : if (index>=0) {      if (datum().rows()>index)        value = (ap_prev_data==NULL)?0:(ap_prev_data->datum()(index)-datum()(index));      if (delta().rows()>index) value = delta()(index);      } break;    case SELECT_WEIG :       value = weight();      break;    default :      break;    }  return value;  } voidFullFeature::define  (  const Selector& a_selector,  real_type a_value  )  {  const int index(a_selector.m_index[0]);  switch (a_selector.m_type)    {    case SELECT_ATTR : if (index>=0) {      if (datum().rows()>index) datum()(index) = a_value;      } break;    case SELECT_DELT : if (index>=0) {             } break;    case SELECT_WEIG :       weight()=a_value;      break;    default :       break;    }  } voidFullFeature::read  (  istream& is  )  {  bool read_vector(false);  bool read_weight(false);  bool read_range(false);  bool read_result(false);  bool read_line(false);  m_hierarchy.clear();  unrecognized() = "";  read_until(is,KEYWORD_FEATURE);  while (!is_followed_by(is,KEYWORD_CLOSE,false))    {    if (is_followed_by(is,KEYWORD_FEATURE_VECTOR,false))      { read_matrix(is,datum()); read_vector=true; } else    if (is_followed_by(is,KEYWORD_FEATURE_WEIGHT,false))      { is >> weight(); read_weight = true; } else    if (is_followed_by(is,KEYWORD_FEATURE_RANGE,false))      { is >> range(); read_range = true; } else    if (is_followed_by(is,KEYWORD_FEATURE_RESULT,false))      { is >> result(); read_result = true; } else    if (is_followed_by(is,KEYWORD_FEATURE_LINE,false))       { read_matrix(is,start()); read_matrix(is,delta()); read_line=true; } else    if (is_followed_by(is,KEYWORD_FEATURE_HIERARCHY))      {       stl_container_input(is,m_hierarchy,KEYWORD_FEATURE_HIERARCHY," ",KEYWORD_CLOSE);       is.putback(')'); // is expected below      } else    // ASSUME: there is an IF above, closed by an open ELSE      {      read_until(is,"("); // read opening paranthesis of unknown command      string entry;      read_until_matching_paranthesis(is,'(',')',entry);      unrecognized() += "(";       unrecognized() += entry;       unrecognized() +=") ";      is.putback(')');      }    read_until_matching_paranthesis(is,'(',')');    }  if (!read_vector) { datum().adjust(0); }  if (!read_weight)    { weight() = DEFAULT_FEATURE_WEIGHT; }  if (!read_range)    { range()=DEFAULT_FEATURE_NORANGE; }  if (!read_result)    { result().adjust(0); }  if (!read_line) { start().adjust(0); delta().adjust(0); }  trace("read",*this);  } voidFullFeature::write  (  ostream& os  )  const  {  os << KEYWORD_FEATURE << " ";  if (datum().rows()>0)    { os << KEYWORD_FEATURE_VECTOR << " ";      write_matrix(os,datum()); os << KEYWORD_CLOSE << " "; }  if (weight()!=DEFAULT_FEATURE_WEIGHT)    os << KEYWORD_FEATURE_WEIGHT << " "        << weight() << KEYWORD_CLOSE << " ";  if (range()!=DEFAULT_FEATURE_NORANGE)    os << KEYWORD_FEATURE_RANGE << " "        << range() << KEYWORD_CLOSE << " ";  if (result().rows()>0)    os << KEYWORD_FEATURE_RESULT << " "        << result() << KEYWORD_CLOSE << " ";  if (start().rows()>0)    { os << KEYWORD_FEATURE_LINE << " "          << start() << delta() << KEYWORD_CLOSE << " "; }  if (!m_hierarchy.empty())    stl_container_output(os,hierarchy(),KEYWORD_FEATURE_HIERARCHY," ",KEYWORD_CLOSE);  os << unrecognized();  os << KEYWORD_CLOSE << " ";  }// template instantiation#endif // FullFeature_SOURCE

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -