glucat 0.12.0
Public Member Functions | Public Attributes | List of all members
PyClical.index_set Class Reference
Inheritance diagram for PyClical.index_set:
Inheritance graph
[legend]
Collaboration diagram for PyClical.index_set:
Collaboration graph
[legend]

Public Member Functions

def __cinit__ (self, other=0)
 
def __dealloc__ (self)
 
def __richcmp__ (lhs, rhs, int, op)
 
def __setitem__ (self, idx, val)
 
def __getitem__ (self, idx)
 
def __contains__ (self, idx)
 
def __iter__ (self)
 
def __invert__ (self)
 
def __xor__ (lhs, rhs)
 
def __ixor__ (self, rhs)
 
def __and__ (lhs, rhs)
 
def __iand__ (self, rhs)
 
def __or__ (lhs, rhs)
 
def __ior__ (self, rhs)
 
def count (self)
 
def count_neg (self)
 
def count_pos (self)
 
def min (self)
 
def max (self)
 
def hash_fn (self)
 
def sign_of_mult (self, rhs)
 
def sign_of_square (self)
 
def __repr__ (self)
 
def __str__ (self)
 

Public Attributes

 instance
 

Detailed Description

Return the C++ IndexSet instance wrapped by index_set(obj).
Python class index_set wraps C++ class IndexSet.

Definition at line 38 of file PyClical.pyx.

Member Function Documentation

◆ __and__()

def PyClical.index_set.__and__ (   lhs,
  rhs 
)
Set intersection: and.

>>> print(index_set({1}) & index_set({2}))
{}
>>> print(index_set({1,2}) & index_set({2}))
{2}

Definition at line 271 of file PyClical.pyx.

◆ __cinit__()

def PyClical.index_set.__cinit__ (   self,
  other = 0 
)
Construct an object of type index_set.

>>> print(index_set(1))
{1}
>>> print(index_set({1,2}))
{1,2}
>>> print(index_set(index_set({1,2})))
{1,2}
>>> print(index_set({1,2}))
{1,2}
>>> print(index_set({1,2,1}))
{1,2}
>>> print(index_set("{1,2,1}"))
{1,2}
>>> print(index_set(""))
{}

Definition at line 74 of file PyClical.pyx.

◆ __contains__()

def PyClical.index_set.__contains__ (   self,
  idx 
)
Check that an index_set object contains the index idx: idx in self.

>>> 1 in index_set({1})
True
>>> 2 in index_set({1})
False
>>> -1 in index_set({2})
False
>>> 1 in index_set({2})
False
>>> 2 in index_set({2})
True
>>> 33 in index_set({2})
False

Definition at line 210 of file PyClical.pyx.

References PyClical.index_set.instance, and PyClical.clifford.instance.

◆ __dealloc__()

def PyClical.index_set.__dealloc__ (   self)
Clean up by deallocating the instance of C++ class IndexSet.

Definition at line 116 of file PyClical.pyx.

References PyClical.index_set.instance, and PyClical.clifford.instance.

◆ __getitem__()

def PyClical.index_set.__getitem__ (   self,
  idx 
)
Get the value of an index_set object at an index.

>>> index_set({1})[1]
True
>>> index_set({1})[2]
False
>>> index_set({2})[-1]
False
>>> index_set({2})[1]
False
>>> index_set({2})[2]
True
>>> index_set({2})[33]
False

Definition at line 191 of file PyClical.pyx.

References PyClical.index_set.instance, and PyClical.clifford.instance.

◆ __iand__()

def PyClical.index_set.__iand__ (   self,
  rhs 
)
Set intersection: and.

>>> x = index_set({1}); x &= index_set({2}); print(x)
{}
>>> x = index_set({1,2}); x &= index_set({2}); print(x)
{2}

Definition at line 282 of file PyClical.pyx.

◆ __invert__()

def PyClical.index_set.__invert__ (   self)
Set complement: not.

>>> print(~index_set({-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}))
{-32,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-21,-20,-19,-18,-17,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32}

Definition at line 240 of file PyClical.pyx.

References PyClical.index_set.instance, and PyClical.clifford.instance.

◆ __ior__()

def PyClical.index_set.__ior__ (   self,
  rhs 
)
Set union: or.

>>> x = index_set({1}); x |= index_set({2}); print(x)
{1,2}
>>> x = index_set({1,2}); x |= index_set({2}); print(x)
{1,2}

Definition at line 304 of file PyClical.pyx.

◆ __iter__()

def PyClical.index_set.__iter__ (   self)
Iterate over the indices of an index_set.

>>> for i in index_set({-3,4,7}):print(i, end=",")
-3,4,7,

Definition at line 229 of file PyClical.pyx.

References glucat::index_set< DEFAULT_LO, DEFAULT_HI >.max(), glucat::index_set< LO, HI >.max(), PyClical.index_set.max(), glucat::index_set< DEFAULT_LO, DEFAULT_HI >.min(), glucat::index_set< LO, HI >.min(), and PyClical.index_set.min().

◆ __ixor__()

def PyClical.index_set.__ixor__ (   self,
  rhs 
)
Symmetric set difference: exclusive or.

>>> x = index_set({1}); x ^= index_set({2}); print(x)
{1,2}
>>> x = index_set({1,2}); x ^= index_set({2}); print(x)
{1}

Definition at line 260 of file PyClical.pyx.

◆ __or__()

