?? link.cpp
字號:
/* Context : Fuzzy Clustering Algorithms Author : Frank Hoeppner, see also AUTHORS file Description : implementation of class module Link 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 Link_SOURCE#define Link_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "Link.hpp"// data// implementationLink::Link ( ) : m_membership(0) , m_pow_membxweight(0) , m_squared_distance(0) , m_pow_distance(0) { arg_distance().adjust(0); arg_degree().adjust(0); }bool Link::consistent ( ) const { bool ok(true); if ((m_membership<0) || (m_membership>1)) { ok=false; error("membership value out of range",*this); } if (m_squared_distance<0) { ok=false; error("negative squared distance",*this); } return ok; }voidLink::read ( istream& is ) { bool read_arg_distance(false); bool read_arg_degree(false); read_until(is,KEYWORD_LINK); while (!is_followed_by(is,KEYWORD_CLOSE,false)) { if (is_followed_by(is,KEYWORD_LINK_MEMBERSHIP,false)) is >> m_membership; else if (is_followed_by(is,KEYWORD_LINK_DISTANCE,false)) is >> m_squared_distance; else if (is_followed_by(is,KEYWORD_LINK_SIDEDIST,false)) { read_matrix(is,m_arg_distance); read_arg_distance=true; } else if (is_followed_by(is,KEYWORD_LINK_SIDEDEG,false)) { read_matrix(is,m_arg_degree); read_arg_degree=true; } else read_until(is,"("); // read opening paranthesis of unknown command read_until_matching_paranthesis(is,'(',')'); } if (!read_arg_degree) { arg_degree().adjust(0); } if (!read_arg_distance) { arg_distance().adjust(0); } trace("read",*this); }void Link::write ( ostream& os ) const { os << KEYWORD_LINK << " "; os << KEYWORD_LINK_MEMBERSHIP << " " << m_membership << KEYWORD_CLOSE; os << KEYWORD_LINK_DISTANCE << " " << m_squared_distance << KEYWORD_CLOSE; if (arg_distance().rows()>0) { os << KEYWORD_LINK_SIDEDIST << " " << arg_distance() << KEYWORD_CLOSE; } if (arg_degree().rows()>0) { os << KEYWORD_LINK_SIDEDEG << " " << arg_degree() << KEYWORD_CLOSE; } os << KEYWORD_CLOSE << " "; } real_typeLink::select ( const Selector& a_selector ) const { real_type value(0); switch (a_selector.m_type) { case SELECT_SIDI : { value=POS_IMPOSSIBLE_RANGE; for (int i=0;i<arg_distance().rows();++i) { if (a_selector.m_index[1]==-1) value = min(value,arg_distance()[i]); else if (a_selector.m_index[1]==i) value = arg_distance()[i]; } } break; case SELECT_SIDE : { value=0; for (int i=0;i<arg_degree().rows();++i) { if (a_selector.m_index[1]==-1) value = max(value,arg_degree()[i]); else if (a_selector.m_index[1]==i) value = arg_degree()[i]; } } break; default : break; } return value; } voidLink::define ( const Selector& a_selector, real_type a_value ) { switch (a_selector.m_type) { default : break; } }// template instantiation#endif // Link_SOURCE
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -