/// <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); }
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); } }
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); } }
public void Declare(IConst e, Compiler compiler) { Variables[e] = e.Name ?? e.Literal; }
public void VisitConst(IConst @const, Tensor <float> data) { throw new NotImplementedException(); }