SOSpin is hosted by Hepforge, IPPP Durham
SOSpin  1.0.0

DList with nodes. More...

#include <include/dlist.h>

Public Member Functions

 DList (void)
 Default constructor. More...
 
 DList (int tp, int i)
 Constructor - node of element of type "tp" and first data field "i". Pointer are initialized with NULL. More...
 
 DList (int tp, int i, int j)
 Constructor - node of element of type "tp", first data field "i" and second data field "j". Pointer are initialized with NULL. More...
 
 DList (const DList &L)
 Constructor by copy. More...
 
 ~DList (void)
 Destructor. More...
 
void clear ()
 Deletes all nodes from DList. More...
 
void negate ()
 Changes the sign of DList. More...
 
void add (elemType)
 Adds one node at the end of DList (scans the list). Updates actual pointer to be the last node. More...
 
void add_begin (elemType)
 Adds one node in the beginning of DList. Updates actual pointer to be the new first node. More...
 
void add_end (elemType)
 Adds one node in the end of DList. Updates actual pointer to be the last node. More...
 
void set (elemType i)
 Sets data (elemtype) of the node being pointed by actual pointer. More...
 
void set_begin ()
 Changes actual pointer to point at the first element of DList (beg pointer). More...
 
void set_end ()
 Changes actual pointer to point at the last element of DList (end pointer). More...
 
void set_sign (int ii)
 Sets the sign of DList. More...
 
void join (DList &L)
 Joins a DList to the end of the current DList (this). Updates "actual" pointer to be the end of the final DList. More...
 
void loop_right ()
 Shifts actual pointer to next node. If actual node is the end node, shift to beg node. More...
 
void loop_left ()
 Shifts actual pointer to previous node. If actual node is the beg node, shift to end node. More...
 
DList rearrange ()
 Creates and returns a new DList by copying nodes in DList ordered by type. The nodes that first appear in the new ordered DList are $$'s (type=2) and then all other elements: $b$ (type=0) and $b^$ (type=1) unordered. Constant elements are removed. More...
 
void remove (unsigned int type)
 Removes the first element with "data.get\_type()==type" found in DList. Updates actual pointer to be the first node. More...
 
void remove_actual ()
 Removes the element for which the actual pointer, "actual", is pointing at in DList. More...
 
void shift_right ()
 Shifts actual pointer to next node. If actual node is the end node, stops. More...
 
void shift_left ()
 Shifts actual pointer to previous node. If actual node if first node (begin), stops. More...
 
void swap_next ()
 Swaps the actual node with the next node of DList. More...
 
elemType get ()
 Returns elemtype of the node being pointed by actual (current element). More...
 
int getSign ()
 Returns the sign of DList. More...
 
vector< int > getIds ()
 Creates and returns an integer vector sequence container with the ids (data fields) of $b$'s and $b^$'s elements. More...
 
void getBandBdaggerIds (bool &BandBdagger, vector< string > &id0, vector< string > &id1, int &sign)
 Updates integer vector sequence containers "id0" and "id1" with ids (data fields) of $b$'s and $b^$'s elements, respectively. "sign" is updated with the sign of DList. "BandBdagger" is a boolean which is true if DList contains at least one $b$ or $b^$, and false otherwise. More...
 
void getDeltaIds (bool &AllDeltas, vector< string > &id0, vector< string > &id1, int &sign)
 Updates integer vector sequence containers "id0" and "id1" with first and second ids (data fields) of $$ elements, respectively. "sign" is updated with the sign of DList. "AllDeltas" is a boolean which is true if all elements in DList are of $$ type, and false otherwise. More...
 
void getBandBdaggerAndDeltasIds (vector< string > &id0, vector< string > &id1, vector< string > &id2, vector< string > &id3, int &sign)
 Updates integer vector sequence containers "id0" and "id1" with ids (data fields) of $b$'s and $b^$'s elements, respectively, and "id2" and "id3" integer vector sequence containers with first and second data fields of $$'s elements, respectively. "sign" is updated with the sign of DList. More...
 
int numDeltas ()
 Returns the number of elements of type $$ (type=2). More...
 
int numBs ()
 Returns the number of elements of type b (type=0). More...
 
bool search_last (unsigned int type1)
 Search the last element with "data.get\_type()==type1" found in DList. Returns true a node was found. More...
 
