當前位置: 首頁>>代碼示例>>C#>>正文


C# ScalarValue.GetIntegerOrThrowException方法代碼示例

本文整理匯總了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);
 }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:7,代碼來源:MandelbrotFunction.cs

示例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;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:28,代碼來源:HistFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:33,代碼來源:SphereFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:31,代碼來源:PolyfitFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:9,代碼來源:HermiteFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:9,代碼來源:JacobiFunction.cs

示例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));
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:10,代碼來源:ChebyshevFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:10,代碼來源:YlmFunction.cs

示例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;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:11,代碼來源:InvTangentFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:12,代碼來源:LinspaceFunction.cs

示例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);
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:13,代碼來源:LogspaceFunction.cs

示例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."));
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:13,代碼來源:SleepFunction.cs

示例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;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:15,代碼來源:BesselFunction.cs

示例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;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:16,代碼來源:RandlFunction.cs

示例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;
        }
開發者ID:FlorianRappl,項目名稱:YAMP,代碼行數:16,代碼來源:RandeFunction.cs


注:本文中的YAMP.ScalarValue.GetIntegerOrThrowException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。