Example #1
0
        public BarPlotValue Function(MatrixValue Y)
        {
            var bp = new BarPlotValue();

            bp.AddPoints(Y);
            return(bp);
        }
Example #2
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);
        }
Example #3
0
        /// <summary>
        /// Converts a set of bytes to a new instance.
        /// </summary>
        /// <param name="content">The binary representation.</param>
        /// <returns>The new instance.</returns>
        public override Value Deserialize(byte[] content)
        {
            var bp = new BarPlotValue();

            using (var ds = Deserializer.Create(content))
            {
                bp.Deserialize(ds);
                var length = ds.GetInt();

                for (var i = 0; i < length; i++)
                {
                    var points = new BarPoints();
                    points.Deserialize(ds);
                    var count = ds.GetInt();

                    for (var j = 0; j < count; j++)
                    {
                        points.Add(ds.GetDouble());
                    }

                    points.BarWidth = ds.GetDouble();
                    bp.AddSeries(points);
                }
            }

            return(bp);
        }
Example #4
0
        public BarPlotValue Function(MatrixValue Y, MatrixValue x)
        {
            var bp = new BarPlotValue();
            var X  = new double[x.Length];

            for (var i = 0; i < x.Length; i++)
            {
                X[i] = x[i + 1].Re;
            }

            if (Y.IsVector)
            {
                bp.AddPoints(YMath.Histogram(Y, X));
            }
            else
            {
                var M = new MatrixValue();

                for (var i = 1; i <= Y.DimensionX; i++)
                {
                    var N = YMath.Histogram(Y.GetColumnVector(i), X);

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

                bp.AddPoints(M);
            }

            return(bp);
        }