bool search_first (unsigned int type1)
 Search the first element with "data.get\_type()==type" found in DList. Returns true if the symbol is not the first, and false otherwise. More...
 
bool search_first (unsigned int type0, unsigned int type1)
 Checks for the order of appearance in DList of types "type0" and "type1". Returns true if order of appearance is the same as the parameter's order and false otherwise. More...
 
bool search_elem (unsigned int type1)
 Searches for the element with "data.get\_type()==type" found in DList. Returns true if the element is found, false otherwise. More...
 
bool check ()
 Verifies if the number of $b$'s and $b^$'s matches and if each one is less or equal than N of SO(2N). More...
 
bool checkDeltaIndex ()
 Checks the indexes of $$ elements. They must be less or equal to the n of SO(2n). Checks also if the the indexes of a delta are equal. Returns true if each $$ is not zero, false otherwise. More...
 
bool check_num ()
 Verifies if the number of $b$'s and $b^$'s is less or equal than N of SO(2N). Returns true if so, false otherwise. More...
 
bool check_same_num ()
 Verifies if the number of $b$'s and $b^$'s match. Returns true if they match, false otherwise. More...
 
bool isActualLast ()
 Returns true if actual pointer is pointing to the last (end) node of DList. More...
 
bool isEmpty ()
 Returns true if DList has no nodes. More...
 
bool hasNoDeltas ()
 Returns true if there is no elements of type $$ in DList. More...
 
bool hasOnlyDeltas ()
 Returns true if all nodes in DList are of $$ type. More...
 
bool hasRepeatedIndex ()
 Returns true if there is elements with the same id (data fields) in the DList (repeated ids). More...
 
DListoperator= (const DList &L)
 Copies a DList. More...
 
const DList operator- () const
 Negates operator, change sign of DList. More...
 

Private Attributes

noListbegin
 Pointer to the first node. More...
 
noListend
 Pointer to the last node. More...
 
noListactual
 Pointer to the actual node. More...
 
int sign
 Store the sign of the monomial. More...
 

Friends

DListcopy (DList *L)
 Creates and returns a pointer to a new copy of a DList. More...
 
DList contract_deltas (DList &L, bool braketmode)
 Applies the following identity:

\begin{eqnarray*} b_i * b^\dagger_j = \delta_{i,j} - b^\dagger_j * b_i \end{eqnarray*}

input DList L keeps delta term and function returns the swapped term. More...

  DList ordering (DList &L, bool braketmode)  Order only the b's (to the left hand side) and b's (to the right hand side) terms. Applies the following identity:

\begin{eqnarray*} b^\dagger_j * b_i = \delta_{i,j} - b_i * b^\dagger_j \end{eqnarray*}

input DList L keeps delta term and function returns the swapped term. More...

  string printDeltas (DList &L)  Creates and returns a string with the deltas and constants of a DList. More...
  DListoperator* (DList &L, elemType j)  Adds element "j" to the end of DList. Returns pointer to DList. More...
  DList operator* (const DList &L, const DList &M)  Creates and returns new DList that joins two DLists by order of parameters. More...
  DListoperator- (DList &L, elemType j)  Negates the sign of a DList and add the elemtype "j" at end of it. More...
  DListoperator, (DList &L, elemType j)  Adds element "j" to the end of DList. Returns pointer to DList. More...
  ostream & operator<< (ostream &out, DList &L)  Sends to output stream ostream a string with the corresponding expression of the DList. More...
  ostream & operator<< (ostream &out, DList *L)  Sends to output stream ostream a string with the corresponding expression of the DList. More...
  DListoperator<< (DList &L, elemType j)  Adds element "j" to the end of DList. Returns pointer to DList. More...
  DListoperator<< (DList &L, DList &M)  Copies DList. Creates and returns a new DList with nodes of both DLists. Sign is the product of both products. More...
  bool operator== (DList &L, DList &M)  Returns true if two DLists are equal. More...
 

Detailed Description

DList with nodes.

Definition at line 264 of file dlist.h.

Constructor & Destructor Documentation

sospin::DList::DList ( void  )

Default constructor.

Definition at line 52 of file dlist.cpp.

sospin::DList::DList ( int  tp,
int  i 
)

Constructor - node of element of type "tp" and first data field "i". Pointer are initialized with NULL.

Parameters
tpsymbol type
iindex symbol

Definition at line 64 of file dlist.cpp.

