mcb::spvecfp Class Reference
#include <spvecfp.h>
List of all members.
Detailed Description
A sparse vector with elements in
.
This class implements a sparse vector with elements in
. The supported operations are limited to those required by the cycle basis algorithms.
The internal representation is a list of tuples, one for each non-zero entry of the sparse vector. Each tuple contains two integers, the index of the non-zero entry and its value. This entries are supposed to be sorted in order for the various binary operators to work properly. The function append does not ensure this, it is up to the user to make sure that the correct order is maintained.
- Remarks:
- Indices are between
and
where
is the length of the vector.
- Date:
- 2005
- Author:
- Dimitris Michail
Constructor & Destructor Documentation
mcb::spvecfp::spvecfp |
( |
|
) |
|
|
mcb::spvecfp::spvecfp |
( |
const ptype & |
p |
) |
|
|
mcb::spvecfp::spvecfp |
( |
const spvecfp & |
a |
) |
|
|
mcb::spvecfp::~spvecfp |
( |
|
) |
|
|
Member Function Documentation
|
Append an entry to the sparse vector. The internal representation is a list of sorted entries by index. This procedure does not enforce this order, it simply appends the new entry. Use wisely. - Parameters:
-
| index | Index of the new element to append. |
| value | The value of the new element to append. |
- Remarks:
- No attempt to preserve correct sorted order is done. All elements in the vector must have index values less that the new element's for the resulting sparse vector to be valid.
|
void mcb::spvecfp::clear |
( |
|
) |
|
|
bool mcb::spvecfp::empty |
( |
|
) |
const |
|
|
Check if the vector is empty, all elements are zero. - Returns:
- True if empty, false otherwise.
|
list_item mcb::spvecfp::first |
( |
|
) |
const |
|
|
Get the first item of the internal representation of the vector. - Returns:
- The first item of the internal representation.
|
indextype mcb::spvecfp::index |
( |
list_item |
it |
) |
const |
|
|
Get the index of an item. - Returns:
- The index of an item.
|
ptype mcb::spvecfp::inf |
( |
list_item |
it |
) |
const |
|
|
Get the information of an item. - Returns:
- The information of an item.
|
list_item mcb::spvecfp::last |
( |
|
) |
const |
|
|
Get the last item of the internal representation of the vector. - Returns:
- The last item of the internal representation.
|
|
Compute the product with a constant. - Parameters:
-
- Returns:
- The product of the current vector with a constant.
|
|
Compute the inner product of two vectors. - Parameters:
-
- Returns:
- The inner product of this vector and a.
|
|
Add two vectors. - Parameters:
-
- Returns:
- The sum of this vector and a.
|
|
Add a vector to the current vector. - Parameters:
-
- Returns:
- The current vector after adding a.
|
spvecfp mcb::spvecfp::operator- |
( |
|
) |
const |
|
|
Negate the current sparse vector. - Returns:
- A new vector corresponding to current vector negated.
|
|
Subtract a vector from the current vector. - Parameters:
-
- Returns:
- The current vector after subtracting a.
|
list_item mcb::spvecfp::pred |
( |
list_item |
it |
) |
const |
|
|
Get the predecessor of an item of the interal representation. - Parameters:
-
- Returns:
- The predecessor of it.
|
void mcb::spvecfp::print |
( |
std::ostream & |
o |
) |
const |
|
|
Print the vector to a stream. - Parameters:
-
| o | The stream to print at. |
|
ptype mcb::spvecfp::pvalue |
( |
|
) |
const |
|
|
Get the value of the prime p. - Returns:
- The value of the prime p.
|
void mcb::spvecfp::reset |
( |
const ptype & |
p |
) |
|
|
|
Clear the vector and reinitialize it. - Parameters:
-
|
|
Get the number of non-zero entries. - Returns:
- The number of non-zero entries in the vector.
|
void mcb::spvecfp::sort |
( |
|
) |
|
|
|
Sort the internal representation of the sparse vector. This operation ensures a correct representation after its call. Should not be necessary unless append was called in wrong order. |
list_item mcb::spvecfp::succ |
( |
list_item |
it |
) |
const |
|
|
Get the successor of an item of the internal representation. - Parameters:
-
- Returns:
- The successor of it.
|
Generated on Tue Apr 22 13:40:09 2008 for mcb LEDA Extension Package by
1.4.6