本文整理汇总了C#中Altaxo.Calc.LinearAlgebra.DoubleVector.GetInternalData方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleVector.GetInternalData方法的具体用法?C# DoubleVector.GetInternalData怎么用?C# DoubleVector.GetInternalData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Altaxo.Calc.LinearAlgebra.DoubleVector
的用法示例。
在下文中一共展示了DoubleVector.GetInternalData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInternalData
public void GetInternalData()
{
double[] testvector = new double[2]{0,1};
DoubleVector test = new DoubleVector(testvector);
double[] internaldata = test.GetInternalData();
Assert.AreEqual(internaldata.Length,testvector.Length);
Assert.AreEqual(internaldata[0],testvector[0]);
Assert.AreEqual(internaldata[1],testvector[1]);
}
示例2: ProbabilityDensity
//.........这里部分代码省略.........
case "bcv":
//bcv = bw.bcv(x),
break;
case "sj":
//sj = , "sj-ste" = bw.SJ(x, method="ste"),
break;
case "sj-dpi":
//"sj-dpi" = bw.SJ(x, method="dpi"),
break;
default:
throw new ArgumentException("Unknown bandwith selection rule: " + bwSel.ToString());
}
}
if (!RMath.IsFinite(bw))
throw new ArithmeticException("Bandwidth is not finite");
bw = adjust * bw;
if (!(bw > 0))
throw new ArithmeticException("Bandwith is not positive");
if (from.IsNaN())
from = x.GetMinimum() - cut * bw;
if (to.IsNaN())
to = x.GetMaximum() + cut * bw;
if (!RMath.IsFinite(from))
throw new ArithmeticException("non-finite 'from'");
if (!to.IsFinite())
throw new ArithmeticException("non-finite 'to'");
double lo = from - 4 * bw;
double up = to + 4 * bw;
var y = new DoubleVector(2 * n);
MassDistribution(x, weights, lo, up, y, n);
y.Multiply(totMass);
var kords = new DoubleVector(2 * n);
kords.FillWithLinearSequenceGivenByStartEnd(0, 2 * (up - lo));
for (int i = n + 1, j = n - 1; j >= 0; i++, j--)
kords[i] = -kords[j];
switch (kernel)
{
case ConvolutionKernel.Gaussian:
kords.Apply(new Probability.NormalDistribution(0, bw).PDF);
break;
case ConvolutionKernel.Rectangular:
double a = bw * Math.Sqrt(3);
kords.Apply(delegate(double xx) { return Math.Abs(xx) < a ? 0.5 / a : 0; });
break;
case ConvolutionKernel.Triangular:
a = bw * Math.Sqrt(6);
kords.Apply(delegate(double xx) { return Math.Abs(xx) < a ? (1 - Math.Abs(xx) / a) / a : 0; });
break;
case ConvolutionKernel.Epanechnikov:
a = bw * Math.Sqrt(5);
kords.Apply(delegate(double xx) { return Math.Abs(xx) < a ? 0.75 * (1 - RMath.Pow2(Math.Abs(xx) / a)) / a : 0; });
break;
case ConvolutionKernel.Biweight:
a = bw * Math.Sqrt(7);
kords.Apply(delegate(double xx) { return Math.Abs(xx) < a ? 15.0 / 16.0 * RMath.Pow2(1 - RMath.Pow2(Math.Abs(xx) / a)) / a : 0; });
break;
case ConvolutionKernel.Cosine:
a = bw / Math.Sqrt(1.0 / 3 - 2 / RMath.Pow2(Math.PI));
kords.Apply(delegate(double xx) { return Math.Abs(xx) < a ? (1 + Math.Cos(Math.PI * xx / a)) / (2 * a) : 0; });
break;
case ConvolutionKernel.Optcosine:
a = bw / Math.Sqrt(1 - 8 / RMath.Pow2(Math.PI));
kords.Apply(delegate(double xx) { return Math.Abs(xx) < a ? Math.PI / 4 * Math.Cos(Math.PI * xx / (2 * a)) / a : 0; });
break;
default:
throw new ArgumentException("Unknown convolution kernel");
}
var result = new DoubleVector(2 * n);
Fourier.FastHartleyTransform.CyclicRealConvolution(y.GetInternalData(), kords.GetInternalData(), result.GetInternalData(), 2 * n, null);
y.Multiply(1.0 / (2 * n));
VectorMath.Max(y, 0, y);
var xords = VectorMath.CreateEquidistantSequenceByStartEndLength(lo, up, n);
var xu = VectorMath.CreateEquidistantSequenceByStartEndLength(from, to, n_user);
double[] res2 = new double[xu.Length];
Interpolation.LinearInterpolation.Interpolate(xords, result, n, xu, xu.Length, 0, out res2);
return new ProbabilityDensityResult() { X = xu, Y = VectorMath.ToROVector(res2), Bandwidth = bw };
}