20 struct AnalyticExprWrapper;
23 class AnalyticVarExpr :
public AnalyticExpr<T>,
public VarBase
27 explicit AnalyticVarExpr(
const std::string& name)
31 virtual const ExprID& unique_id()
const
36 T fwd_eval(ValuesMap& v, [[maybe_unused]] Index total_input_size, [[maybe_unused]]
bool natural_eval)
const
38 return AnalyticExpr<T>::value(v);
41 void bwd_eval([[maybe_unused]] ValuesMap& v)
const
44 void replace_arg([[maybe_unused]]
const ExprID& old_arg_id, [[maybe_unused]]
const std::shared_ptr<ExprBase>& new_expr)
47 virtual bool belongs_to_args_list(
const FunctionArgsList& args)
const
49 for(
const auto& xi : args)
50 if(xi->unique_id() == this->unique_id())
55 virtual std::string str(
bool in_parentheses =
false)
const
57 return in_parentheses ?
"(" + _name +
")" : _name;
60 virtual bool is_str_leaf()
const
66 class ScalarVar :
public AnalyticVarExpr<ScalarType>
70 explicit ScalarVar(
const std::string& name =
"?");
72 std::shared_ptr<VarBase> arg_copy()
const;
73 std::shared_ptr<ExprBase> copy()
const;
75 std::pair<Index,Index> output_shape()
const;
77 AnalyticExprWrapper<ScalarType> operator-()
const;
80 class VectorVar :
public AnalyticVarExpr<VectorType>
84 explicit VectorVar(Index n,
const std::string& name =
"?");
86 std::shared_ptr<VarBase> arg_copy()
const;
87 std::shared_ptr<ExprBase> copy()
const;
89 std::pair<Index,Index> output_shape()
const;
91 AnalyticExprWrapper<ScalarType> operator[](Index i)
const;
92 AnalyticExprWrapper<VectorType> subvector(Index i, Index j)
const;
99 class MatrixVar :
public AnalyticVarExpr<MatrixType>
103 explicit MatrixVar(Index r, Index c,
const std::string& name =
"?");
105 std::shared_ptr<VarBase> arg_copy()
const;
106 std::shared_ptr<ExprBase> copy()
const;
110 std::pair<Index,Index> output_shape()
const;
112 AnalyticExprWrapper<ScalarType> operator()(Index i, Index j)
const;
const ExprID & unique_id() const
Returns the unique identifier of the expression.
Abstract base class for representing variables in analytic or set functions.
Definition codac2_VarBase.h:24