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

📄 minmaxdeg.cpp

📁 模糊聚類分析源碼。包含教學文件
💻 CPP
字号:
/*    Context       : Matrix and Vector Operation  Author        : Frank Hoeppner, see also AUTHORS file   Description   : implementation of function module minmaxdeg                    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*/#ifndef minmaxdeg_SOURCE#define minmaxdeg_SOURCE/* configuration include */#ifdef HAVE_CONFIG_H/*//FILETREE_IFDEF HAVE_CONFIG_H*/#include "config.h"/*//FILETREE_ENDIF*/#endif/* necessary includes */#include "minmaxdeg.hpp"/* private typedefs *//* private functions *//* data *//* implementation */template <class V>TData crisp_minimum(V& a_minimum,const V& a_value)  {  TData min(POS_IMPOSSIBLE_RANGE);  const int dim(a_value.rows());  if (dim==1) // degenerated case    {    a_minimum[0] = 1;    min = a_value[0];    }  else    {    int index(dim);    for (int i=0;i<dim;++i)      {      if (a_value[i]<min) { min=a_value[i]; index=i; }      a_minimum[i] = 0;      }    invariant(index!=dim,"can't take minimum of",a_value,SOURCELOC);    a_minimum[index] = 1;    }  return min;  }template <class V>TData crisp_maximum(V& a_maximum,const V& a_value)  {  TData max(NEG_IMPOSSIBLE_RANGE);  const int dim(a_value.rows());  int index(dim);  for (int i=0;i<dim;++i)    {    if (a_value[i]>max) { max=a_value[i]; index=i; }    a_maximum[i] = 0;    }  invariant(index!=dim,"plausibility check",SOURCELOC);  a_maximum[index] = 1;  return max;  }template <class V>TData fuzzy_maximum  (  V& a_maximum,  const V& a_value,  float f,  float eps  )  {  const TData exp(1.0/(f-1.0));  TData max(NEG_IMPOSSIBLE_RANGE);  TData sum(0);  const int dim(a_value.rows());  for (int i=0;i<dim;++i)    {    if (a_value[i]>max) max=a_value[i];    }  for (int i=0;i<dim;++i)    {    a_maximum[i] = pow(max-a_value[i]+eps,exp);    sum += 1/a_maximum[i];     }  max = 0;  for (int i=0;i<dim;++i)    {    a_maximum[i] = 1/(a_maximum[i]*sum);    max += a_maximum[i]*a_value[i];    }  return max;  }template <class V>TData fuzzy_minimum  (  V& a_minimum,  const V& a_value,  float f,  float eps  )  {  const TData exp(1.0/(f-1.0));  TData min(POS_IMPOSSIBLE_RANGE);  TData sum(0);  const int dim(a_value.rows());  for (int i=0;i<dim;++i)    {    if (a_value[i]<min) min=a_value[i];    }  for (int i=0;i<dim;++i)    {    a_minimum[i] = pow(a_value[i]-min+eps,exp);    sum += 1/a_minimum[i];     }  min = 0;  for (int i=0;i<dim;++i)    {    a_minimum[i] = 1/(a_minimum[i]*sum);    min += a_minimum[i]*a_value[i];    }  return min;  }/* template instantiation */#endif /* minmaxdeg_SOURCE */

⌨️ 快捷键说明

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