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

Public Member Functions

void accept (Visitor &v) const override
 
void accept (EvalRealDoubleVisitorFinal &v) const override
 
 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
 
RCP< const Basiccreate (const RCP< const Basic > &a, const RCP< const Basic > &b) const override
 
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 override
 
RCP< const Basicget_arg1 () const
 
RCP< const Basicget_arg2 () const
 
vec_basic get_args () const override
 
RCP< const Basiccreate (const vec_basic &b) const
 
bool __eq__ (const Basic &o) const override
 
int compare (const Basic &o) const override
 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
overridevirtual
Returns
canonicalized KroneckerDelta

Implements SymEngine::TwoArgBasic< BaseClass >.

Definition at line 2669 of file functions.cpp.

2671 {
2672  return kronecker_delta(a, b);
2673 }
RCP< const Basic > kronecker_delta(const RCP< const Basic > &i, const RCP< const Basic > &j)
Canonicalize KroneckerDelta:
Definition: functions.cpp:2675

◆ 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 2655 of file functions.cpp.

2657 {
2658  RCP<const Basic> diff = expand(sub(i, j));
2659  if (eq(*diff, *zero)) {
2660  return false;
2661  } else if (is_a_Number(*diff)) {
2662  return false;
2663  } else {
2664  // TODO: SymPy uses default key sorting to return in order
2665  return true;
2666  }
2667 }
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: