OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <ArithmeticLink.h>
Protected Attributes | |
double | knild |
![]() | |
Handle | knil |
Type | distributive_type = NOTYPE |
![]() | |
HandleSeq | _varseq |
std::map< Handle, unsigned int > | _index |
![]() | |
HandleSeq | _outgoing |
![]() | |
UUID | _uuid |
AtomTable * | _atomTable |
Type | _type |
char | _flags |
TruthValuePtr | _truthValue |
AttentionValuePtr | _attentionValue |
std::mutex | _mtx |
InSetPtr | _incoming_set |
Additional Inherited Members | |
![]() | |
static Handle | do_execute (AtomSpace *, const Handle &) |
static LinkPtr | factory (LinkPtr) |
static Handle | factory (Type, const HandleSeq &) |
![]() | |
typedef std::shared_ptr< InSet > | InSetPtr |
The ArithmeticLink implements the arithmetic operations of plus and times. It uses FoldLink to perform reduction.
Definition at line 39 of file ArithmeticLink.h.
|
protected |
Definition at line 41 of file ArithmeticLink.cc.
References opencog::classserver(), and init().
|
protected |
Definition at line 51 of file ArithmeticLink.cc.
References opencog::classserver(), and init().
ArithmeticLink::ArithmeticLink | ( | const HandleSeq & | oset, |
TruthValuePtr | tv = TruthValue::NULL_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 33 of file ArithmeticLink.cc.
References init().
ArithmeticLink::ArithmeticLink | ( | Link & | l | ) |
Definition at line 61 of file ArithmeticLink.cc.
References opencog::classserver(), opencog::Atom::getType(), and init().
Reimplemented from opencog::FunctionLink.
Definition at line 159 of file ArithmeticLink.cc.
References opencog::Link::_outgoing, opencog::AtomSpace::add_atom(), opencog::classserver(), createNumberNode, opencog::Instantiator::execute(), opencog::FunctionLink::factory(), opencog::FunctionLinkCast(), get_double(), opencog::Atom::Handle, knild, konsd(), and opencog::LinkCast().
|
protected |
Definition at line 70 of file ArithmeticLink.cc.
References knild.
|
protectedpure virtual |
Implemented in opencog::PlusLink, and opencog::TimesLink.
|
virtual |
reduce() – reduce the expression by summing constants, etc.
No actual black-box evaluation or execution is performed. Only clearbox reductions are performed.
Examples: the reduct of (PlusLink (NumberNode 2) (NumberNode 2)) is (NumberNode 4) – its just a constant.
The reduct of (PlusLink (VariableNode "$x") (NumberNode 0)) is (VariableNode "$x"), because adding zero to anything yeilds the thing itself.
Reimplemented from opencog::FoldLink.
Definition at line 87 of file ArithmeticLink.cc.
References opencog::ArithmeticLinkCast(), python.stop_go::red, and reorder().
|
virtual |
re-order the contents of an ArithmeticLink into "lexicographic" order.
The goal of the re-ordering is to simplify the reduction code, by placing atoms where they are easily found. For now, this means: first, all of the variables, next, all compound expressions, last, all number nodes We do not currently sort the variables, but maybe we should...? Sorting by variable names would hold consilidate them... The FoldLink::reduce() method already returns expressions that are almost in the correct order.
Definition at line 113 of file ArithmeticLink.cc.
References opencog::Atom::_atomTable, opencog::Link::_outgoing, opencog::AtomSpace::add_atom(), opencog::FunctionLink::factory(), opencog::AtomTable::getAtomSpace(), opencog::Atom::getType(), and python.bindlink::result.
|
protected |
Definition at line 42 of file ArithmeticLink.h.