Cbc  2.10.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members
CoinPartitionedVector Class Reference

#include <CoinIndexedVector.hpp>

+ Inheritance diagram for CoinPartitionedVector:
+ Collaboration diagram for CoinPartitionedVector:

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...
 
CoinPartitionedVectoroperator= (const CoinPartitionedVector &)
 Assignment operator. More...
 
 ~CoinPartitionedVector ()
 Destructor. More...
 
- Public Member Functions inherited from CoinIndexedVector
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...
 
void reallyClear ()
 Clear even if in a bad way. More...
 
CoinIndexedVectoroperator= (const CoinIndexedVector &)
 Assignment operator. More...
 
CoinIndexedVectoroperator= (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)
 
int scanAndPack (double tolerance)
 
int scanAndPack (int start, int end, double tolerance)
 
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 ()
 
void sortDecrIndex ()
 
void sortIncrElement ()
 
void sortDecrElement ()
 
void sortPacked ()
 
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)
 
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...
 
- Protected Attributes inherited from CoinIndexedVector
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...
 

Detailed Description

Definition at line 1303 of file CoinIndexedVector.hpp.

Constructor & Destructor Documentation

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.

Member Function Documentation

int CoinPartitionedVector::getNumElements ( int  partition) const
inline

Get the size of a partition.

Definition at line 1312 of file CoinIndexedVector.hpp.

int CoinPartitionedVector::getNumPartitions ( ) const
inline

Get number of partitions.

Definition at line 1318 of file CoinIndexedVector.hpp.

int CoinPartitionedVector::getNumElements ( ) const
inline

Get the size.

Definition at line 1323 of file CoinIndexedVector.hpp.

int CoinPartitionedVector::startPartition ( int  partition) const
inline

Get starts.

Definition at line 1325 of file CoinIndexedVector.hpp.

const int* CoinPartitionedVector::startPartitions ( ) const
inline

Get starts.

Definition at line 1331 of file CoinIndexedVector.hpp.

void CoinPartitionedVector::setNumElementsPartition ( int  partition,
int  value 
)
inline

Set the size of a partition.

Definition at line 1343 of file CoinIndexedVector.hpp.

void CoinPartitionedVector::setTempNumElementsPartition ( int  partition,
int  value 
)
inline

Set the size of a partition (just for a tiny while)

Definition at line 1350 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.

Member Data Documentation

int CoinPartitionedVector::startPartition_[COIN_PARTITIONS+1]
protected

Starts.

Definition at line 1420 of file CoinIndexedVector.hpp.

int CoinPartitionedVector::numberElementsPartition_[COIN_PARTITIONS]
protected

Size of indices in a partition.

Definition at line 1422 of file CoinIndexedVector.hpp.

int CoinPartitionedVector::numberPartitions_
protected

Number of partitions (0 means off)

Definition at line 1424 of file CoinIndexedVector.hpp.


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