Пример #1
0
 /// <summary>
 /// Добавление сторонней реализации IConst
 /// </summary>
 /// <param name="factory"></param>
 /// <returns></returns>
 public MathParser AddConst(IConst constant)
 {
     if (_mathparserEntities.Exists(e => e.Name.ToLower() == constant.Name.ToLower()))
     {
         throw new Exception($"Wrong name for entity {constant.Name}. There is already entity with the same name");
     }
     _constants.Add(constant);
     _mathparserEntities.Add(constant);
     return(this);
 }
Пример #2
0
        public virtual void VisitConst(IConst @const, Compiler compiler)
        {
            compiler.Scope.Declare(@const, compiler);
            compiler.CheckShape(@const, this);

            if (@const.Name != null)
            {
                var comment = GetComment(@const, compiler);
                compiler.EmitAssign(@const, @const.Literal, comment);
            }
        }
Пример #3
0
        public void VisitConst(IConst @const, Scalar <float> data)
        {
            var other = data as Scalar <float> .Const;

            if (other == null)
            {
                Arent();
            }
            else
            {
                Eq(((Scalar <float> .Const)@const).Value, other.Value);
            }
        }
Пример #4
0
 public void Declare(IConst e, Compiler compiler)
 {
     Variables[e] = e.Name ?? e.Literal;
 }
Пример #5
0
 public void VisitConst(IConst @const, Tensor <float> data)
 {
     throw new NotImplementedException();
 }