本文整理汇总了C#中MWArray.ToArray方法的典型用法代码示例。如果您正苦于以下问题:C# MWArray.ToArray方法的具体用法?C# MWArray.ToArray怎么用?C# MWArray.ToArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWArray
的用法示例。
在下文中一共展示了MWArray.ToArray方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalOptValuesIndexFind
public double[] CalOptValuesIndexFind(double Thickness, double BulkDensity, double tFResist, double tSFactor, double Porosity, double[,] c1Mat, double[,] c2Mat, int[] FreRegion, int ParaIndenti,int LoopNum)
{
int RowSizeOfPara= 0;
int ColumSizeOfPara= 0;
int SizeOfPEFre=32;
// double TempMaxError=0.0;
double fre;
double[] ValueIndex=new double[3];
int[] CalOptValues=new int[2];
if (ParaIndenti==5)
{
RowSizeOfPara=c1Mat.GetLength(0);;
ColumSizeOfPara=c1Mat.GetLength(1);
}
else if (ParaIndenti==6)
{
RowSizeOfPara=c2Mat.GetLength(0);;
ColumSizeOfPara=c2Mat.GetLength(1);
}
else if (ParaIndenti==7)
{
RowSizeOfPara=c1Mat.GetLength(0);;
ColumSizeOfPara=c1Mat.GetLength(1);
}
double[,,] MAbsorptionMat=new double[RowSizeOfPara,ColumSizeOfPara,SizeOfPEFre];
double[,,] PDAbsorption=new double[RowSizeOfPara,ColumSizeOfPara,SizeOfPEFre];
double[,,] CharFreError=new double[RowSizeOfPara,ColumSizeOfPara,SizeOfPEFre];
double[,] CharFreErrorSum=new double[RowSizeOfPara,ColumSizeOfPara];
double[,] APDAbsorption=new double[RowSizeOfPara,ColumSizeOfPara];
double[,] MaxError=new double[RowSizeOfPara,ColumSizeOfPara];
ttempMAbsorption=TempMAbsorption;
for (int ff=0;ff<SizeOfPEFre;ff++)
{
fre=(ff+1)*200;
//MeritCalcClass.apfibrous5para(Thickness, tFResist, tSFactor, tPorosity, c1Mat, c2Mat,fre); //INSUNG
m_Out = MeritCalcClass.APFibrous5para(B, (MWNumericArray)c1Mat, (MWNumericArray)c2Mat, m_Density1, Densityo, tFResist, fre, tPorosity, HeatRatio, ItaAir, Thickness, Npr, P0, tSFactor, Z0); //INSUNG
APDAbsorption = (double[,])m_Out.ToArray();
for (int i=0;i<RowSizeOfPara;i++)
{
for (int j=0;j<ColumSizeOfPara;j++)
{
MAbsorptionMat[i,j,ff]=ttempMAbsorption[ff];
PDAbsorption[i,j,ff]=APDAbsorption[i+1,j+1];
CharFreError[i,j,ff]=Math.Abs(MAbsorptionMat[i,j,ff]-PDAbsorption[i,j,ff]);
}
}
}
for (int i=0;i<RowSizeOfPara;i++)
{
for(int j=0;j<ColumSizeOfPara;j++)
{
for(int ff=0;ff<SizeOfPEFre;ff++)
{
CharFreErrorSum[i,j] += CharFreError[i,j,ff];
}
}
}
// for (int i=0;i<RowSizeOfPara;i++)
// {
// TempMaxError=0;
// for(int j=0;j<ColumSizeOfPara;j++)
// {
// TempMaxError=0;
// for(int ff=0;ff<(SizeOfPEFre-1);ff++)
// {
// if (TempMaxError < CharFreError[i,j,ff])
// {
// TempMaxError=CharFreError[i,j,ff];
// MaxError[i,j]=TempMaxError;
// }
// CharFreErrorSum[i,j]+= CharFreError[i,j,ff];
// }
// }
// }
if (ParaIndenti==5)
{
ValueIndex=FindMin(CharFreErrorSum, RowSizeOfPara, ColumSizeOfPara);
}
else if (ParaIndenti==6)
{
ValueIndex=FindMin(CharFreErrorSum, RowSizeOfPara, ColumSizeOfPara);
}
else if (ParaIndenti==7)
{
double FirstError=10000;
double tempc1=0;
double tempc2=0;
//double Optc1=tc1;
//double Optc2=tc2;
for (int i=0;i<RowSizeOfPara;i++)
{
//.........这里部分代码省略.........
示例2: FromMatlabArray
public void FromMatlabArray(MWArray data)
{
var k = data.ToArray();
for (int i = 0; i < k.GetLength(0); i++)
{
for (int j = 0; j < k.GetLength(1); j++)
{
object a = k.GetValue(i,j);
byte b = (byte) a;
Pixel p = new Pixel((int)b,(int)b,(int)b,255);
SetPixel(j,i,p);
}
}
}
示例3: CalcFiborousGraphData
public double CalcFiborousGraphData()
{
double Merit=0;
double freq;
double c1 = Math.Sqrt(8*SFactor*ItaAir/(Porosity*FResist))/ViscousCL;
double c2 = Math.Sqrt(8*SFactor*ItaAir/(Porosity*FResist))/ThermalCL;
// H = (Math.Pow(FResist*ViscousCL*Porosity,2))/(4*(Math.Pow(SFactor,2))*ItaAir*Densityo);
// HP = 16*ItaAir/((Math.Pow(Npr*ThermalCL,2))*Densityo);
CAbsorption.Clear();
CRealSurfaceImpedance.Clear();
CImagSurfaceImpedance.Clear();
CAbsorption.AddData(0);
CRealSurfaceImpedance.AddData(0);
CImagSurfaceImpedance.AddData(0);
for (int ff=1;ff<=MaxFre;ff++)
{
freq=Frequency.GetData(ff);
//MeritCalcClass.meritcalc(freq, (double)MAbsorption.GetData(ff),BulkDensity, FResist, SFactor, Porosity, c1, c2, Thickness);//INSUNG
m_Out = MeritCalcClass.MeritCalc(BulkDensity,B,c1,c2,Densityo,FResist,freq,Porosity,HeatRatio,ItaAir,Thickness,(double)MAbsorption.GetData(ff),Npr,P0,SFactor,Z0);//INSUNG
m_Merit = (double)m_Out.ToArray().GetValue(0, 0);
m_Absorption = (double)m_Out.ToArray().GetValue(0, 1);
m_RealSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 2);
m_ImagSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 3);
m_Density1 = BulkDensity;//INSUNG
CAbsorption.AddData((double)m_Absorption);
CRealSurfaceImpedance.AddData((double)m_RealSurfaceImpedance);
CImagSurfaceImpedance.AddData((double)m_ImagSurfaceImpedance);
Merit=Merit+(double)m_Merit;
}
return Merit;
}
示例4: CalcElasticGraphData
public double CalcElasticGraphData()
{
double Merit=0;
double freq;
//double c1 = Math.Sqrt(8*SFactor*ItaAir/(Porosity*FResist))/ViscousCL;
//double c2 = Math.Sqrt(8*SFactor*ItaAir/(Porosity*FResist))/ThermalCL;
CAbsorption.Clear();
CRealSurfaceImpedance.Clear();
CImagSurfaceImpedance.Clear();
CAbsorption.AddData(0);
CRealSurfaceImpedance.AddData(0);
CImagSurfaceImpedance.AddData(0);
for (int ff=1;ff<=MaxFre;ff++)
{
freq=Frequency.GetData(ff);
//MeritCalcClass.elasticmeritcalc(freq, (double)MAbsorption.GetData(ff),FResist, SFactor, Porosity, c1, c2, Ymodulus, LossFactor, PoissonR, Thickness); //INSUNG
m_Out = MeritCalcClass.ElasticMeritCalc(C,c1,c2,m_Density1,m_DensityA,Densityo,Ymodulus,FResist,freq,Porosity,HeatRatio,Thickness,LossFactor,(double)MAbsorption.GetData(ff),Npr,PoissonR,SFactor); //INSUNG
m_Merit = (double)m_Out.ToArray().GetValue(0, 0);
m_Absorption = (double)m_Out.ToArray().GetValue(0, 1);
m_RealSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 2);
m_ImagSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 3);
CAbsorption.AddData((double)m_Absorption);
CRealSurfaceImpedance.AddData((double)m_RealSurfaceImpedance);
CImagSurfaceImpedance.AddData((double)m_ImagSurfaceImpedance);
Merit=Merit+(double)m_Merit;
}
return Merit;
}
示例5: CalcFrequency
/// <summary>
/// ���������� �����ϰ� �⺻ ���ļ������� ���
/// </summary>
private void CalcFrequency()
{
//double Resolution;
int MaxPoint = 0;
// Sampled
Resolution = (double)Frequency.GetData(4) - (double)Frequency.GetData(3);
InitFre = (int)Math.Round(300/Resolution);
MaxFre = (int)Math.Round(6400/Resolution);
double[] FrequencySampled = new double[(int)(MaxFre-InitFre)];
double[] MAbsorptionSampled = new double[(int)(MaxFre-InitFre)];
MRealSurfaceImpedanceSampled = new double[(int)(MaxFre-InitFre)];
MlmagSurfaceImpedanceSampled = new double[(int)(MaxFre-InitFre)];
double[] FrequencyFitted = new double[32];
// double[] MAbsorptionFitted = new double[32];
// double[] MSurfaceImpedanceFitted = new double[32];
FrequencySampled[0] = 0;
MAbsorptionSampled[0] = 0;
for (int i=1;i<(MaxFre-InitFre);i++)
{
FrequencySampled[i] = Frequency.GetData(InitFre + i-1);
MAbsorptionSampled[i] = MAbsorption.GetData(InitFre + i-1);
}
for (int i=1;i<33;i++)
{
FrequencyFitted[i-1] = i*200;
}
//MeritCalcClass.polyfitting(FrequencyFitted, FrequencySampled, MAbsorptionSampled, 13); //INSUNG
m_Out = MeritCalcClass.PolyFitting((MWNumericArray)MAbsorptionSampled, (MWNumericArray)FrequencyFitted, (MWNumericArray)FrequencySampled, 13);
//m_Out = MeritCalcClass.PolyFitting(
m_DataFitted = (double[,])m_Out.ToArray();
// MAbsorptionFitted = ((Array)MeritCalcClass.DataFitted).;
long[] temp = new long[2];
temp[0] = 1;
temp[1] = 1;
for (int i=1;i<33;i++)
{
TempFrequency[i-1] = FrequencyFitted[i-1];
temp[1] = i;
TempMAbsorption[i - 1] = (double)m_DataFitted.GetValue(0, temp[1]);
}
if (MRealSurfaceImpedance.GetCount()>0)
{
MRealSurfaceImpedanceSampled[0] = 0;
for (int i=1;i<(MaxFre-InitFre);i++)
{
MRealSurfaceImpedanceSampled[i] = MRealSurfaceImpedance.GetData(InitFre + i-1);
}
//MeritCalcClass.polyfitting(FrequencyFitted, FrequencySampled, MRealSurfaceImpedanceSampled, 13); //INSUNG
m_Out = MeritCalcClass.PolyFitting((MWNumericArray)MRealSurfaceImpedanceSampled, (MWNumericArray)FrequencyFitted, (MWNumericArray)FrequencySampled, 13);
m_DataFitted = (double[,])m_Out.ToArray();
// MSurfaceImpedanceFitted = (double[])MeritCalcClass.DataFitted;
for (int i=1;i<33;i++)
{
temp[1] = i;
TempMRealSurfaceImpedance[i - 1] = (double)m_DataFitted.GetValue(0, temp[1]);
}
}
if (MImagSurfaceImpedance.GetCount()>0)
{
MlmagSurfaceImpedanceSampled[0] = 0;
for (int i=1;i<(MaxFre-InitFre);i++)
{
MlmagSurfaceImpedanceSampled[i] = MImagSurfaceImpedance.GetData(InitFre + i-1);
}
//MeritCalcClass.polyfitting(FrequencyFitted, FrequencySampled, MlmagSurfaceImpedanceSampled, 13); //INSUNG
MeritCalcClass.PolyFitting((MWNumericArray)MlmagSurfaceImpedanceSampled, (MWNumericArray)FrequencyFitted, (MWNumericArray)FrequencySampled, 13);
m_DataFitted = (double[,])m_Out.ToArray();
// MSurfaceImpedanceFitted = (double[])MeritCalcClass.DataFitted;
for (int i=1;i<33;i++)
{
temp[1] = i;
TempMImagSurfaceImpedance[i - 1] = (double)m_DataFitted.GetValue(0, temp[1]);
}
}
MaxPoint = GetMaxPoint(TempMAbsorption) + 1;
SetFreq(1, MaxPoint, 32);
//.........这里部分代码省略.........
示例6: SolidCalc
public double[,] SolidCalc()
{
double[,] OptSolidPara=new double[1,3];
double Slope1;
double Slope2;
double Slope3;
double Slope4;
double ResonanceFrequency=0;
double freq;
double Merit=0;
double tLossFactor=0;
double OptLossFactor=0;
int ResonFreIndex=0;
for (int i=2;i<MaxFre-InitFre-2;i++)
{
Slope1=(MRealSurfaceImpedanceSampled[i-1]*415-MRealSurfaceImpedanceSampled[i-2]*415)/Resolution;
Slope2=(MRealSurfaceImpedanceSampled[i]*415-MRealSurfaceImpedanceSampled[i-1]*415)/Resolution;
Slope3=(MRealSurfaceImpedanceSampled[i+1]*415-MRealSurfaceImpedanceSampled[i]*415)/Resolution;
Slope4=(MRealSurfaceImpedanceSampled[i+2]*415-MRealSurfaceImpedanceSampled[i+1]*415)/Resolution;
if ( (Slope1/(Math.Abs(Slope1)) < 0) && (Slope2/(Math.Abs(Slope2)) < 0) && (Slope3/(Math.Abs(Slope3)) > 0) && (Slope4/(Math.Abs(Slope4)) > 0))
{
ResonanceFrequency=(double)i*Resolution+300;
break;
}
}
ResonFreIndex=(int)Math.Round(ResonanceFrequency/Resolution);
//MeritCalcClass.peelasticsolid(Thickness, BulkDensity, ResonanceFrequency);
m_Out = MeritCalcClass.PEElasticSolid(BulkDensity, Thickness, ResonanceFrequency); //INSUNG
OptSolidPara = (double[,])m_Out.ToArray();
Ymodulus=(double)OptSolidPara[1,1];
PoissonR=(double)OptSolidPara[1,3];
double Merittemp=100000;
for (int i=1;i<99;i++)
{
tLossFactor=i*0.01;
freq=ResonFreIndex*Resolution;
//MeritCalcClass.elasticmeritcalc(freq, (double)MAbsorption.GetData(ResonFreIndex),FResist, SFactor, Porosity, c1, c2, Ymodulus, tLossFactor, PoissonR, Thickness); //INSUNG
m_Out = MeritCalcClass.ElasticMeritCalc(C,c1,c2,m_Density1,m_DensityA,Densityo,Ymodulus,FResist,freq,Porosity,HeatRatio,Thickness,tLossFactor,(double)MAbsorption.GetData(ResonFreIndex),Npr,PoissonR,SFactor); //INSUNG
m_Merit = (double)m_Out.ToArray().GetValue(0, 0);
m_Absorption = (double)m_Out.ToArray().GetValue(0, 1);
m_RealSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 2);
m_ImagSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 3);
Merit=(double)m_Merit;
if(Merit<Merittemp)
{
OptLossFactor=tLossFactor;
Merittemp=Merit;
}
}
OptSolidPara[1,2]=OptLossFactor;
return OptSolidPara;
}
示例7: MeritCalc
public double[] MeritCalc(double Freq1,double Freq2,double tFResist,double tSFactor,double tPorosity,double tc1,double tc2)
{
double Merit=0;
double MaxError=0;
double freq;
double tempError;
double[] Errors=new double[2];
for (int ff=(int)Freq1;ff<=(int)Freq2;ff++)
{
freq=TempFrequency[ff-1];
//MeritCalcClass.meritcalc(freq, (double)TempMAbsorption[ff-1],BulkDensity, tFResist, tSFactor, tPorosity, tc1, tc2, Thickness);//INSUNG
m_Out = MeritCalcClass.MeritCalc(BulkDensity,B,tc1,tc2,Densityo,tFResist,freq,tPorosity,HeatRatio,ItaAir,Thickness,(double)TempMAbsorption[ff-1],Npr,P0,tSFactor,Z0);//INSUNG
m_Merit = (double)m_Out.ToArray().GetValue(0, 0);
m_Absorption = (double)m_Out.ToArray().GetValue(0, 1);
m_RealSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 2);
m_ImagSurfaceImpedance = (double)m_Out.ToArray().GetValue(0, 3);
m_Density1 = BulkDensity;//INSUNG
Merit=Merit+(double)(m_Merit);
tempError=(double)(m_Merit);
if(MaxError>tempError)
{
MaxError=tempError;
}
//System.Windows.Forms.Application.DoEvents();
}
Errors=new double[2] {MaxError,Merit};
return Errors;
}