|
creativity
v1.3.0
Agent-based model of creativity and piracy
|
Raises a Variable's values to a power. 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 and stores the raised values. | |
| virtual std::string | name () const override |
| Returns the concatenation the underlying Variable name() with "^" and the power. More... | |
Public Member Functions inherited from creativity::data::UnaryExpr | |
| virtual unsigned int | size () const override |
| Returns the size of the unary expression, if the variable has 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< Power > | create (Args... args) |
| Forwards arguments to the protected constructor and returns a shared_ptr to the created object. | |
Protected Member Functions | |
| Power ()=delete | |
| Not default constructible. | |
| Power (const std::shared_ptr< const Variable > &var, double power) | |
| Wraps around a Variable to provide exponentiation of the variable's values. More... | |
Protected Member Functions inherited from creativity::data::UnaryExpr | |
| UnaryExpr ()=delete | |
| Not default-constructible. | |
| UnaryExpr (const std::shared_ptr< const Variable > &var) | |
| Constructs a unary variable. | |
Protected Attributes | |
| double | power_ |
| The power to which to raise the variable. | |
Protected Attributes inherited from creativity::data::UnaryExpr | |
| std::shared_ptr< const Variable > | var_ |
| The underlying unary variable. | |
Raises a Variable's values to a power.
This is done using std::pow unless the power is one of the special values -1, 0.5, 1, 2, or 3.
The class can be used explicitly, but a specialization of std::pow(var, power) and an overload of var ^ double are also available.
|
protected |
Wraps around a Variable to provide exponentiation of the variable's values.
|
overridevirtual |
Returns the concatenation the underlying Variable name() with "^" and the power.
If V is something other than SimpleVariable or ConstantVariable, the underlying name is also surrounded by parentheses.
Implements creativity::data::Variable.
1.8.12