sospin::DList::DList ( int  tp,
int  i,
int  j 
)

Constructor - node of element of type "tp", first data field "i" and second data field "j". Pointer are initialized with NULL.

Parameters
tpsymbol type
ifirst index symbol
jsecond index symbol

Definition at line 79 of file dlist.cpp.

sospin::DList::DList ( const DList L)

Constructor by copy.

Definition at line 90 of file dlist.cpp.

sospin::DList::~DList ( void  )

Destructor.

Definition at line 123 of file dlist.cpp.

Member Function Documentation

void sospin::DList::add ( elemType  elem)

Adds one node at the end of DList (scans the list). Updates actual pointer to be the last node.

Parameters
elemsymbol to be added

Definition at line 154 of file dlist.cpp.

void sospin::DList::add_begin ( elemType  elem)

Adds one node in the beginning of DList. Updates actual pointer to be the new first node.

Parameters
elemsymbol to be added

Definition at line 181 of file dlist.cpp.

void sospin::DList::add_end ( elemType  elem)

Adds one node in the end of DList. Updates actual pointer to be the last node.

Parameters
elemsymbol to be added

Definition at line 206 of file dlist.cpp.

bool sospin::DList::check ( )

Verifies if the number of $b$'s and $b^$'s matches and if each one is less or equal than N of SO(2N).

Returns
TRUE if number of b's and b^\dagger's are equal and they are all within bounds, FALSE otherwise.

Definition at line 570 of file dlist.cpp.

bool sospin::DList::check_num ( )

Verifies if the number of $b$'s and $b^$'s is less or equal than N of SO(2N). Returns true if so, false otherwise.

Definition at line 631 of file dlist.cpp.

bool sospin::DList::check_same_num ( )

Verifies if the number of $b$'s and $b^$'s match. Returns true if they match, false otherwise.

Definition at line 648 of file dlist.cpp.

bool sospin::DList::checkDeltaIndex ( )

Checks the indexes of $$ elements. They must be less or equal to the n of SO(2n). Checks also if the the indexes of a delta are equal. Returns true if each $$ is not zero, false otherwise.

Returns
TRUE if each delta is not zero, FALSE otherwise

Definition at line 590 of file dlist.cpp.

void sospin::DList::clear ( )

Deletes all nodes from DList.

Delete all nodes from DList.

Definition at line 131 of file dlist.cpp.

elemType sospin::DList::get ( )
inline

Returns elemtype of the node being pointed by actual (current element).

Definition at line 379 of file dlist.h.

void sospin::DList::getBandBdaggerAndDeltasIds ( vector< string > &  id0,
vector< string > &  id1,
vector< string > &  id2,
vector< string > &  id3,
int &  sign 
)

Updates integer vector sequence containers "id0" and "id1" with ids (data fields) of $b$'s and $b^$'s elements, respectively, and "id2" and "id3" integer vector sequence containers with first and second data fields of $$'s elements, respectively. "sign" is updated with the sign of DList.

Definition at line 437 of file dlist.cpp.

void sospin::DList::getBandBdaggerIds ( bool &  BandBdagger,
vector< string > &  id0,
vector< string > &  id1,
int &  sign 
)

Updates integer vector sequence containers "id0" and "id1" with ids (data fields) of $b$'s and $b^$'s elements, respectively. "sign" is updated with the sign of DList. "BandBdagger" is a boolean which is true if DList contains at least one $b$ or $b^$, and false otherwise.

Definition at line 382 of file dlist.cpp.

void sospin::DList::getDeltaIds ( bool &  AllDeltas,
vector< string > &  id0,
vector< string > &  id1,
int &  sign 
)

Updates integer vector sequence containers "id0" and "id1" with first and second ids (data fields) of $$ elements, respectively. "sign" is updated with the sign of DList. "AllDeltas" is a boolean which is true if all elements in DList are of $$ type, and false otherwise.

Definition at line 405 of file dlist.cpp.

vector< int > sospin::DList::getIds ( )

Creates and returns an integer vector sequence container with the ids (data fields) of $b$'s and $b^$'s elements.

Definition at line 361 of file dlist.cpp.

int sospin::DList::getSign ( )
inline

Returns the sign of DList.

Definition at line 384 of file dlist.h.

bool sospin::DList::hasNoDeltas ( )

Returns true if there is no elements of type $$ in DList.

Definition at line 666 of file dlist.cpp.

bool sospin::DList::hasOnlyDeltas ( )

Returns true if all nodes in DList are of $$ type.

Definition at line 685 of file dlist.cpp.

bool sospin::DList::hasRepeatedIndex ( )

Returns true if there is elements with the same id (data fields) in the DList (repeated ids).

Definition at line 703 of file dlist.cpp.

bool sospin::DList::isActualLast ( )
inline

Returns true if actual pointer is pointing to the last (end) node of DList.

Definition at line 435 of file dlist.h.

bool sospin::DList::isEmpty ( )
inline

Returns true if DList has no nodes.

Definition at line 440 of file dlist.h.

void sospin::DList::join ( DList L)

Joins a DList to the end of the current DList (this). Updates "actual" pointer to be the end of the final DList.

k.join(q) = k q

Definition at line 232 of file dlist.cpp.

void sospin::DList::loop_left ( )
inline

Shifts actual pointer to previous node. If actual node is the beg node, shift to end node.

Definition at line 346 of file dlist.h.

void sospin::DList::loop_right ( )
inline

Shifts actual pointer to next node. If actual node is the end node, shift to beg node.

Definition at line 340 of file dlist.h.

void sospin::DList::negate ( )
inline

Changes the sign of DList.

Definition at line 300 of file dlist.h.

int sospin::DList::numBs ( )

Returns the number of elements of type b (type=0).

Definition at line 479 of file dlist.cpp.

int sospin::DList::numDeltas ( )

Returns the number of elements of type $$ (type=2).

Definition at line 462 of file dlist.cpp.

const DList sospin::DList::operator- ( ) const

Negates operator, change sign of DList.

Definition at line 771 of file dlist.cpp.

DList & sospin::DList::operator= ( const DList L)

Copies a DList.

Definition at line 740 of file dlist.cpp.

DList sospin::DList::rearrange ( )

Creates and returns a new DList by copying nodes in DList ordered by type. The nodes that first appear in the new ordered DList are $$'s (type=2) and then all other elements: $b$ (type=0) and $b^$ (type=1) unordered. Constant elements are removed.

Definition at line 263 of file dlist.cpp.

void sospin::DList::remove ( unsigned int  type)

Removes the first element with "data.get\_type()==type" found in DList. Updates actual pointer to be the first node.

Definition at line 286 of file dlist.cpp.

void sospin::DList::remove_actual ( )

Removes the element for which the actual pointer, "actual", is pointing at in DList.

Definition at line 313 of file dlist.cpp.

bool sospin::DList::search_elem ( unsigned int  type1)

Searches for the element with "data.get\_type()==type" found in DList. Returns true if the element is found, false otherwise.

Search the first element with "data.get\_type()==type1" found in DList. Returns true if the symbol is not the first, and false otherwise.

Parameters
type1symbol to search
Returns
TRUE if the element is found

Definition at line 553 of file dlist.cpp.

bool sospin::DList::search_first ( unsigned int  type1)

Search the first element with "data.get\_type()==type" found in DList. Returns true if the symbol is not the first, and false otherwise.

Search the first element with "data.get_type()==type1" found in DList.

Parameters
type1symbol to search
Returns
TRUE if the symbol is not the first, FALSE otherwise

Definition at line 515 of file dlist.cpp.

bool sospin::DList::search_first ( unsigned int  type0,
unsigned int  type1 
)

Checks for the order of appearance in DList of types "type0" and "type1". Returns true if order of appearance is the same as the parameter's order and false otherwise.

Parameters
type0first symbol
type1second symbol
Returns
TRUE if type1 is first than type0, FALSE otherwise

Definition at line 532 of file dlist.cpp.

bool sospin::DList::search_last ( unsigned int  type)

Search the last element with "data.get\_type()==type1" found in DList. Returns true a node was found.

Parameters
typesymbol to search
Returns
TRUE if the symbol is not the last, FALSE otherwise

Definition at line 499 of file dlist.cpp.

void sospin::DList::set ( elemType  i)
inline

Sets data (elemtype) of the node being pointed by actual pointer.

Definition at line 316 of file dlist.h.

void sospin::DList::set_begin ( )
inline

Changes actual pointer to point at the first element of DList (beg pointer).

Definition at line 321 of file dlist.h.

void sospin::DList::set_end ( )
inline

Changes actual pointer to point at the last element of DList (end pointer).

Definition at line 326 of file dlist.h.

void sospin::DList::set_sign ( int  ii)
inline

Sets the sign of DList.

Definition at line 331 of file dlist.h.

void sospin::DList::shift_left ( )
inline

Shifts actual pointer to previous node. If actual node if first node (begin), stops.

Definition at line 367 of file dlist.h.

void sospin::DList::shift_right ( )
inline

Shifts actual pointer to next node. If actual node is the end node, stops.

Definition at line 361 of file dlist.h.

void sospin::DList::swap_next ( )

Swaps the actual node with the next node of DList.

Definition at line 338 of file dlist.cpp.

Friends And Related Function Documentation

DList contract_deltas ( DList L,
bool  braketmode 
)
friend

Applies the following identity:

\begin{eqnarray*} b_i * b^\dagger_j = \delta_{i,j} - b^\dagger_j * b_i \end{eqnarray*}

input DList L keeps delta term and function returns the swapped term.

Parameters
[in,out]L,DListterm to be processed [in] braketmode, if true if last element in DList is a b, then the L is cleared
Returns
returns expression with b_i * b^ swapped or empty expression if b is the last term in L

Definition at line 845 of file dlist.cpp.

DList* copy ( DList L)
friend

Creates and returns a pointer to a new copy of a DList.

Definition at line 806 of file dlist.cpp.

DList& operator* ( DList L,
elemType  j 
)
friend

Adds element "j" to the end of DList. Returns pointer to DList.

Definition at line 996 of file dlist.cpp.

DList operator* ( const DList L,
const DList M 
)
friend

Creates and returns new DList that joins two DLists by order of parameters.

Definition at line 1002 of file dlist.cpp.

DList& operator, ( DList L,
elemType  j 
)
friend

Adds element "j" to the end of DList. Returns pointer to DList.

Definition at line 1055 of file dlist.cpp.

DList& operator- ( DList L,
elemType  j 
)
friend

Negates the sign of a DList and add the elemtype "j" at end of it.

Definition at line 1048 of file dlist.cpp.

ostream& operator<< ( ostream &  out,
DList L 
)
friend

Sends to output stream ostream a string with the corresponding expression of the DList.

Parameters
outostream
LDList
Returns
ostream
cout << L << endl;

Definition at line 1069 of file dlist.cpp.

ostream& operator<< ( ostream &  out,
DList L 
)
friend

Sends to output stream ostream a string with the corresponding expression of the DList.

Definition at line 1095 of file dlist.cpp.

DList& operator<< ( DList L,
elemType  j 
)
friend

Adds element "j" to the end of DList. Returns pointer to DList.

Definition at line 1123 of file dlist.cpp.

DList& operator<< ( DList L,
DList M 
)
friend

Copies DList. Creates and returns a new DList with nodes of both DLists. Sign is the product of both products.

Parameters
MDList to copy
[out]LDList with content of M added
L << M;
//or with more DList's
L << M << N << O << P;

Definition at line 1138 of file dlist.cpp.

bool operator== ( DList L,
DList M 
)
friend

Returns true if two DLists are equal.

Definition at line 1170 of file dlist.cpp.

DList ordering ( DList L,
bool  braketmode 
)
friend

Order only the b's (to the left hand side) and b's (to the right hand side) terms. Applies the following identity:

\begin{eqnarray*} b^\dagger_j * b_i = \delta_{i,j} - b_i * b^\dagger_j \end{eqnarray*}

input DList L keeps delta term and function returns the swapped term.

Parameters
[in,out]L,DListterm to be processed [in] braketmode, if true if last element in DList is a b, then the L is cleared
Returns
returns expression with b^ * b_i swapped or empty expression if b is the last term in L

Definition at line 911 of file dlist.cpp.

string printDeltas ( DList L)
friend

Creates and returns a string with the deltas and constants of a DList.

Definition at line 975 of file dlist.cpp.

Member Data Documentation

noList* sospin::DList::actual
private

Pointer to the actual node.

Definition at line 270 of file dlist.h.

noList* sospin::DList::begin
private

Pointer to the first node.

Definition at line 266 of file dlist.h.

noList* sospin::DList::end
private

Pointer to the last node.

Definition at line 268 of file dlist.h.

int sospin::DList::sign
private

Store the sign of the monomial.

Definition at line 272 of file dlist.h.


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