📄 pr_unit.h
字号:
/*
filename: PR_unit.h
function: define the PR_unit class
@copyright
date : 2008-12-25
author : loop111
e-mail : loop111@gmail.com
*/
#ifndef PR_UNIT_H
#define PR_UNIT_H
#include<vector>
#include<iostream>
using std::vector;
using std::cout;
enum Distance_type{EUCLIDEAN,MAHALANOBIS,HAMMING,LEVENSHTEIN,CHEBYSHEV,MINKOWAKI,TANIMOTO};
class PR_unit
{
public:
vector<double> unit;
int numcluster; //the number of cluster the unit belong to
vector<double> dest; //the destination of the input sample
double error;
PR_unit(){}
PR_unit(int n,double value=0)
{
for(int i=0;i<n;i++)
{
unit.push_back(value);
}
}
void Print()
{
int i=0;
for(i=0;i<unit.size();i++)
{
cout<<unit[i]<<" ";
}
cout<<" -> ";
for(i =0;i<dest.size();i++)
{
cout<<dest[i];
}
}
PR_unit& operator*(double);
PR_unit& operator*=(double);
PR_unit& operator/(double);
PR_unit& operator+(PR_unit&);
PR_unit& operator-(PR_unit&);
PR_unit& operator+=(PR_unit&);
double operator[](int i);
};
double distance(PR_unit* unit1,PR_unit* unit2,Distance_type type=EUCLIDEAN); //calculate the distance of two vector
double vector_multiplication(PR_unit* unit1,PR_unit* unit2,int type=0); //calculate the multiplication of two vector
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -