• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ScalarValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ScalarValue的典型用法代码示例。如果您正苦于以下问题:C# ScalarValue类的具体用法?C# ScalarValue怎么用?C# ScalarValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ScalarValue类属于命名空间,在下文中一共展示了ScalarValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: DiLog1

        static ScalarValue DiLog1(ScalarValue e)
        {
            var f = new ScalarValue(Math.PI * Math.PI / 6.0);

            if (e == 0.0)
            {
                return f;
            }

            var L = e.Ln();
            var ek = ScalarValue.One;

            for (var k = 1; k < 250; k++)
            {
                var f_old = f.Clone();
                ek *= e;
                var df = ek * (L - 1.0 / k) / k;
                f += df;

                if (f == f_old)
                {
                    return f;
                }
            }

            throw new YAMPNotConvergedException("spence");
        }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:27,代码来源:SpenceFunction.cs


示例2: Function

 public MatrixValue Function(StringValue str)
 {
     var m = new MatrixValue();
     m[1, 1] = new ScalarValue(1);
     m[1, 2] = new ScalarValue(str.Value.Length);
     return m;
 }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:7,代码来源:SizeFunction.cs


示例3: GetValueToEncode

        public override ScalarValue GetValueToEncode(ScalarValue value, ScalarValue priorValue, Scalar field)
        {
            if (value == null)
                return ScalarValue.Null;

            return value;
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:7,代码来源:NoneOperatorCodec.cs


示例4: Gegenbauer

        public static ScalarValue Gegenbauer(Int32 n, Double alpha, ScalarValue x)
        {
            if (n < 0)
                throw new YAMPArgumentRangeException("n");

            if (alpha <= 0)
                throw new YAMPArgumentRangeException("alpha", 0);

            if (x.Abs() > 1.0)
                throw new YAMPArgumentRangeException("x", -1, 1);

            var C0 = ScalarValue.One;

            if (n == 0)
            {
                return C0;
            }

            var C1 = 2.0 * alpha * x;

            if (n == 1)
            {
                return C1;
            }

            for (var k = 2; k <= n; k++)
            {
                var Ck = (2 * x * (k + alpha - 1) * C1 - (k + 2 * alpha - 2) * C0) / k;
                C0 = C1;
                C1 = Ck;
            }

            return C1;
        }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:34,代码来源:GegenbauerFunction.cs


示例5: DecodeEmptyValue

        public override ScalarValue DecodeEmptyValue(ScalarValue priorValue, Scalar field)
        {
            if (!field.IsOptional)
                return field.DefaultValue;

            return null;
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:7,代码来源:ConstantOperatorCodec.cs


示例6: LambertW

        static ScalarValue LambertW(ScalarValue x)
        {
            var EI = 1.0 / Math.E;

            // use an initial approximation
            var W = ScalarValue.Zero;
            var abs = x.Abs();

            if (abs < EI / 2.0)
            {
                W = SeriesSmall(x);

                if ((x + EI).Abs() < 1e-6)
                {
                    return W;
                }
            }
            else if (abs < EI)
            {
                W = SeriesZero(x);
            }
            else if (abs > Math.E)
            {
                W = SeriesLarge(x);
            }
            else
            {
                W = new ScalarValue(0.5);
            }

            return Halley(x, W);
        }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:32,代码来源:LambertFunction.cs


示例7: Function

        public MatrixValue Function(FunctionValue f, ScalarValue n, ScalarValue dt, ArgumentsValue args)
        {
            var numberOfMeasurements = (Int32)n.Value;
            var timeBetweenMeasurements = (Int32)Math.Floor(dt.Value * 1000);
            var results = new MatrixValue(numberOfMeasurements, 2);
            var time = 0.0;

            for (var i = 1; i <= numberOfMeasurements; i++)
            {
                Thread.Sleep(timeBetweenMeasurements);

                var result = f.Perform(context, args);
                results[i, 1] = new ScalarValue(time);

                if (result is ScalarValue)
                {
                    results[i, 2] = result as ScalarValue;
                }
                else if (result is MatrixValue)
                {
                    var m = result as MatrixValue;

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

                time += dt.Value;
            }

            return results;
        }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:33,代码来源:TimeSeriesFunction.cs


示例8: EncodeValue

        public override byte[] EncodeValue(ScalarValue v)
        {
            if (v == ScalarValue.NULL)
            {
                return NULL_VALUE_ENCODING;
            }

            var buffer = new System.IO.MemoryStream();
            var value_Renamed = (DecimalValue) v;

            try
            {
                if (Math.Abs(value_Renamed.exponent) > 63)
                {
                    Global.HandleError(Error.FastConstants.R1_LARGE_DECIMAL, "Encountered exponent of size " + value_Renamed.exponent);
                }

                byte[] temp_byteArray = INTEGER.Encode(new IntegerValue(value_Renamed.exponent));
                buffer.Write(temp_byteArray, 0, temp_byteArray.Length);
                byte[] temp_byteArray2 = INTEGER.Encode(new LongValue(value_Renamed.mantissa));
                buffer.Write(temp_byteArray2, 0, temp_byteArray2.Length);
            }
            catch (System.IO.IOException e)
            {
                throw new RuntimeException(e);
            }

            return buffer.ToArray();
        }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:29,代码来源:SingleFieldDecimal.cs


示例9: DecodeValue

        public override ScalarValue DecodeValue(ScalarValue val, ScalarValue priorVal, Scalar field)
        {
            if (priorVal == null)
            {
                Global.HandleError(Error.FastConstants.D6_MNDTRY_FIELD_NOT_PRESENT, "The field " + field + " must have a priorValue defined.");
                return null;
            }

            if (val == null)
            {
                return null;
            }

            DecimalValue priorValue;

            if (priorVal.Undefined)
            {
                if (field.DefaultValue.Undefined)
                {
                    priorValue = (DecimalValue) field.BaseValue;
                }
                else
                {
                    priorValue = (DecimalValue) field.DefaultValue;
                }
            }
            else
            {
                priorValue = (DecimalValue) priorVal;
            }

            var value_Renamed = (DecimalValue) val;

            return new DecimalValue(value_Renamed.mantissa + priorValue.mantissa, value_Renamed.exponent + priorValue.exponent);
        }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:35,代码来源:DeltaDecimalOperatorCodec.cs


示例10: GetValueToEncode

 public override ScalarValue GetValueToEncode(ScalarValue value_Renamed, ScalarValue priorValue, Scalar field)
 {
     if (priorValue == null)
     {
         return value_Renamed;
     }
     if (value_Renamed == null)
     {
         if (field.Optional)
         {
             if (priorValue == ScalarValue.UNDEFINED && field.DefaultValue.Undefined)
             {
                 return null;
             }
             return ScalarValue.NULL;
         }
         throw new ArgumentException();
     }
     if (priorValue.Undefined)
     {
         if (value_Renamed.Equals(field.DefaultValue))
         {
             return null;
         }
         return value_Renamed;
     }
     if (!value_Renamed.Equals(((NumericValue) priorValue).Increment()))
     {
         return value_Renamed;
     }
     return null;
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:32,代码来源:IncrementIntegerOperatorCodec.cs


示例11: DecodeValue

        public override ScalarValue DecodeValue(ScalarValue newValue, ScalarValue priorValue, Scalar field)
        {
            if (priorValue == null && !field.IsOptional)
            {
                Global.ErrorHandler.OnError(null, DynError.MandatoryFieldNotPresent, "");
                return null;
            }

            var baseValue = (StringValue) (priorValue == null || priorValue.IsUndefined
                                               ? field.BaseValue
                                               : priorValue);

            if (newValue == null || newValue.IsNull)
            {
                if (!field.IsOptional)
                    throw new ArgumentException("");

                return null;
            }

            string delta = ((StringValue) newValue).Value;
            int length = Math.Max(baseValue.Value.Length - delta.Length, 0);
            string root = baseValue.Value.Substring(0, (length) - (0));

            return new StringValue(root + delta);
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:26,代码来源:TailOperatorCodec.cs


示例12: EncodeValue

        public override byte[] EncodeValue(ScalarValue v)
        {
            if (v == ScalarValue.Null)
            {
                return NullValueEncoding;
            }

            var buffer = new MemoryStream();
            var value = (DecimalValue) v;

            try
            {
                if (Math.Abs(value.Exponent) > 63)
                {
                    Global.ErrorHandler.OnError(null, RepError.LargeDecimal, "Encountered exponent of size {0}", value.Exponent);
                }

                byte[] tmp = Integer.Encode(new IntegerValue(value.Exponent));
                buffer.Write(tmp, 0, tmp.Length);

                tmp = Integer.Encode(new LongValue(value.Mantissa));
                buffer.Write(tmp, 0, tmp.Length);
            }
            catch (IOException e)
            {
                throw new RuntimeException(e);
            }

            return buffer.ToArray();
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:30,代码来源:SingleFieldDecimal.cs


示例13: LinearGamma

        /// <summary>
        /// Computes the complex (linear) gamma function.
        /// </summary>
        /// <param name="z">The complex argument.</param>
        /// <returns>The evaluated value.</returns>
        public static ScalarValue LinearGamma(ScalarValue z)
        {
            if (z.Re < 0.5)
                return Math.PI / LinearGamma(1.0 - z) / (Math.PI * z).Sin();

            return LogGamma(z).Exp();
        }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:12,代码来源:Gamma.cs


示例14: SeriesLarge

 // series useful for large x
 static ScalarValue SeriesLarge(ScalarValue x)
 {
     var L1 = x.Ln();
     var L2 = L1.Ln();
     var L2L1 = L2 / L1;
     return L1 - L2 + L2L1 + (L2 - 2.0) * L2L1 / L1 / 2.0;
 }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:8,代码来源:LambertFunction.cs


示例15: EncodeValue

 public override byte[] EncodeValue(ScalarValue value)
 {
     #warning BUG? This used to format all values using "d-MMM-yy h:mm:ss tt" format, and now it uses constructor parameter instead
     return
         Ascii.Encode(
             new StringValue(
                 (((DateValue) value).Value).ToString(_format, _formatter)));
 }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:8,代码来源:DateString.cs


示例16: Function

 public ArgumentsValue Function(ScalarValue Coarsening)
 {
     var result = _sensor.Capture(Coarsening.Value).Result;
     var red = new MatrixValue(result.Red);
     var green = new MatrixValue(result.Green);
     var blue = new MatrixValue(result.Blue);
     return new ArgumentsValue(red, green, blue);
 }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:8,代码来源:VideoFunction.cs


示例17: EncodeValue

        public override byte[] EncodeValue(ScalarValue value)
        {
            if (value.IsNull)
                return NullableByteVectorType.EncodeValue(ScalarValue.Null);

            byte[] utf8encoding = Encoding.UTF8.GetBytes(((StringValue) value).Value);
            return NullableByteVectorType.Encode(new ByteVectorValue(utf8encoding));
        }
开发者ID:shariqkudcs,项目名称:openfastdotnet,代码行数:8,代码来源:NullableUnicodeString.cs


示例18: DecodeEmptyValue

 public override ScalarValue DecodeEmptyValue(ScalarValue previousValue, Scalar field)
 {
     if (!field.Optional)
     {
         return field.DefaultValue;
     }
     return null;
 }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:8,代码来源:ConstantOperatorCodec.cs


示例19: Function

 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;
 }
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:8,代码来源:ContourFunction.cs


示例20: EncodeValue

        public override byte[] EncodeValue(ScalarValue value_Renamed)
        {
            if (value_Renamed.Null)
                return NULLABLE_BYTE_VECTOR_TYPE.EncodeValue(ScalarValue.NULL);

            byte[] utf8encoding = System.Text.Encoding.UTF8.GetBytes(((StringValue) value_Renamed).value_Renamed);
            return NULLABLE_BYTE_VECTOR_TYPE.Encode(new ByteVectorValue(utf8encoding));
        }
开发者ID:marlonbomfim,项目名称:openfastdotnet,代码行数:8,代码来源:NullableUnicodeString.cs



注:本文中的ScalarValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ScaleMode类代码示例发布时间:2022-05-24
下一篇:
C# Scalar类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap