6 #ifndef CoinPackedVectorBase_H
7 #define CoinPackedVectorBase_H
66 { testForDuplicateIndex_=
false; testedDuplicateIndex_=
false;}
96 const char * className = NULL)
const;
139 template <
class FloatEqual>
bool
148 std::map<int,double> mv;
153 mv.insert(std::make_pair(inds[i], elems[i]));
156 std::map<int,double> mvRhs;
160 mvRhs.insert(std::make_pair(inds[i], elems[i]));
163 std::map<int,double>::const_iterator mvI = mv.begin();
164 std::map<int,double>::const_iterator mvIlast = mv.end();
165 std::map<int,double>::const_iterator mvIrhs = mvRhs.begin();
166 while (mvI != mvIlast) {
167 if (mvI->first != mvIrhs->first || ! eq(mvI->second, mvIrhs->second))
237 std::set<int> *
indexSet(
const char* methodName = NULL,
238 const char * className = NULL)
const;
244 maxIndex_ = x.maxIndex_;
245 minIndex_ = x.minIndex_;
252 mutable int maxIndex_;
255 mutable int minIndex_;
259 mutable std::set<int> * indexSetPtr_;
262 mutable bool testForDuplicateIndex_;
265 mutable bool testedDuplicateIndex_;
bool operator!=(const CoinPackedVectorBase &rhs) const
Not equal.
void setTestForDuplicateIndex(bool test) const
Set to the argument value whether to test for duplicate indices in the vector whenever they can occur...
double operator[](int i) const
Access the i'th element of the full storage vector.
double sum() const
Sum elements of vector.
void copyMaxMinIndex(const CoinPackedVectorBase &x) const
bool isExistingIndex(int i) const
Return true if the i'th element of the full storage vector exists in the packed storage vector...
int getMinIndex() const
Get value of minimum index.
double twoNorm() const
Return the 2-norm of the vector.
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 ...
virtual ~CoinPackedVectorBase()
Destructor.
double oneNorm() const
Return the 1-norm of the vector.
Abstract base class for various sparse vectors.
virtual const double * getElements() const =0
Get element values.
CoinPackedVectorBase()
Default constructor.
void findMaxMinIndices() const
Find Maximum and Minimum Indices.
bool testForDuplicateIndex() const
Returns true if the vector should be tested for duplicate indices when they can occur.
void setTestForDuplicateIndexWhenTrue(bool test) const
Set to the argument value whether to test for duplicate indices in the vector whenever they can occur...
virtual int getNumElements() const =0
Get length of indices and elements vectors.
int compare(const CoinPackedVectorBase &rhs) const
This method establishes an ordering on packed vectors.
bool operator==(const CoinPackedVectorBase &rhs) const
Equal.
void duplicateIndex(const char *methodName=NULL, const char *className=NULL) const
Throw an exception if there are duplicate indices.
virtual const int * getIndices() const =0
Get indices of elements.
std::set< int > * indexSet(const char *methodName=NULL, const char *className=NULL) const
Return indexSetPtr_ (create it if necessary).
int findIndex(int i) const
Return the position of the i'th element of the full storage vector.
double dotProduct(const double *dense) const
Create the dot product with a full vector.
double * denseVector(int denseSize) const
Get the vector as a dense vector.
int getMaxIndex() const
Get value of maximum index.
void clearIndexSet() const
Delete the indexSet.
void setTestsOff() const
Just sets test stuff false without a try etc.
double normSquare() const
Return the square of the 2-norm of the vector.
double infNorm() const
Return the infinity-norm of the vector.