31#ifndef BERTINI_TRIGONOMETRIC_OPERATOR_HPP
32#define BERTINI_TRIGONOMETRIC_OPERATOR_HPP
62 template <
typename Archive>
63 void serialize(Archive& ar,
const unsigned ) {
64 ar & boost::serialization::base_object<UnaryOperator>(*
this);
89 template<typename... Ts>
91 std::shared_ptr<SinOperator>
Make(Ts&& ...ts){
92 return std::static_pointer_cast<SinOperator>(
Intern(std::shared_ptr<Node>(
new SinOperator(ts...) )));
103 void print(std::ostream & target)
const override;
109 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
123 SinOperator() =
default;
126 template <
typename Archive>
127 void serialize(Archive& ar,
const unsigned ) {
128 ar & boost::serialization::base_object<TrigOperator>(*
this);
148 template<typename... Ts>
150 std::shared_ptr<ArcSinOperator>
Make(Ts&& ...ts){
151 return std::static_pointer_cast<ArcSinOperator>(
Intern(std::shared_ptr<Node>(
new ArcSinOperator(ts...) )));
160 void print(std::ostream & target)
const override;
166 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
179 ArcSinOperator() =
default;
183 template <
typename Archive>
184 void serialize(Archive& ar,
const unsigned ) {
185 ar & boost::serialization::base_object<TrigOperator>(*
this);
211 template<typename... Ts>
213 std::shared_ptr<CosOperator>
Make(Ts&& ...ts){
214 return std::static_pointer_cast<CosOperator>(
Intern(std::shared_ptr<Node>(
new CosOperator(ts...) )));
225 void print(std::ostream & target)
const override;
233 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
248 CosOperator() =
default;
251 template <
typename Archive>
252 void serialize(Archive& ar,
const unsigned ) {
253 ar & boost::serialization::base_object<TrigOperator>(*
this);
273 template<typename... Ts>
275 std::shared_ptr<ArcCosOperator>
Make(Ts&& ...ts){
276 return std::static_pointer_cast<ArcCosOperator>(
Intern(std::shared_ptr<Node>(
new ArcCosOperator(ts...) )));
286 void print(std::ostream & target)
const override;
293 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
308 ArcCosOperator() =
default;
311 template <
typename Archive>
312 void serialize(Archive& ar,
const unsigned ) {
313 ar & boost::serialization::base_object<TrigOperator>(*
this);
341 template<typename... Ts>
343 std::shared_ptr<TanOperator>
Make(Ts&& ...ts){
344 return std::static_pointer_cast<TanOperator>(
Intern(std::shared_ptr<Node>(
new TanOperator(ts...) )));
354 void print(std::ostream & target)
const override;
360 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
374 TanOperator() =
default;
378 template <
typename Archive>
379 void serialize(Archive& ar,
const unsigned ) {
380 ar & boost::serialization::base_object<TrigOperator>(*
this);
400 template<typename... Ts>
402 std::shared_ptr<ArcTanOperator>
Make(Ts&& ...ts){
403 return std::static_pointer_cast<ArcTanOperator>(
Intern(std::shared_ptr<Node>(
new ArcTanOperator(ts...) )));
413 void print(std::ostream & target)
const override;
419 std::shared_ptr<Node>
Differentiate(std::shared_ptr<Variable>
const& v =
nullptr)
const override;
432 ArcTanOperator() =
default;
435 template <
typename Archive>
436 void serialize(Archive& ar,
const unsigned ) {
437 ar & boost::serialization::base_object<TrigOperator>(*
this);
445 inline std::shared_ptr<Node>
sin(
const std::shared_ptr<Node> & N)
451 inline std::shared_ptr<Node>
asin(
const std::shared_ptr<Node> & N)
459 inline std::shared_ptr<Node>
cos(
const std::shared_ptr<Node> & N)
467 inline std::shared_ptr<Node>
acos(
const std::shared_ptr<Node> & N)
475 inline std::shared_ptr<Node>
tan(
const std::shared_ptr<Node> & N)
483 inline std::shared_ptr<Node>
atan(
const std::shared_ptr<Node> & N)
Provides the artithmetic Node types, such as Sum and Power.
Provides the arc cosine Operator.
Definition trig.hpp:264
std::shared_ptr< Node > Homogenized(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) const override
Homogenize a tree, returning a NEW homogenized tree (functional / non-mutating).
std::shared_ptr< Node > Simplified() const override
Functionally simplify this tree, returning a NEW simplified tree.
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
virtual ~ArcCosOperator()=default
static std::shared_ptr< ArcCosOperator > Make(Ts &&...ts)
Construct (and intern) a ArcCosOperator node.
Definition trig.hpp:275
friend class boost::serialization::access
Definition trig.hpp:309
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates the cosine function.
std::shared_ptr< Node > Subs(SubstitutionMap const &substitutions) const override
Symbolically substitute variables, returning a NEW tree.
Provides the inverse sine Operator.
Definition trig.hpp:139
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates the sine function.
std::shared_ptr< Node > Homogenized(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) const override
Homogenize a tree, returning a NEW homogenized tree (functional / non-mutating).
std::shared_ptr< Node > Simplified() const override
Functionally simplify this tree, returning a NEW simplified tree.
static std::shared_ptr< ArcSinOperator > Make(Ts &&...ts)
Construct (and intern) a ArcSinOperator node.
Definition trig.hpp:150
std::shared_ptr< Node > Subs(SubstitutionMap const &substitutions) const override
Symbolically substitute variables, returning a NEW tree.
friend class boost::serialization::access
Definition trig.hpp:180
virtual ~ArcSinOperator()=default
Provides the inverse tangent Operator.
Definition trig.hpp:391
std::shared_ptr< Node > Homogenized(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) const override
Homogenize a tree, returning a NEW homogenized tree (functional / non-mutating).
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates the tangent function.
virtual ~ArcTanOperator()=default
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
std::shared_ptr< Node > Subs(SubstitutionMap const &substitutions) const override
Symbolically substitute variables, returning a NEW tree.
friend class boost::serialization::access
Definition trig.hpp:433
std::shared_ptr< Node > Simplified() const override
Functionally simplify this tree, returning a NEW simplified tree.
static std::shared_ptr< ArcTanOperator > Make(Ts &&...ts)
Construct (and intern) a ArcTanOperator node.
Definition trig.hpp:402
Provides the cosine Operator.
Definition trig.hpp:202
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
static std::shared_ptr< CosOperator > Make(Ts &&...ts)
Construct (and intern) a CosOperator node.
Definition trig.hpp:213
virtual ~CosOperator()=default
std::shared_ptr< Node > Homogenized(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) const override
Homogenize a tree, returning a NEW homogenized tree (functional / non-mutating).
std::shared_ptr< Node > Simplified() const override
Functionally simplify this tree, returning a NEW simplified tree.
friend class boost::serialization::access
Definition trig.hpp:249
std::shared_ptr< Node > Subs(SubstitutionMap const &substitutions) const override
Symbolically substitute variables, returning a NEW tree.
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates the cosine function.
An interface for all nodes in a function tree, and for a function object as well.
Definition node.hpp:114
Provides the sine Operator.
Definition trig.hpp:80
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates the sine function.
std::shared_ptr< Node > Homogenized(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) const override
Homogenize a tree, returning a NEW homogenized tree (functional / non-mutating).
std::shared_ptr< Node > Subs(SubstitutionMap const &substitutions) const override
Symbolically substitute variables, returning a NEW tree.
friend class boost::serialization::access
Definition trig.hpp:124
static std::shared_ptr< SinOperator > Make(Ts &&...ts)
Construct (and intern) a SinOperator node.
Definition trig.hpp:91
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
virtual ~SinOperator()=default
std::shared_ptr< Node > Simplified() const override
Functionally simplify this tree, returning a NEW simplified tree.
Provides the tangent Operator.
Definition trig.hpp:332
std::shared_ptr< Node > Homogenized(VariableGroup const &vars, std::shared_ptr< Variable > const &homvar) const override
Homogenize a tree, returning a NEW homogenized tree (functional / non-mutating).
std::shared_ptr< Node > Differentiate(std::shared_ptr< Variable > const &v=nullptr) const override
Differentiates the tangent function.
void print(std::ostream &target) const override
Virtual method for printing Nodes to arbitrary output streams.
std::shared_ptr< Node > Subs(SubstitutionMap const &substitutions) const override
Symbolically substitute variables, returning a NEW tree.
virtual ~TanOperator()=default
static std::shared_ptr< TanOperator > Make(Ts &&...ts)
Construct (and intern) a TanOperator node.
Definition trig.hpp:343
std::shared_ptr< Node > Simplified() const override
Functionally simplify this tree, returning a NEW simplified tree.
friend class boost::serialization::access
Definition trig.hpp:375
Abstract class for trigonometric Operator types.
Definition trig.hpp:47
TrigOperator()
Definition trig.hpp:58
friend class boost::serialization::access
Definition trig.hpp:60
virtual ~TrigOperator()=default
TrigOperator(const std::shared_ptr< Node > &N)
Construct a trigonometric operator over a single operand node.
Definition trig.hpp:52
UnaryOperator(const std::shared_ptr< Node > &n)
Construct a unary operator over a single operand node.
Definition operator.hpp:78
Represents variable leaves in the function tree.
Definition variable.hpp:48
Definition canonical.hpp:56
std::shared_ptr< Node > tan(const std::shared_ptr< Node > &N)
Build a tangent expression-tree node.
Definition trig.hpp:475
std::shared_ptr< Node > Intern(std::shared_ptr< Node > const &candidate)
Hash-cons a freshly-built node: return an existing structurally-equal node if one is live,...
std::shared_ptr< Node > asin(const std::shared_ptr< Node > &N)
Build a arcsine expression-tree node.
Definition trig.hpp:451
std::shared_ptr< Node > acos(const std::shared_ptr< Node > &N)
Build a arccosine expression-tree node.
Definition trig.hpp:467
std::shared_ptr< Node > cos(const std::shared_ptr< Node > &N)
Build a cosine expression-tree node.
Definition trig.hpp:459
std::shared_ptr< Node > sin(const std::shared_ptr< Node > &N)
Build a sine expression-tree node.
Definition trig.hpp:445
std::shared_ptr< Node > atan(const std::shared_ptr< Node > &N)
Build a arctangent expression-tree node.
Definition trig.hpp:483
Definition algorithm_builder.hpp:36
std::map< std::string, std::shared_ptr< node::Node > > SubstitutionMap
A substitution request for Node::Subs: variable name -> the node to put in its place.
Definition node.hpp:72
std::vector< std::shared_ptr< node::Variable > > VariableGroup
An ordered group of variables (the unit of homogenization / variable grouping).
Definition node.hpp:69
Provides the abstract Operator Node type.
#define BERTINI_DEFAULT_VISITABLE()
macro for classes which want default Accept implementation, having nothing fancy to do when accepting...
Definition visitable.hpp:121