mcb::spvecgf2 Class Reference
#include <spvecgf2.h>
List of all members.
Detailed Description
A sparse vector with elements in GF2.
An object of this class represents a cycle of an undirected graph. It behaves as a sparse matrix of values in GF(2).
This class is implemented internally by double linked lists. Operations append and insert takes constant time but does not ensure the correct ordering of the elements.
Most binary operations take time proportional to the number of elements in the list. Size, empty, clear and the iterators' methods take constant time. Swap also takes constant time.
Such an object can be accessed in exactly the same manner that a list of LEDA is accessed. Each one in the sparse vector corresponds in a list_item in a list. Thus, the following is valid:
LEDA's forall macro works for this objects. It can be used in the following way:
- Date:
- 2005
- Author:
- Dimitris Michail
Constructor & Destructor Documentation
| mcb::spvecgf2::spvecgf2 |
( |
|
) |
|
|
| mcb::spvecgf2::spvecgf2 |
( |
const spvecgf2 & |
a |
) |
|
|
| mcb::spvecgf2::~spvecgf2 |
( |
|
) |
|
|
Member Function Documentation
| void mcb::spvecgf2::add |
( |
const spvecgf2 & |
a |
) |
|
|
|
|
Add a vector to the current vector. - Parameters:
-
|
| void mcb::spvecgf2::append |
( |
int |
index |
) |
|
|
|
|
Append an entry, without checking for proper order. - Parameters:
-
| index | An integer representing that the sparse vector has a one at that position. Indexing should start from zero. |
- Remarks:
- The internal representation of this object is an ordered list of integers. This function however makes no attempt to ensure such an ordering, it only appends the new entry into the list. Use wisely.
|
| void mcb::spvecgf2::clear |
( |
|
) |
[inline] |
|
| bool mcb::spvecgf2::empty |
( |
|
) |
const [inline] |
|
|
|
Check if empty. - Returns:
- True if empty, false otherwise.
|
| list_item mcb::spvecgf2::first |
( |
|
) |
const [inline] |
|
|
|
Returns the first item of the sparse vector. Each item represents a position where the sparse vector has a one. - Returns:
- Returns the first item of the vector. This item is a list_item of LEDA's list representation. NULL is returned if the vector contains no elements.
|
| int mcb::spvecgf2::index |
( |
list_item |
it |
) |
const [inline] |
|
|
|
Get the index of an item. Each item represents a one in the sparse vector. - Parameters:
-
- Returns:
- The position of this one in the sparse vector.
|
| int mcb::spvecgf2::inf |
( |
list_item |
it |
) |
const [inline] |
|
|
|
Get the index of an item. Each item represents a one in the sparse vector. - Parameters:
-
- Returns:
- The position of this one in the sparse vector.
|
| void mcb::spvecgf2::insert |
( |
int |
index |
) |
|
|
|
|
Append an entry, without checking for proper order. - Parameters:
-
| index | An integer representing that the sparse vector has a one at that position. Indexing should start from zero. |
- Remarks:
- The internal representation of this object is an ordered list of integers. This function however makes no attempt to ensure such an ordering, it only appends the new entry into the list. Use wisely.
|
|
|
Compute the intersection of this vector and a. - Parameters:
-
- Returns:
- The intersection of the current object and a.
|
| list_item mcb::spvecgf2::last |
( |
|
) |
const [inline] |
|
|
|
Returns the last item of the sparse vector. Each item represents a position where the sparse vector has a one. - Returns:
- Returns the last item of the vector. This item is a list_item of LEDA's list representation. NULL is returned if the vector contains no elements.
|
| int mcb::spvecgf2::operator * |
( |
const spvecgf2 & |
a |
) |
const |
|
|
|
Compute inner product. - Parameters:
-
- Returns:
- The inner product of this object and a.
|
| d_int_set mcb::spvecgf2::operator% |
( |
const d_int_set & |
a |
) |
const |
|
|
|
Operator to compute the symmetric difference of this sparse vector and of a LEDA dynamic integer set. - Parameters:
-
- Returns:
- The symmetric difference as a new dynamic integer set.
|
|
|
Operator to compute the symmetric difference of this sparse vector and of a. - Parameters:
-
- Returns:
- The symmetric difference as a new sparse vector.
|
|
|
Assign to the current vector the symmetric difference of the current vector an vector a. - Parameters:
-
| a | An input sparse vector. |
- Returns:
- The current vector after the symmetric difference operation.
|
|
|
Operator to add the current vector with another vector. - Parameters:
-
| a | The second vector to add. |
- Returns:
- A new vector representing the sum.
|
|
|
Add a vector to the current vector. - Parameters:
-
- Returns:
- The current vector after the addition.
|
| spvecgf2 mcb::spvecgf2::operator- |
( |
|
) |
const |
|
|
|
Negate the current vector. - Returns:
- A new object representing the current vector negated.
|
|
|
Add a vector to the current vector. - Parameters:
-
- Returns:
- The current vector after the addition.
- Remarks:
- Subtracting and addition is the same in GF(2).
|
| spvecgf2& mcb::spvecgf2::operator= |
( |
d_int_set & |
i |
) |
|
|
|
|
Assignment operator for a leda::d_int_set. - Parameters:
-
| i | A compressed integer set of LEDA. |
- Returns:
- The currect sparse vector.
|
| spvecgf2& mcb::spvecgf2::operator= |
( |
const int & |
i |
) |
|
|
|
|
Assign current vector to be . |
|
|
Assign a vector to another vector. - Parameters:
-
| i | The vector to assign from. |
- Returns:
- The current vector after the assignment.
|
| int mcb::spvecgf2::pop |
( |
|
) |
[inline] |
|
|
|
Delete the first entry of the sparse vector and return its index. - Returns:
- The index of the first entry which was deleted.
- Precondition:
- The sparse array should not be empty.
|
| list_item mcb::spvecgf2::pred |
( |
list_item |
it |
) |
const [inline] |
|
|
|
Get the predecessor of an item. Each item represents a position where the sparse vector has a one. - Returns:
- The predecessor of an item, NULL if sparse vector is empty.
- Precondition:
- it is an item of the current object.
|
| void mcb::spvecgf2::print |
( |
std::ostream & |
o |
) |
const |
|
|
|
Print a sparse vector to a stream. - Parameters:
-
| o | The stream to print to. |
|
| int mcb::spvecgf2::size |
( |
|
) |
const [inline] |
|
|
|
Get size of sparse vector. - Returns:
- The size of the sparse vector.
|
| void mcb::spvecgf2::sort |
( |
|
) |
[inline] |
|
|
|
Sort the internal representation of the sparse vector. This operation ensures that a correct representation after its call. Should not be necessary unless insert or append were called in wrong order. |
| void mcb::spvecgf2::spvecgf2::swap |
( |
spvecgf2 & |
a |
) |
|
|
|
|
Swap two sparse vectors. - Parameters:
-
| a | A sparse vector to swap with the current object. |
- Remarks:
- This is a constant time operation.
|
| list_item mcb::spvecgf2::succ |
( |
list_item |
it |
) |
const [inline] |
|
|
|
Get the successor of an item. Each item represents a position where the sparse vector has a one. - Returns:
- The successor of an item, NULL if sparse vector is empty.
- Precondition:
- it is an item of the current object.
|
| d_int_set mcb::spvecgf2::to_d_int_set |
( |
|
) |
const |
|
|
|
Transform the sparse vector to a LEDA dynamic integer set. - Returns:
- A dynamic integer set.
|
| list<int> mcb::spvecgf2::to_list |
( |
|
) |
const [inline] |
|
|
|
Transform the sparse vector to a list of integers. - Returns:
- A LEDA list of integers.
|
Generated on Thu Mar 30 16:45:51 2006 for mcb LEDA Extension Package by
1.4.6