4 #ifndef CoinPackedVectorBase_H
5 #define CoinPackedVectorBase_H
9 # pragma warning(disable:4786)
99 const char * className = NULL)
const;
142 template <
class FloatEqual>
bool
151 std::map<int,double> mv;
156 mv.insert(std::make_pair(inds[i], elems[i]));
159 std::map<int,double> mvRhs;
163 mvRhs.insert(std::make_pair(inds[i], elems[i]));
166 std::map<int,double>::const_iterator mvI = mv.begin();
167 std::map<int,double>::const_iterator mvIlast = mv.end();
168 std::map<int,double>::const_iterator mvIrhs = mvRhs.begin();
169 while (mvI != mvIlast) {
170 if (mvI->first != mvIrhs->first || ! eq(mvI->second, mvIrhs->second))
242 std::set<int> *
indexSet(
const char* methodName = NULL,
243 const char * className = NULL)
const;
bool isEquivalent(const CoinPackedVectorBase &rhs, const FloatEqual &eq) const
equivalent - If shallow packed vector A & B are equivalent, then they are still equivalent no matter ...
CoinPackedVectorBase()
Default constructor.
int getMaxIndex() const
Get value of maximum index.
Equality to a scaled tolerance.
virtual int getNumElements() const =0
Get length of indices and elements vectors.
double dotProduct(const double *dense) const
Create the dot product with a full vector.
std::set< int > * indexSetPtr_
Store the indices in a set.
void clearIndexSet() const
Delete the indexSet.
std::set< int > * indexSet(const char *methodName=NULL, const char *className=NULL) const
Return indexSetPtr_ (create it if necessary).
bool testForDuplicateIndex_
True if the vector should be tested for duplicate indices when they can occur.
int compare(const CoinPackedVectorBase &rhs) const
This method establishes an ordering on packed vectors.
int getMinIndex() const
Get value of minimum index.
void setTestForDuplicateIndex(bool test) const
Set to the argument value whether to test for duplicate indices in the vector whenever they can occur...
bool operator==(const CoinPackedVectorBase &rhs) const
Equal.
void copyMaxMinIndex(const CoinPackedVectorBase &x) const
Find Maximum and Minimum Indices.
bool operator!=(const CoinPackedVectorBase &rhs) const
Not equal.
double sum() const
Sum elements of vector.
Abstract base class for various sparse vectors.
void setTestForDuplicateIndexWhenTrue(bool test) const
Set to the argument value whether to test for duplicate indices in the vector whenever they can occur...
void clearBase() const
Find Maximum and Minimum Indices.
int maxIndex_
Contains max index value or -infinity.
bool isExistingIndex(int i) const
Return true if the i'th element of the full storage vector exists in the packed storage vector...
int minIndex_
Contains minimum index value or infinity.
virtual ~CoinPackedVectorBase()
Destructor.
void setTestsOff() const
Just sets test stuff false without a try etc.
double twoNorm() const
Return the 2-norm of the vector.
double infNorm() const
Return the infinity-norm of the vector.
virtual const double * getElements() const =0
Get element values.
double operator[](int i) const
Access the i'th element of the full storage vector.
bool testForDuplicateIndex() const
Returns true if the vector should be tested for duplicate indices when they can occur.
bool isEquivalent(const CoinPackedVectorBase &rhs) const
Equal.
CoinPackedVectorBase & operator=(const CoinPackedVectorBase &)
This class provides const access to packed vectors, so there's no need to provide an assignment opera...
double oneNorm() const
Return the 1-norm of the vector.
virtual const int * getIndices() const =0
Get indices of elements.
double normSquare() const
Return the square of the 2-norm of the vector.
int findIndex(int i) const
Return the position of the i'th element of the full storage vector.
double * denseVector(int denseSize) const
Get the vector as a dense vector.
bool testedDuplicateIndex_
True if the vector has already been tested for duplicate indices.
void findMaxMinIndices() const
Find Maximum and Minimum Indices.
Function objects for testing equality of real numbers.
void duplicateIndex(const char *methodName=NULL, const char *className=NULL) const
Throw an exception if there are duplicate indices.