本文整理汇总了C#中YAMP.ScalarValue.GetIntegerOrThrowException方法的典型用法代码示例。如果您正苦于以下问题:C# ScalarValue.GetIntegerOrThrowException方法的具体用法?C# ScalarValue.GetIntegerOrThrowException怎么用?C# ScalarValue.GetIntegerOrThrowException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YAMP.ScalarValue
的用法示例。
在下文中一共展示了ScalarValue.GetIntegerOrThrowException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Function
public MatrixValue Function(ScalarValue x0, ScalarValue xn, ScalarValue y0, ScalarValue yn, ScalarValue xsteps, ScalarValue ysteps)
{
var xs = xsteps.GetIntegerOrThrowException("xsteps", Name);
var ys = ysteps.GetIntegerOrThrowException("ysteps", Name);
var m = new Mandelbrot();
return m.CalculateMatrix(x0.Re, xn.Re, y0.Re, yn.Re, xs, ys);
}
示例2: Function
public BarPlotValue Function(MatrixValue Y, ScalarValue nbins)
{
var nn = nbins.GetIntegerOrThrowException("nbins", Name);
var bp = new BarPlotValue();
if (Y.IsVector)
{
bp.AddPoints(YMath.Histogram(Y, nn));
}
else
{
var M = new MatrixValue();
for (var i = 1; i <= Y.DimensionX; i++)
{
var N = YMath.Histogram(Y.GetColumnVector(i), nn);
for (var j = 1; j <= N.Length; j++)
{
M[j, i] = N[j];
}
}
bp.AddPoints(M);
}
return bp;
}
示例3: Function
public ArgumentsValue Function(ScalarValue n)
{
var nn = n.GetIntegerOrThrowException("n", Name);
int dim = nn + 1;
if (dim < 2)
throw new YAMPArgumentRangeException("n", 1.0);
var X = new MatrixValue(dim, dim); // x = sin(phi) * cos(theta)
var Y = new MatrixValue(dim, dim); // y = sin(phi) * sin(theta)
var Z = new MatrixValue(dim, dim); // z = cos(phi)
var stheta = Table(0.0, 2.0 * Math.PI, dim, Math.Sin);
var ctheta = Table(0.0, 2.0 * Math.PI, dim, Math.Cos);
var sphi = Table(0.0, Math.PI, dim, Math.Sin);
var cphi = Table(0.0, Math.PI, dim, Math.Cos);
for (var j = 0; j < dim; j++)
{
var col = j + 1;
for (var i = 0; i < dim; i++)
{
var row = i + 1;
X[row, col] = new ScalarValue(sphi[j] * ctheta[i]);
Y[row, col] = new ScalarValue(sphi[j] * stheta[i]);
Z[row, col] = new ScalarValue(cphi[j]);
}
}
return new ArgumentsValue(X, Y, Z);
}
示例4: Function
public MatrixValue Function(MatrixValue x, MatrixValue y, ScalarValue n)
{
if (x.Length != y.Length)
throw new YAMPDifferentLengthsException(x.Length, y.Length);
var nn = n.GetIntegerOrThrowException("n", Name);
var m = nn + 1;
if (m < 2)
throw new YAMPArgumentRangeException("n", 0.0);
var M = new MatrixValue(x.Length, m);
var b = new MatrixValue(x.Length, 1);
for (var j = 1; j <= M.Rows; j++)
{
var el = ScalarValue.One;
var z = x[j];
for (var i = 1; i <= M.Columns; i++)
{
M[j, i] = el;
el *= z;
}
b[j, 1] = y[j];
}
var qr = QRDecomposition.Create(M);
return qr.Solve(b);
}
示例5: Function
public ScalarValue Function(ScalarValue n, ScalarValue z)
{
var nn = n.GetIntegerOrThrowException("n", Name);
if (nn < 0)
throw new Exception("Hermite polynomial of order n < 0 does not make sense.");
return HermitePolynomial(nn, z);
}
示例6: Function
public ScalarValue Function(ScalarValue n, ScalarValue alpha, ScalarValue beta, ScalarValue z)
{
var nn = n.GetIntegerOrThrowException("n", Name);
if (nn < 0)
throw new Exception("Jacobi polynomial of order n < 0 does not make sense.");
return JacobiPolynomial(nn, alpha, beta, z);
}
示例7: Function
public ScalarValue Function(ScalarValue n, ScalarValue x)
{
var nn = n.GetIntegerOrThrowException("n", Name);
if (nn < 0)
throw new Exception("Chebyshev polynomial of order n < 0 does not make sense.");
var f = GetPolynom(nn);
return new ScalarValue(f(x.Re));
}
示例8: Function
public ScalarValue Function(ScalarValue l, ScalarValue m, ScalarValue theta, ScalarValue phi)
{
var nn = l.GetIntegerOrThrowException("l", Name);
if (nn < 0)
throw new Exception("Spherical harmonics of order l < 0 does not make sense.");
var nm = m.GetIntegerOrThrowException("m", Name);
return Ylm(nn, nm, theta.Re, phi.Re);
}
示例9: Function
public MatrixValue Function(ScalarValue s, MatrixValue Z)
{
var n = s.GetIntegerOrThrowException("s", Name);
var M = new MatrixValue(Z.DimensionY, Z.DimensionX);
for (var j = 1; j <= Z.DimensionY; j++)
for (var i = 1; i <= Z.DimensionX; i++)
M[j, i] = GetValue(n, Z[j, i]);
return M;
}
示例10: Function
public MatrixValue Function(ScalarValue from, ScalarValue to, ScalarValue count)
{
var c = count.GetIntegerOrThrowException("count", Name);
if (c < 2)
{
throw new ArgumentException("linspace");
}
var step = (to.Re - from.Re) / (c - 1);
return new RangeValue(from.Re, to.Re, step);
}
示例11: Function
public MatrixValue Function(ScalarValue start, ScalarValue end, ScalarValue count, ScalarValue basis)
{
var c = count.GetIntegerOrThrowException("count", Name);
if (c < 2)
{
throw new ArgumentException("logspace");
}
var s = (end.Re - start.Re) / (c - 1);
var r = new RangeValue(start.Re, end.Re, s);
return MatrixValue.PowSM(basis, r);
}
示例12: Function
public void Function(ScalarValue timeout)
{
var n = timeout.GetIntegerOrThrowException("timeout", Name);
var start = Environment.TickCount;
using (var blocking = new ManualResetEvent(false))
{
blocking.WaitOne(n);
}
var time = Environment.TickCount - start;
Context.RaiseNotification(new NotificationEventArgs(NotificationType.Information, "Slept " + time + "ms."));
}
示例13: Function
public MatrixValue Function(ScalarValue order, MatrixValue argument)
{
var n = order.GetIntegerOrThrowException("order", Name);
var M = new MatrixValue(argument.DimensionY, argument.DimensionX);
for (var j = 1; j <= argument.DimensionY; j++)
{
for (var i = 1; i <= argument.DimensionX; i++)
{
M[j, i] = GetValue(n, argument[j, i].Re);
}
}
return M;
}
示例14: Function
public MatrixValue Function(ScalarValue rows, ScalarValue cols, ScalarValue mu, ScalarValue b)
{
var n = rows.GetIntegerOrThrowException("rows", Name);
var l = cols.GetIntegerOrThrowException("cols", Name);
var m = new MatrixValue(n, l);
for (var i = 1; i <= l; i++)
{
for (var j = 1; j <= n; j++)
{
m[j, i] = new ScalarValue(Laplace(mu.Re, b.Re));
}
}
return m;
}
示例15: Function
public MatrixValue Function(ScalarValue rows, ScalarValue cols, ScalarValue lambda)
{
var k = rows.GetIntegerOrThrowException("rows", Name);
var l = cols.GetIntegerOrThrowException("cols", Name);
var m = new MatrixValue(k, l);
for (var i = 1; i <= l; i++)
{
for (var j = 1; j <= k; j++)
{
m[j, i] = new ScalarValue(Exponential(lambda.Re));
}
}
return m;
}