def PyClical.index_set.__or__ (   lhs,
  rhs 
)
Set union: or.

>>> print(index_set({1}) | index_set({2}))
{1,2}
>>> print(index_set({1,2}) | index_set({2}))
{1,2}

Definition at line 293 of file PyClical.pyx.

◆ __repr__()

def PyClical.index_set.__repr__ (   self)
The “official” string representation of self.

>>> index_set({1,2}).__repr__()
'index_set({1,2})'
>>> repr(index_set({1,2}))
'index_set({1,2})'

Definition at line 384 of file PyClical.pyx.

References PyClical.index_set.__repr__(), and index_set_to_repr().

Referenced by PyClical.index_set.__repr__().

◆ __richcmp__()

def PyClical.index_set.__richcmp__ (   lhs,
  rhs,
  int,
  op 
)
Compare two objects of class index_set.

>>> index_set(1) == index_set({1})
True
>>> index_set({1}) != index_set({1})
False
>>> index_set({1}) != index_set({2})
True
>>> index_set({1}) == index_set({2})
False
>>> index_set({1}) < index_set({2})
True
>>> index_set({1}) <= index_set({2})
True
>>> index_set({1}) > index_set({2})
False
>>> index_set({1}) >= index_set({2})
False

Definition at line 122 of file PyClical.pyx.

◆ __setitem__()

def PyClical.index_set.__setitem__ (   self,
  idx,
  val 
)
Set the value of an index_set object at index idx to value val.

>>> s=index_set({1}); s[2] = True; print(s)
{1,2}
>>> s=index_set({1,2}); s[1] = False; print(s)
{2}

Definition at line 179 of file PyClical.pyx.

References PyClical.index_set.instance, and PyClical.clifford.instance.

◆ __str__()

def PyClical.index_set.__str__ (   self)
The “informal” string representation of self.

>>> index_set({1,2}).__str__()
'{1,2}'
>>> str(index_set({1,2}))
'{1,2}'

Definition at line 395 of file PyClical.pyx.

References PyClical.index_set.__str__(), and index_set_to_str().

Referenced by PyClical.index_set.__str__().

◆ __xor__()

def PyClical.index_set.__xor__ (   lhs,
  rhs 
)
Symmetric set difference: exclusive or.

>>> print(index_set({1}) ^ index_set({2}))
{1,2}
>>> print(index_set({1,2}) ^ index_set({2}))
{1}

Definition at line 249 of file PyClical.pyx.

◆ count()

def PyClical.index_set.count (   self)
Cardinality: Number of indices included in set.

>>> index_set({-1,1,2}).count()
3

Definition at line 315 of file PyClical.pyx.

References PyClical.index_set.count(), PyClical.index_set.instance, and PyClical.clifford.instance.

Referenced by PyClical.index_set.count().

◆ count_neg()

def PyClical.index_set.count_neg (   self)
Number of negative indices included in set.

>>> index_set({-1,1,2}).count_neg()
1

Definition at line 324 of file PyClical.pyx.

References PyClical.index_set.count_neg(), PyClical.index_set.instance, and PyClical.clifford.instance.

Referenced by PyClical.index_set.count_neg().

◆ count_pos()

def PyClical.index_set.count_pos (   self)
Number of positive indices included in set.

>>> index_set({-1,1,2}).count_pos()
2

Definition at line 333 of file PyClical.pyx.

References PyClical.index_set.count_pos(), PyClical.index_set.instance, and PyClical.clifford.instance.

Referenced by PyClical.index_set.count_pos().

◆ hash_fn()

def PyClical.index_set.hash_fn (   self)
Hash function.

Definition at line 360 of file PyClical.pyx.

References PyClical.index_set.hash_fn(), PyClical.index_set.instance, and PyClical.clifford.instance.

Referenced by PyClical.index_set.hash_fn().

◆ max()

def PyClical.index_set.max (   self)
Maximum member.

>>> index_set({-1,1,2}).max()
2

Definition at line 351 of file PyClical.pyx.

References PyClical.index_set.instance, PyClical.clifford.instance, and PyClical.index_set.max().

Referenced by PyClical.index_set.__iter__(), and PyClical.index_set.max().

◆ min()

def PyClical.index_set.min (   self)
Minimum member.

>>> index_set({-1,1,2}).min()
-1

Definition at line 342 of file PyClical.pyx.

References PyClical.index_set.instance, PyClical.clifford.instance, and PyClical.index_set.min().

Referenced by PyClical.index_set.__iter__(), and PyClical.index_set.min().

◆ sign_of_mult()

def PyClical.index_set.sign_of_mult (   self,
  rhs 
)
Sign of geometric product of two Clifford basis elements.

>>> s = index_set({1,2}); t=index_set({-1}); s.sign_of_mult(t)
1

Definition at line 366 of file PyClical.pyx.

References PyClical.index_set.instance, PyClical.clifford.instance, and PyClical.index_set.sign_of_mult().

Referenced by PyClical.index_set.sign_of_mult().

◆ sign_of_square()

def PyClical.index_set.sign_of_square (   self)
Sign of geometric square of a Clifford basis element.

>>> s = index_set({1,2}); s.sign_of_square()
-1

Definition at line 375 of file PyClical.pyx.

References PyClical.index_set.instance, PyClical.clifford.instance, and PyClical.index_set.sign_of_square().

Referenced by PyClical.index_set.sign_of_square().

Member Data Documentation

◆ instance

PyClical.index_set.instance

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