A scalar value, which is a complex double type.
Наследование: NumericValue
Пример #1
0
        public ArgumentsValue Function(MatrixValue X, MatrixValue Y)
        {
            if (X.Length != Y.Length)
                throw new YAMPDifferentLengthsException(X.Length, Y.Length);

            var x1 = new ScalarValue();
            var y1 = new ScalarValue();
            var xy = new ScalarValue();
            var x2 = new ScalarValue();
            var slope = new ScalarValue();
            var offset = new ScalarValue();

            for (var i = 1; i <= X.Length; i++)
            {
                x1 = x1 + X[i];
                y1 = y1 + Y[i];
                xy = xy + X[i] * Y[i];
                x2 = x2 + X[i] * X[i];
            }

            var J = ((Double)X.Length * x2) - (x1 * x1);

            if (J.Re != 0.0)
            {
                slope = (((Double)X.Length * xy) - (x1 * y1)) / J.Re;
                offset = ((y1 * x2) - (x1 * xy)) / J.Re;
            }

            return new ArgumentsValue(slope, offset);
        }
Пример #2
0
        public MatrixValue Function(MatrixValue M)
        {
            if (M.DimensionX != 3 && M.DimensionY != 3)
                throw new YAMPMatrixDimensionException(3, M.DimensionX, M.DimensionY, M.DimensionX);

            var isTransposed = M.DimensionY != 3;

            if (isTransposed)
            {
                M = M.Transpose();
            }

            var m = new MatrixValue(3, M.DimensionX);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var r = M[1, i].Re;
                var theta = M[2, i].Re;
                var phi = M[3, i].Re;
                var rt = r * Math.Sin(theta);
                m[1, i] = new ScalarValue(rt * Math.Cos(phi));
                m[2, i] = new ScalarValue(rt * Math.Sin(phi));
                m[3, i] = new ScalarValue(r * Math.Cos(theta));
            }

            return isTransposed ? m.Transpose() : m;
        }
Пример #3
0
        public MatrixValue Function(MatrixValue M)
        {
            if (M.DimensionX != 3 && M.DimensionY != 3)
                throw new YAMPMatrixDimensionException(3, M.DimensionX, M.DimensionY, M.DimensionX);

            var isTransposed = M.DimensionY != 3;

            if (isTransposed)
            {
                M = M.Transpose();
            }

            var m = new MatrixValue(3, M.DimensionX);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var x = M[1, i].Re;
                var y = M[2, i].Re;
                var z = M[3, i].Re;
                var r = Math.Sqrt(x * x + y * y + z * z);
                var phi = Math.Atan2(y, x);
                var theta = Math.Acos(z / r);
                m[1, i] = new ScalarValue(r);
                m[2, i] = new ScalarValue(theta);
                m[3, i] = new ScalarValue(phi);
            }

            return isTransposed ? m.Transpose() : m;
        }
Пример #4
0
 // R is the radix, N the total length, and u contains the Nth complex roots of unity
 public Transformlet(int R, int N, ScalarValue[] u)
 {
     this.R = R;
     this.N = N;
     this.u = u;
     this.dx = N / R;
 }
Пример #5
0
 public MatrixValue Function(ScalarValue x, ScalarValue y, ScalarValue z)
 {
     var r = Math.Sqrt(x.Re * x.Re + y.Re * y.Re + z.Re * z.Re);
     var phi = Math.Atan2(y.Re, x.Re);
     var theta = Math.Acos(z.Re / r);
     return new MatrixValue(new[] { new ScalarValue(r), new ScalarValue(theta), new ScalarValue(phi) }, 3, 1);
 }
Пример #6
0
        public MatrixValue Function(ScalarValue j1, ScalarValue j2)
        {
            if (isNotHalf(j1))
                throw new ArgumentException("0, +-0.5, +-1, +-1.5, ...", j1.Re.ToString());

            if (isNotHalf(j2))
                throw new ArgumentException("0, +-0.5, +-1, +-1.5, ...", j2.Re.ToString());

            var l = 1;
            var M = new MatrixValue();

            for (var m1 = -j1.Re; m1 <= j1.Re; m1 += 1.0)
            {
                for (var m2 = -j2.Re; m2 <= j2.Re; m2 += 1.0)
                {
                    var m = m1 + m2;
                    var ja = j1.Re + j2.Re;

                    for (var j = Math.Abs(m); j <= ja; j += 1.0)
                    {
                        var v = CGCoefficients(j1.Re, j2.Re, j, m1, m2);
                        M[l, 1] = new ScalarValue(m);
                        M[l, 2] = new ScalarValue(m1);
                        M[l, 3] = new ScalarValue(m2);
                        M[l, 4] = new ScalarValue(j);
                        M[l, 5] = new ScalarValue(v);
                        l++;
                    }
                }
            }

            return M;
        }
Пример #7
0
        static MatrixValue Generate(Int32 n, Int32 m)
        {
            var distribution = new DiscreteUniformDistribution(Rng);
            var l = n * m;
            var M = new MatrixValue(n, m);
            var numbers = new List<Int32>();
            distribution.Alpha = 0;

            for (var i = 1; i <= l; i++)
            {
                numbers.Add(i);
            }

            for (var j = 1; j <= n; j++)
            {
                for (var i = 1; i <= m; i++)
                {
                    distribution.Beta = numbers.Count - 1;
                    var index = distribution.Next();
                    index = Math.Max(Math.Min(0, index), numbers.Count - 1);
                    M[j, i] = new ScalarValue(numbers[index]);
                    numbers.RemoveAt(index);
                }
            }

            return M;
        }
Пример #8
0
        Plot2DValue Plot(IFunction f, Double minx, Double maxx, Double precision)
        {
            var cp = new Plot2DValue();
            var N = (Int32)((maxx - minx) / precision) + 1;
            var M = new MatrixValue(N, 2);
            var x = new ScalarValue(minx);

            for (var i = 0; i < N; i++)
            {
                var row = i + 1;
                var y = f.Perform(Context, x);
                M[row, 1] = x.Clone();

                if (y is ScalarValue)
                {
                    M[row, 2] = (ScalarValue)y;
                }
                else if (y is MatrixValue)
                {
                    var Y = (MatrixValue)y;

                    for (var j = 1; j <= Y.Length; j++)
                    {
                        M[row, j + 1] = Y[j];
                    }
                }

                x.Re += precision;
            }

            cp.AddPoints(M);
            return cp;
        }
Пример #9
0
        public MatrixValue Function(MatrixValue M)
        {
            if (M.DimensionX != 2 && M.DimensionY != 2)
                throw new YAMPMatrixDimensionException(2, M.DimensionX, M.DimensionY, M.DimensionX);

            var isTransposed = M.DimensionY != 2;

            if (isTransposed)
            {
                M = M.Transpose();
            }

            var m = new MatrixValue(2, M.DimensionX);

            for (var i = 1; i <= M.DimensionX; i++)
            {
                var x = M[1, i].Re;
                var y = M[2, i].Re;
                var phi = Math.Atan2(y, x);
                var r = x == 0.0 ? y : (y == 0.0 ? x : x / Math.Cos(phi));
                m[1, i] = new ScalarValue(r * Math.Cos(phi));
                m[2, i] = new ScalarValue(r * Math.Sin(phi));
            }

            return isTransposed ? m.Transpose() : m;
        }
Пример #10
0
        /// <summary>
        /// Returns the complex dot product (a, b).
        /// </summary>
        /// <param name="aStore">The first vector a.</param>
        /// <param name="aOffset">Offset in the vector a.</param>
        /// <param name="aStride">The offset between two elements of the vector a.</param>
        /// <param name="bStore">The second vector b.</param>
        /// <param name="bOffset">Offset in the vector a.</param>
        /// <param name="bStride">The offset between two elements of the vector a.</param>
        /// <param name="count">The number of elements to consider.</param>
        /// <returns>The result of the complex dot product.</returns>
        public static ScalarValue cDot(ScalarValue[] aStore, int aOffset, int aStride, ScalarValue[] bStore, int bOffset, int bStride, int count)
        {
            double re = 0.0;
            double im = 0.0;
            int n = 0;
            int a = aOffset;
            int b = bOffset;

            while (n < count)
            {
                var re1 = aStore[a].Re;
                var im1 = aStore[a].Im;
                var re2 = bStore[b].Re;
                var im2 = bStore[b].Im;

                re += (re1 * re2 - im1 * im2);
                im += (re1 * im2 + im1 * re2);

                n++;
                a += aStride;
                b += bStride;
            }

            return new ScalarValue(re, im);
        }
