creativity  v1.3.0
Agent-based model of creativity and piracy
Public Member Functions | Static Public Member Functions | List of all members
creativity::data::Addition Class Reference

Wrapper class around a addition of the elements of two Variables. More...

#include <creativity/data/Variable.hpp>

Public Member Functions

virtual void populate (Eigen::Ref< Eigen::VectorXd > column, unsigned int offset=0, unsigned int trim=0) const override
 Calculates the component-wise addition of the two variables.
 
virtual std::string name () const override
 Returns the name by joining together left and right names with "+". More...
 
- Public Member Functions inherited from creativity::data::BinaryExpr
virtual unsigned int size () const override
 Returns the size of the binary expression, if either left or right variables have a size. More...
 
- Public Member Functions inherited from creativity::data::Variable
virtual ~Variable ()=default
 Virtual destructor.
 
virtual std::string nameBracketed (const std::string &bracketL="(", const std::string &bracketR=")") const
 Returns a name for this variable, but with surrounding brackets if this variable needs it–for example, for a multiplication of two variables. More...
 
Eigen::VectorXd values (unsigned int rows=0, unsigned int offset=0, unsigned int trim=0) const
 Shortcut wrapper around populate that creates a new column of the given size, calls populate() with it, then returns it. More...
 

Static Public Member Functions

template<class... Args>
static std::shared_ptr< Additioncreate (Args... args)
 Forwards arguments to the protected constructor and returns a shared_ptr to the created object.
 

Additional Inherited Members

- Protected Member Functions inherited from creativity::data::BinaryExpr
 BinaryExpr ()=delete
 Not default-constructible.
 
 BinaryExpr (const std::shared_ptr< const Variable > &left, const std::shared_ptr< const Variable > &right)
 Constructs a binary variable with the left and right variables.
 
- Protected Attributes inherited from creativity::data::BinaryExpr
std::shared_ptr< const Variableleft_
 The left-hand Variable.
 
std::shared_ptr< const Variableright_
 The right-hand Variable.
 

Detailed Description

Wrapper class around a addition of the elements of two Variables.

This can be constructed explicitly or implicitly by the addition or subtraction operator of two Variable objects.

Member Function Documentation

§ name()

virtual std::string creativity::data::Addition::name ( ) const
overridevirtual

Returns the name by joining together left and right names with "+".

Since there is nothing lower in the order or operations, this returns unbracketed left- and right-hand side operands.

Implements creativity::data::Variable.

Inheritance diagram for creativity::data::Addition:
[legend]
Collaboration diagram for creativity::data::Addition:
[legend]

The documentation for this class was generated from the following file: