www.pudn.com > JingXiang-Design-Jeff.rar > SwitchForMethod_0.cpp
// SwitchForMethod_0.cpp: implementation of the SwitchForMethod_0 class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "Design.h"
#include "SwitchForMethod_0.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
SwitchForMethod_0::SwitchForMethod_0(float *pInput,int ElementNum)
{
pInputArray=pInput;
InputArrayElementNum=ElementNum;
MIU_Total_Inside=0;
MIU_1_Inside=0;
MIU_0_Inside=0;
OMIGA_1_Inside=0;
OMIGA_0_Inside=0;
}
SwitchForMethod_0::SwitchForMethod_0()
{
MIU_Total_Inside=0;
MIU_1_Inside=0;
MIU_0_Inside=0;
InputArrayElementNum=0;
pInputArray=NULL;
OMIGA_1_Inside=0;
OMIGA_0_Inside=0;
}
SwitchForMethod_0::~SwitchForMethod_0()
{
}
BOOL SwitchForMethod_0::Get_OMIGA_0_1(int Border)
{
float OMIGA_0=0,OMIGA_1=0;
int i=0;
for(i=0;i<=Border;i++)
{
OMIGA_0+=pInputArray[i];
}
OMIGA_1=1-OMIGA_0;
OMIGA_0_Inside=OMIGA_0;
OMIGA_1_Inside=OMIGA_1;
return TRUE;
}
BOOL SwitchForMethod_0::Get_MIU_0_1(int Border)
{
int i=0;
float MIU_0=0,MIU_1=0;
for(i=0;i<=Border;i++)
{
MIU_0+=i*pInputArray[i];
}
for(i=Border+1;iMax)
{ Max=Now;TheBestSwitch=i;}
}
return TheBestSwitch;
}
void SwitchForMethod_0::Get_Input(float *pInput, int ElementNum)
{
pInputArray=pInput;
InputArrayElementNum=ElementNum;
return;
}