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

📄 intervalsetrelation.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
字号:
/*    Context       : Fuzzy Clustering Algorithms  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of class module IntervalSetRelation                    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 IntervalSetRelation_SOURCE#define IntervalSetRelation_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif// necessary includes#include "IntervalSetRelation.hpp"#include "matvecop.cpp"// data// implementationint interval_relation(real_type a,real_type b,real_type c,real_type d)  {  invariant((a<b)&&(c<d),"ordered interval bounds",SOURCELOC);  int i,j;  if (c<a) { i=0; } else  if (c==a) { i=1; } else  if (c<b) { i=2; } else  if (c==b) { i=3; } else { i=4; }  if (d<a) { j=0; } else  if (d==a) { j=1; } else  if (d<b) { j=2; } else  if (d==b) { j=3; } else { j=4; }  invariant(i<=j,"ordered i/j",SOURCELOC);  return ( (IP_FULLMASK << i)&(IP_FULLMASK >> (4-j)) );  }IntervalSetRelation::IntervalSetRelation  (  real_type a_left,    int a_state,  real_type a_right  )  : mp_predecessor(NULL)  {  m_alphabet.adjust(1);  m_alphabet(0)=a_state;  m_leftbound.adjust(1);  m_leftbound(0)=a_left;  m_rightbound.adjust(1);  m_rightbound(0)=a_right;  m_leftmostright=a_right;  m_rightmostleft=a_left;  m_occurences=1; //m_leftmostright-m_rightmostleft+MAXWINWID;  m_relation.adjust(1,1);  m_relation(0,0)=IR_EQUALS;  }IntervalSetRelation::IntervalSetRelation  (  const IntervalSetRelation& a_isr  )  : m_occurences(a_isr.m_occurences)  , mp_predecessor(a_isr.mp_predecessor)  , m_alphabet(a_isr.m_alphabet)  , m_relation(a_isr.m_relation)  , m_leftbound(a_isr.m_leftbound)  , m_rightbound(a_isr.m_rightbound)  , m_leftmostright(a_isr.m_leftmostright)  , m_rightmostleft(a_isr.m_rightmostleft)  {}IntervalSetRelation::IntervalSetRelation  (  IntervalSetRelation *p_isr,  real_type a_left,  int a_state,  real_type a_right  )  : mp_predecessor(p_isr)  {  const int dim(p_isr->m_alphabet.rows());  m_alphabet.adjust(dim+1);  m_relation.adjust(dim+1,dim+1);  m_leftbound.adjust(dim+1);  m_rightbound.adjust(dim+1);  int i,index(0);  while ((index<dim) && (p_isr->m_alphabet(index)<a_state)) ++index;  while ((index<dim) && (p_isr->m_alphabet(index)==a_state) &&    (p_isr->m_leftbound(index)<a_left)) ++index;  while ((index<dim) && (p_isr->m_alphabet(index)==a_state) &&    (p_isr->m_leftbound(index)==a_left) &&     (p_isr->m_rightbound(index)>a_right)) ++index;  for (i=0;i<index;++i)     {    m_alphabet(i)=p_isr->m_alphabet(i);    m_leftbound(i)=p_isr->m_leftbound(i);    m_rightbound(i)=p_isr->m_rightbound(i);    }  m_alphabet(index)=a_state;  m_leftbound(index)=a_left;  m_rightbound(index)=a_right;  m_leftmostright=min(p_isr->m_leftmostright,a_right);  m_rightmostleft=max(p_isr->m_rightmostleft,a_left);  m_occurences=1; //m_leftmostright-m_rightmostleft+MAXWINWID;  for (i=index;i<dim;++i)    {    m_alphabet(i+1)=p_isr->m_alphabet(i);    m_leftbound(i+1)=p_isr->m_leftbound(i);    m_rightbound(i+1)=p_isr->m_rightbound(i);    }  if (index>0)     {    sub_int_matrix_type S(submatrix(m_relation,0,0,index,index));    matrix_set(S,submatrix(p_isr->m_relation,0,0,index,index));    }  if (dim-index>0)    {    sub_int_matrix_type S(submatrix(m_relation,index+1,index+1,dim-index,dim-index));    matrix_set(S,submatrix(p_isr->m_relation,index,index,dim-index,dim-index));    if (index>0)      {      sub_int_matrix_type S(submatrix(m_relation,0,index+1,index,dim-index));      matrix_set(S,submatrix(p_isr->m_relation,0,index,index,dim-index));      sub_int_matrix_type T(submatrix(m_relation,index+1,0,dim-index,index));      matrix_set(T,submatrix(p_isr->m_relation,index,0,dim-index,index));      }    }  for (i=0;i<dim+1;++i)    {    m_relation(index,i) =       interval_relation(a_left,a_right,m_leftbound[i],m_rightbound[i]);    m_relation(i,index) =      interval_relation(m_leftbound[i],m_rightbound[i],a_left,a_right);    }  }bool IntervalSetRelation::operator<  (  const IntervalSetRelation& a_isr  )  const  {  compare_type result;  default_operator_compare<int,int> int_compare;  matrix_compare<int_tuple_type,int_tuple_type,    default_operator_compare<int,int> > tuple_compare(int_compare);  result = tuple_compare(m_alphabet,a_isr.m_alphabet);  if (result!=cmp_equal) return result;//  bit_inclusion_compare bit_compare;//  matrix_compare<int_matrix_type,int_matrix_type,//    bit_inclusion_compare> relation_compare(bit_compare);  matrix_compare<int_matrix_type,int_matrix_type,    default_operator_compare<int,int> > matrix_compare(int_compare);  //  return (relation_compare(m_relation,a_isr.m_relation)==cmp_less);  result = matrix_compare(m_relation,a_isr.m_relation);   return (result==cmp_less);  }voidIntervalSetRelation::write  (  ostream& os  )  const   {  os << "(" << m_alphabet << m_occurences << m_relation << ")";   if (mp_predecessor==NULL) { os << endl; }  else { os << "  <-"; mp_predecessor->write(os); }  }// template instantiation#endif // IntervalSetRelation_SOURCE

⌨️ 快捷键说明

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