Пример #11
0
        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;
        }
Пример #12
0
 public MatrixValue Function(ScalarValue x0, ScalarValue xn, ScalarValue y0, ScalarValue yn)
 {
     var m = new Newton();
     var xsteps = (int)Math.Abs(Math.Ceiling((xn.Re - x0.Re) / 0.1));
     var ysteps = (int)Math.Abs(Math.Ceiling((yn.Re - y0.Re) / 0.1));
     return m.CalculateMatrix(x0.Re, xn.Re, y0.Re, yn.Re, xsteps, ysteps);
 }
Пример #13
0
        public virtual void FftKernel(ScalarValue[] x, ScalarValue[] y, int y0, int dy, int sign)
        {
            int yi = y0;
            y[yi] = ScalarValue.Zero;

            for (int j = 0; j < R; j++)
                y[yi] += x[j];

            // now do the higher index entries
            for (int i = 1; i < R; i++)
            {
                yi += dy;
                y[yi] = x[0];
                int ui = 0; if (sign < 0) ui = N;
                int du = dx * i; if (sign < 0) du = -du;

                for (int j = 1; j < R; j++)
                {
                    ui += du;

                    if (ui >= N)
                        ui -= N;

                    if (ui < 0)
                        ui += N;

                    y[yi] += x[j] * u[ui];
                }
            }
        }
Пример #14
0
 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);
 }
Пример #15
0
        public virtual void FftPass(ScalarValue[] x, ScalarValue[] y, int Ns, int sign)
        {
            var v = new ScalarValue[R];
            int dx = N / R;

            for (int j = 0; j < dx; j++)
            {
                int xi = j;
                int ui = 0;

                if (sign < 0)
                    ui = N;

                int du = (dx / Ns) * (j % Ns);

                if (sign < 0)
                    du = -du;

                v[0] = x[xi];

                for (int r = 1; r < R; r++)
                {
                    xi += dx;
                    ui += du;
                    v[r] = x[xi] * u[ui];
                }

                int y0 = Expand(j, Ns, R);
                FftKernel(v, y, y0, Ns, sign);
            }
        }
Пример #16
0
 public static ScalarValue Ylm(int l, int m, double theta, double phi)
 {
     var expphi = new ScalarValue(0.0, m * phi).Exp();
     var factor = m < 0 ? Math.Pow(-1, -m) : 1.0;
     var legend = Plm(l, Math.Abs(m), Math.Cos(theta));
     return factor * expphi * legend;
 }
Пример #17
0
        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);
        }
Пример #18
0
        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);
        }
Пример #19
0
 public MatrixValue Function(MatrixValue original, ScalarValue x)
 {
     var spline = new SplineInterpolation(original);
     var M = new MatrixValue(1, 2);
     M[1, 1].Re = x.Re;
     M[1, 2].Re = spline.ComputeValue(x.Re);
     return M;
 }
Пример #20
0
        protected override ScalarValue GetValue(ScalarValue value)
        {
            if (value.Re == 0.0 && value.Im == 0.0)
                return ScalarValue.One;

            var arg = value * Math.PI;
            return arg.Sin() / arg;
        }
Пример #21
0
 public MatrixValue Function(ScalarValue r, ScalarValue phi, ScalarValue theta)
 {
     var rt = r.Re * Math.Sin(theta.Re);
     var x = new ScalarValue(rt * Math.Cos(phi.Re));
     var y = new ScalarValue(rt * Math.Sin(phi.Re));
     var z = new ScalarValue(r.Re * Math.Cos(theta.Re));
     return new MatrixValue(new[] { x, y, z }, 3, 1);
 }
Пример #22
0
        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);
        }
Пример #23
0
        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);
        }
Пример #24
0
        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));
        }
Пример #25
0
        static void FftKernel(ScalarValue x0, ScalarValue x1, out ScalarValue y0, out ScalarValue y1)
        {
            double a0 = x0.Re;
            double b0 = x0.Im;
            double a1 = x1.Re;
            double b1 = x1.Im;

            y0 = new ScalarValue(a0 + a1, b0 + b1);
            y1 = new ScalarValue(a0 - a1, b0 - b1);
        }
Пример #26
0
        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);
        }
Пример #27
0
        ScalarValue GetValue(int n, ScalarValue z)
        {
            if (n == 1)
                return z.Arctan();
            else if (n == 0)
                return z / (1.0 + z * z);

            var iz = z * ScalarValue.I;
            return IMAGONEHALF * (PolyLogFunction.Polylog(n, iz) - PolyLogFunction.Polylog(n, -iz));
        }
Пример #28
0
        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;
        }
Пример #29
0
        /// <summary>
        /// Returns the result of the product x = a * x, with a complex a and a complex vector x.
        /// </summary>
        /// <param name="alpha">Some arbitrary complex scalar.</param>
        /// <param name="store">The complex vector x.</param>
        /// <param name="offset">The offset in the vector x.</param>
        /// <param name="stride">The offset between two elements in x.</param>
        /// <param name="count">The number of elements to consider (from x).</param>
        public static void cScal(ScalarValue alpha, ScalarValue[] store, int offset, int stride, int count)
        {
            int n = 0;
            int i = offset;

            while (n < count)
            {
                store[i] *= alpha;
                n++;
                i += stride;
            }
        }
Пример #30
0
        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);
        }
Пример #31
0
        public ScalarValue Function(ScalarValue z)
        {
            var m = new Mandelbrot();

            return(new ScalarValue(m.Run(z.Re, z.Im)));
        }
Пример #32
0
        public ContourPlotValue Function(MatrixValue X, MatrixValue Y, MatrixValue Z, ScalarValue n)
        {
            var nn   = n.GetIntegerOrThrowException("n", Name);
            var plot = new ContourPlotValue();

            plot.AddPoints(X, Y, Z);
            plot.SetLevels(nn);
            return(plot);
        }
Пример #33
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(Zeta.RiemannZeta(value));
 }
Пример #34
0
 /// <summary>
 /// Creates a new scalar value from the given one.
 /// </summary>
 /// <param name="value">Copies the contents of the given value.</param>
 public ScalarValue(ScalarValue value)
     : this(value._real, value._imag)
 {
 }
Пример #35
0
        protected override ScalarValue GetValue(ScalarValue z)
        {
            var zi = 1.0 / z;

            return((zi + (zi + 1.0).Sqrt() * (zi - 1.0).Sqrt()).Ln());
        }
Пример #36
0
 public ComplexPlotValue Function(FunctionValue f, ScalarValue min, ScalarValue max)
 {
     return(Plot(f, min.Re, max.Re, min.Im, max.Im));
 }
Пример #37
0
 public MatrixValue Function(ScalarValue start, ScalarValue end, ScalarValue count)
 {
     return(Function(start, end, count, new ScalarValue(10)));
 }
Пример #38
0
        public FunctionValue Function(MatrixValue Y, ScalarValue nbins, ScalarValue nParameters)
        {
            var nn      = nbins.GetIntegerOrThrowException("nbins", Name);
            var nP      = nParameters.GetIntegerOrThrowException("nParameters", Name);
            var N       = Y.Length;
            var min_idx = Y.Min();
            var min     = Y[min_idx.Row, min_idx.Column];
            var max_idx = Y.Max();
            var max     = Y[max_idx.Row, max_idx.Column];
            var median  = YMath.Median(Y);

            var variance = ScalarValue.Zero;
            var mean     = Y.Sum() / Y.Length;

            for (var i = 1; i <= Y.Length; i++)
            {
                variance += (Y[i] - mean).Square();
            }

            variance /= Y.Length;

            var delta = (max - min) / nn;

            var x = new MatrixValue(nn, 1);

            for (var i = 0; i < nn; i++)
            {
                x[i + 1] = min + delta * i;
            }

            var histogram = new HistogramFunction();
            var fx        = histogram.Function(Y, x);
            var linearfit = new LinfitFunction(Context);

            var dist = linearfit.Function(x, fx, new FunctionValue((context, argument) =>
            {
                var _x       = (argument as ScalarValue - median / 2) / (variance / 4);
                var _exp_x_2 = (-_x * _x).Exp();
                var result   = new MatrixValue(1, nP - 1);

                for (var i = 0; i < nP - 1; i++)
                {
                    result[i + 1] = _exp_x_2 * _x.Pow(new ScalarValue(i));
                }

                return(result);
            }, true));

            var norm        = Y.Length * (max - min) / nbins;
            var normed_dist = new FunctionValue((context, argument) =>
            {
                var temp = dist.Perform(context, argument);

                if (temp is ScalarValue)
                {
                    return(((ScalarValue)temp) / norm);
                }
                else if (temp is MatrixValue)
                {
                    return(((MatrixValue)temp) / norm);
                }

                throw new YAMPOperationInvalidException();
            }, true);

            return(normed_dist);
        }
Пример #39
0
        public ScalarValue Function(ScalarValue order, ScalarValue argument)
        {
            var n = order.GetIntegerOrThrowException("order", Name);

            return(GetValue(n, argument.Re));
        }
Пример #40
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(new ScalarValue(Bessel.j1(value.Re)));
 }
Пример #41
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(1.0 / value.Sin());
 }
Пример #42
0
        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));
        }
Пример #43
0
        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));
        }
Пример #44
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(2.0 / (value.Exp() - (-value).Exp()));
 }
Пример #45
0
 public ComplexPlotValue Function(FunctionValue f, ScalarValue minX, ScalarValue maxX, ScalarValue minY, ScalarValue maxY)
 {
     return(Plot(f, minX.Re, maxX.Re, minY.Re, maxY.Re));
 }
Пример #46
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(new ScalarValue(value.Arg()));
 }
Пример #47
0
        public MatrixValue Function(ScalarValue rows, ScalarValue cols, ScalarValue theta, ScalarValue k)
        {
            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(Gamma(theta.Re, k.Re));
                }
            }

            return(m);
        }
Пример #48
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(value.Conjugate());
 }
Пример #49
0
 public override ScalarValue Compare(ScalarValue left, ScalarValue right)
 {
     return(new ScalarValue(left == right));
 }
Пример #50
0
        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);
        }
Пример #51
0
 /// <summary>
 /// Implementation of the operation.
 /// </summary>
 /// <param name="left">The left scalar.</param>
 /// <param name="right">The right scalar.</param>
 /// <returns>The result of the operation.</returns>
 public abstract ScalarValue Operation(ScalarValue left, ScalarValue right);
Пример #52
0
        public MatrixValue Function(ScalarValue dim)
        {
            var k = (int)dim.Re;

            return(MatrixValue.Ones(k, k));
        }
        public MatrixValue Function(ScalarValue n)
        {
            var d = n.GetIntegerOrThrowException("n", Name);

            return(Generate(d, d));
        }
 static ScalarValue GetValue(ScalarValue value, Double newBase)
 {
     return(value.Log(newBase));
 }
Пример #55
0
 public MatrixValue Function(ScalarValue rows, ScalarValue cols)
 {
     return(Function(rows, cols, new ScalarValue(1.0)));
 }
Пример #56
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(new ScalarValue(double.IsInfinity(value.Re) || double.IsInfinity(value.Im)));
 }
Пример #57
0
 public ScalarValue Function(ScalarValue a, ScalarValue b)
 {
     return(a / b);
 }
Пример #58
0
 protected override ScalarValue GetValue(ScalarValue value)
 {
     return(value.Log10());
 }
Пример #59
0
        public ScalarValue Function(ScalarValue x, ScalarValue y)
        {
            var m = new Mandelbrot();

            return(new ScalarValue(m.Run(x.Re, y.Re)));
        }
Пример #60
0
 public MatrixValue Function(ScalarValue dim)
 {
     return(Function(dim, dim));
 }