SymEngine::KroneckerDelta Class Reference
+ Inheritance diagram for SymEngine::KroneckerDelta:
+ Collaboration diagram for SymEngine::KroneckerDelta:

Public Member Functions

virtual void accept (Visitor &v) const
 
virtual void accept (EvalRealDoubleVisitorFinal &v) const
 
 KroneckerDelta (const RCP< const Basic > &i, const RCP< const Basic > &j)
 KroneckerDelta Constructor.
 
bool is_canonical (const RCP< const Basic > &i, const RCP< const Basic > &j) const
 
virtual RCP< const Basiccreate (const RCP< const Basic > &a, const RCP< const Basic > &b) const
 
virtual RCP< const Basiccreate (const RCP< const Basic > &a, const RCP< const Basic > &b) const=0
 
RCP< const Basiccreate (const vec_basic &b) const
 
- Public Member Functions inherited from SymEngine::TwoArgBasic< BaseClass >
 TwoArgBasic (const RCP< const Basic > &a, const RCP< const Basic > &b)
 b in TwoArgBasic(a, b) More...
 
hash_t __hash__ () const
 
RCP< const Basicget_arg1 () const
 
RCP< const Basicget_arg2 () const
 
virtual vec_basic get_args () const
 
RCP< const Basiccreate (const vec_basic &b) const
 
virtual bool __eq__ (const Basic &o) const
 
virtual int compare (const Basic &o) const
 Structural equality comparator.
 

Static Public Attributes

static const TypeID type_code_id = SYMENGINE_KRONECKERDELTA
 

Detailed Description

Definition at line 986 of file functions.h.

Member Function Documentation

◆ create() [1/3]

RCP< const Basic > SymEngine::KroneckerDelta::create ( const RCP< const Basic > &  a,
const RCP< const Basic > &  b 
) const
virtual
Returns
canonicalized KroneckerDelta

Implements SymEngine::TwoArgBasic< BaseClass >.

Definition at line 2626 of file functions.cpp.

2628 {
2629  return kronecker_delta(a, b);
2630 }
RCP< const Basic > kronecker_delta(const RCP< const Basic > &i, const RCP< const Basic > &j)
Canonicalize KroneckerDelta:
Definition: functions.cpp:2632

◆ create() [2/3]

virtual RCP<const Basic> SymEngine::TwoArgBasic< BaseClass >::create

The discrete, or Kronecker, delta function. A function that takes in two integers i and j. It returns 0 if i and j are not equal or it returns 1 if i and j are equal. http://en.wikipedia.org/wiki/Kronecker_delta

◆ create() [3/3]

RCP<const Basic> SymEngine::TwoArgBasic< BaseClass >::create
inline

The discrete, or Kronecker, delta function. A function that takes in two integers i and j. It returns 0 if i and j are not equal or it returns 1 if i and j are equal. http://en.wikipedia.org/wiki/Kronecker_delta

Definition at line 108 of file functions.h.

109  {
110  SYMENGINE_ASSERT(b.size() == 2);
111  return create(b[0], b[1]);
112  }
virtual RCP< const Basic > create(const RCP< const Basic > &a, const RCP< const Basic > &b) const=0

◆ is_canonical()

bool SymEngine::KroneckerDelta::is_canonical ( const RCP< const Basic > &  i,
const RCP< const Basic > &  j 
) const
Returns
true if canonical

Definition at line 2612 of file functions.cpp.

2614 {
2615  RCP<const Basic> diff = expand(sub(i, j));
2616  if (eq(*diff, *zero)) {
2617  return false;
2618  } else if (is_a_Number(*diff)) {
2619  return false;
2620  } else {
2621  // TODO: SymPy uses default key sorting to return in order
2622  return true;
2623  }
2624 }
bool is_a_Number(const Basic &b)
Definition: number.h:130
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
Definition: basic-inl.h:21
RCP< const Basic > sub(const RCP< const Basic > &a, const RCP< const Basic > &b)
Substracts b from a.
Definition: add.cpp:495
RCP< const Basic > expand(const RCP< const Basic > &self, bool deep=true)
Expands self
Definition: expand.cpp:369

Field Documentation

◆ type_code_id

const TypeID SymEngine::KroneckerDelta::type_code_id = SYMENGINE_KRONECKERDELTA
static

Type_code_id shared by all instances

Definition at line 996 of file functions.h.


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