#include <CoinIndexedVector.hpp>
Public Member Functions | |
Get methods. | |
int | getNumElements (int partition) const |
Get the size of a partition. More... | |
int | getNumPartitions () const |
Get number of partitions. More... | |
int | getNumElements () const |
Get the size. More... | |
int | startPartition (int partition) const |
Get starts. More... | |
const int * | startPartitions () const |
Get starts. More... | |
Set methods | |
void | setNumElementsPartition (int partition, int value) |
Set the size of a partition. More... | |
void | setTempNumElementsPartition (int partition, int value) |
Set the size of a partition (just for a tiny while) More... | |
void | computeNumberElements () |
Add up number of elements in partitions. More... | |
void | compact () |
Add up number of elements in partitions and pack and get rid of partitions. More... | |
void | reserve (int n) |
Reserve space. More... | |
void | setPartitions (int number, const int *starts) |
Setup partitions (needs end as well) More... | |
void | clearAndReset () |
Reset the vector (as if were just created an empty vector). Gets rid of partitions. More... | |
void | clearAndKeep () |
Reset the vector (as if were just created an empty vector). Keeps partitions. More... | |
void | clearPartition (int partition) |
Clear a partition. More... | |
void | checkClear () |
For debug check vector is clear i.e. no elements. More... | |
void | checkClean () |
For debug check vector is clean i.e. elements match indices. More... | |
int | scan (int partition, double tolerance=0.0) |
Scan dense region and set up indices (returns number found) More... | |
void | print () const |
Scan dense region from start to < end and set up indices returns number found. More... | |
Sorting | |
void | sort () |
Sort the indexed storage vector (increasing indices). More... | |
Constructors and destructors (not all wriiten) | |
CoinPartitionedVector () | |
Default constructor. More... | |
CoinPartitionedVector (int size, const int *inds, const double *elems) | |
Alternate Constructors - set elements to vector of doubles. More... | |
CoinPartitionedVector (int size, const int *inds, double element) | |
Alternate Constructors - set elements to same scalar value. More... | |
CoinPartitionedVector (int size, const double *elements) | |
Alternate Constructors - construct full storage with indices 0 through size-1. More... | |
CoinPartitionedVector (int size) | |
Alternate Constructors - just size. More... | |
CoinPartitionedVector (const CoinPartitionedVector &) | |
Copy constructor. More... | |
CoinPartitionedVector (const CoinPartitionedVector *) | |
Copy constructor.2. More... | |
CoinPartitionedVector & | operator= (const CoinPartitionedVector &) |
Assignment operator. More... | |
~CoinPartitionedVector () | |
Destructor. More... | |
![]() | |
int | getNumElements () const |
Get the size. More... | |
const int * | getIndices () const |
Get indices of elements. More... | |
int * | getIndices () |
Get element values. More... | |
double * | denseVector () const |
Get the vector as a dense vector. More... | |
void | setDenseVector (double *array) |
For very temporary use when user needs to borrow a dense vector. More... | |
void | setIndexVector (int *array) |
For very temporary use when user needs to borrow an index vector. More... | |
double & | operator[] (int i) const |
Access the i'th element of the full storage vector. More... | |
void | setNumElements (int value) |
Set the size. More... | |
void | clear () |
Reset the vector (as if were just created an empty vector). This leaves arrays! More... | |
void | empty () |
Reset the vector (as if were just created an empty vector) More... | |
CoinIndexedVector & | operator= (const CoinIndexedVector &) |
Assignment operator. More... | |
CoinIndexedVector & | operator= (const CoinPackedVectorBase &rhs) |
Assignment operator from a CoinPackedVectorBase. More... | |
void | copy (const CoinIndexedVector &rhs, double multiplier=1.0) |
Copy the contents of one vector into another. More... | |
void | borrowVector (int size, int numberIndices, int *inds, double *elems) |
Borrow ownership of the arguments to this vector. More... | |
void | returnVector () |
Return ownership of the arguments to this vector. More... | |
void | setVector (int numberIndices, const int *inds, const double *elems) |
Set vector numberIndices, indices, and elements. More... | |
void | setVector (int size, int numberIndices, const int *inds, const double *elems) |
Set vector size, indices, and elements. More... | |
void | setConstant (int size, const int *inds, double elems) |
Elements set to have the same scalar value. More... | |
void | setFull (int size, const double *elems) |
Indices are not specified and are taken to be 0,1,...,size-1. More... | |
void | setElement (int index, double element) |
Set an existing element in the indexed vector The first argument is the "index" into the elements() array. More... | |
void | insert (int index, double element) |
Insert an element into the vector. More... | |
void | quickInsert (int index, double element) |
Insert a nonzero element into the vector. More... | |
void | add (int index, double element) |
Insert or if exists add an element into the vector Any resulting zero elements will be made tiny. More... | |
void | quickAdd (int index, double element) |
Insert or if exists add an element into the vector Any resulting zero elements will be made tiny. More... | |
void | quickAddNonZero (int index, double element) |
Insert or if exists add an element into the vector Any resulting zero elements will be made tiny. More... | |
void | zero (int index) |
Makes nonzero tiny. More... | |
int | clean (double tolerance) |
set all small values to zero and return number remaining More... | |
int | cleanAndPack (double tolerance) |
Same but packs down. More... | |
int | cleanAndPackSafe (double tolerance) |
Same but packs down and is safe (i.e. if order is odd) More... | |
void | setPacked () |
Mark as packed. More... | |
void | checkClear () |
For debug check vector is clear i.e. no elements. More... | |
void | checkClean () |
For debug check vector is clean i.e. elements match indices. More... | |
int | scan () |
Scan dense region and set up indices (returns number found) More... | |
int | scan (int start, int end) |
Scan dense region from start to < end and set up indices returns number found. More... | |
int | scan (double tolerance) |
Scan dense region and set up indices (returns number found). More... | |
int | scan (int start, int end, double tolerance) |
Scan dense region from start to < end and set up indices returns number found. More... | |
int | scanAndPack () |
These are same but pack down. More... | |
int | scanAndPack (int start, int end) |
Set the size. More... | |
int | scanAndPack (double tolerance) |
Set the size. More... | |
int | scanAndPack (int start, int end, double tolerance) |
Set the size. More... | |
void | createPacked (int number, const int *indices, const double *elements) |
Create packed array. More... | |
void | createUnpacked (int number, const int *indices, const double *elements) |
Create unpacked array. More... | |
void | createOneUnpackedElement (int index, double element) |
Create unpacked singleton. More... | |
void | expand () |
This is mainly for testing - goes from packed to indexed. More... | |
void | append (const CoinPackedVectorBase &caboose) |
Append a CoinPackedVector to the end. More... | |
void | append (const CoinIndexedVector &caboose) |
Append a CoinIndexedVector to the end (with extra space) More... | |
void | append (CoinIndexedVector &other, int adjustIndex, bool zapElements=false) |
Append a CoinIndexedVector to the end and modify indices. More... | |
void | swap (int i, int j) |
Swap values in positions i and j of indices and elements. More... | |
void | truncate (int newSize) |
Throw away all entries in rows >= newSize. More... | |
void | print () const |
Print out. More... | |
void | operator+= (double value) |
add value to every entry More... | |
void | operator-= (double value) |
subtract value from every entry More... | |
void | operator*= (double value) |
multiply every entry by value More... | |
void | operator/= (double value) |
divide every entry by value (** 0 vanishes) More... | |
bool | operator== (const CoinPackedVectorBase &rhs) const |
Equal. More... | |
bool | operator!= (const CoinPackedVectorBase &rhs) const |
Not equal. More... | |
bool | operator== (const CoinIndexedVector &rhs) const |
Equal. More... | |
bool | operator!= (const CoinIndexedVector &rhs) const |
Not equal. More... | |
int | isApproximatelyEqual (const CoinIndexedVector &rhs, double tolerance=1.0e-8) const |
Equal with a tolerance (returns -1 or position of inequality). More... | |
int | getMaxIndex () const |
Get value of maximum index. More... | |
int | getMinIndex () const |
Get value of minimum index. More... | |
void | sort () |
Sort the indexed storage vector (increasing indices). More... | |
void | sortIncrIndex () |
Sort the indexed storage vector (increasing indices). More... | |
void | sortDecrIndex () |
Sort the indexed storage vector (increasing indices). More... | |
void | sortIncrElement () |
Sort the indexed storage vector (increasing indices). More... | |
void | sortDecrElement () |
Sort the indexed storage vector (increasing indices). More... | |
void | sortPacked () |
Sort the indexed storage vector (increasing indices). More... | |
CoinIndexedVector | operator+ (const CoinIndexedVector &op2) |
Return the sum of two indexed vectors. More... | |
CoinIndexedVector | operator- (const CoinIndexedVector &op2) |
Return the difference of two indexed vectors. More... | |
CoinIndexedVector | operator* (const CoinIndexedVector &op2) |
Return the element-wise product of two indexed vectors. More... | |
CoinIndexedVector | operator/ (const CoinIndexedVector &op2) |
Return the element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes) More... | |
void | operator+= (const CoinIndexedVector &op2) |
The sum of two indexed vectors. More... | |
void | operator-= (const CoinIndexedVector &op2) |
The difference of two indexed vectors. More... | |
void | operator*= (const CoinIndexedVector &op2) |
The element-wise product of two indexed vectors. More... | |
void | operator/= (const CoinIndexedVector &op2) |
The element-wise ratio of two indexed vectors (0.0/0.0 => 0.0) (0 vanishes) More... | |
void | reserve (int n) |
Reserve space. More... | |
int | capacity () const |
capacity returns the size which could be accomodated without having to reallocate storage. More... | |
void | setCapacity (int value) |
Reserve space. More... | |
void | setPackedMode (bool yesNo) |
Sets packed mode. More... | |
bool | packedMode () const |
Gets packed mode. More... | |
CoinIndexedVector () | |
Default constructor. More... | |
CoinIndexedVector (int size, const int *inds, const double *elems) | |
Alternate Constructors - set elements to vector of doubles. More... | |
CoinIndexedVector (int size, const int *inds, double element) | |
Alternate Constructors - set elements to same scalar value. More... | |
CoinIndexedVector (int size, const double *elements) | |
Alternate Constructors - construct full storage with indices 0 through size-1. More... | |
CoinIndexedVector (int size) | |
Alternate Constructors - just size. More... | |
CoinIndexedVector (const CoinIndexedVector &) | |
Copy constructor. More... | |
CoinIndexedVector (const CoinIndexedVector *) | |
Copy constructor.2. More... | |
CoinIndexedVector (const CoinPackedVectorBase &rhs) | |
Copy constructor from a PackedVectorBase. More... | |
~CoinIndexedVector () | |
Destructor. More... | |
Protected Attributes | |
Private member data | |
int | startPartition_ [COIN_PARTITIONS+1] |
Starts. More... | |
int | numberElementsPartition_ [COIN_PARTITIONS] |
Size of indices in a partition. More... | |
int | numberPartitions_ |
Number of partitions (0 means off) More... | |
![]() | |
int * | indices_ |
Vector indices. More... | |
double * | elements_ |
Vector elements. More... | |
int | nElements_ |
Size of indices and packed elements vectors. More... | |
int | capacity_ |
Amount of memory allocated for indices_, and elements_. More... | |
int | offset_ |
Offset to get where new allocated array. More... | |
bool | packedMode_ |
If true then is operating in packed mode. More... | |
Definition at line 1057 of file CoinIndexedVector.hpp.
CoinPartitionedVector::CoinPartitionedVector | ( | ) |
Default constructor.
CoinPartitionedVector::CoinPartitionedVector | ( | int | size, |
const int * | inds, | ||
const double * | elems | ||
) |
Alternate Constructors - set elements to vector of doubles.
CoinPartitionedVector::CoinPartitionedVector | ( | int | size, |
const int * | inds, | ||
double | element | ||
) |
Alternate Constructors - set elements to same scalar value.
CoinPartitionedVector::CoinPartitionedVector | ( | int | size, |
const double * | elements | ||
) |
Alternate Constructors - construct full storage with indices 0 through size-1.
CoinPartitionedVector::CoinPartitionedVector | ( | int | size | ) |
Alternate Constructors - just size.
CoinPartitionedVector::CoinPartitionedVector | ( | const CoinPartitionedVector & | ) |
Copy constructor.
CoinPartitionedVector::CoinPartitionedVector | ( | const CoinPartitionedVector * | ) |
Copy constructor.2.
CoinPartitionedVector::~CoinPartitionedVector | ( | ) |
Destructor.
|
inline |
Get the size of a partition.
Definition at line 1066 of file CoinIndexedVector.hpp.
|
inline |
Get number of partitions.
Definition at line 1069 of file CoinIndexedVector.hpp.
|
inline |
Get the size.
Definition at line 1072 of file CoinIndexedVector.hpp.
|
inline |
Get starts.
Definition at line 1074 of file CoinIndexedVector.hpp.
|
inline |
Get starts.
Definition at line 1077 of file CoinIndexedVector.hpp.
|
inline |
Set the size of a partition.
Definition at line 1087 of file CoinIndexedVector.hpp.
|
inline |
Set the size of a partition (just for a tiny while)
Definition at line 1090 of file CoinIndexedVector.hpp.
void CoinPartitionedVector::computeNumberElements | ( | ) |
Add up number of elements in partitions.
void CoinPartitionedVector::compact | ( | ) |
Add up number of elements in partitions and pack and get rid of partitions.
void CoinPartitionedVector::reserve | ( | int | n | ) |
Reserve space.
void CoinPartitionedVector::setPartitions | ( | int | number, |
const int * | starts | ||
) |
Setup partitions (needs end as well)
void CoinPartitionedVector::clearAndReset | ( | ) |
Reset the vector (as if were just created an empty vector). Gets rid of partitions.
void CoinPartitionedVector::clearAndKeep | ( | ) |
Reset the vector (as if were just created an empty vector). Keeps partitions.
void CoinPartitionedVector::clearPartition | ( | int | partition | ) |
Clear a partition.
void CoinPartitionedVector::checkClear | ( | ) |
For debug check vector is clear i.e. no elements.
void CoinPartitionedVector::checkClean | ( | ) |
For debug check vector is clean i.e. elements match indices.
int CoinPartitionedVector::scan | ( | int | partition, |
double | tolerance = 0.0 |
||
) |
Scan dense region and set up indices (returns number found)
void CoinPartitionedVector::print | ( | ) | const |
Scan dense region from start to < end and set up indices returns number found.
Print out
void CoinPartitionedVector::sort | ( | ) |
Sort the indexed storage vector (increasing indices).
CoinPartitionedVector& CoinPartitionedVector::operator= | ( | const CoinPartitionedVector & | ) |
Assignment operator.
|
protected |
Starts.
Definition at line 1157 of file CoinIndexedVector.hpp.
|
protected |
Size of indices in a partition.
Definition at line 1159 of file CoinIndexedVector.hpp.
|
protected |
Number of partitions (0 means off)
Definition at line 1161 of file CoinIndexedVector.hpp.