Cgl  0.60.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinShallowPackedVector.hpp
Go to the documentation of this file.
1 /* $Id: CoinShallowPackedVector.hpp 2083 2019-01-06 19:38:09Z unxusr $ */
2 // Copyright (C) 2000, International Business Machines
3 // Corporation and others. All Rights Reserved.
4 // This code is licensed under the terms of the Eclipse Public License (EPL).
5 
6 #ifndef CoinShallowPackedVector_H
7 #define CoinShallowPackedVector_H
8 
9 #if defined(_MSC_VER)
10 // Turn off compiler warning about long names
11 #pragma warning(disable : 4786)
12 #endif
13 
14 #include "CoinError.hpp"
15 #include "CoinPackedVectorBase.hpp"
16 
75  friend void CoinShallowPackedVectorUnitTest();
76 
77 public:
80  virtual int getNumElements() const { return nElements_; }
83  virtual const int *getIndices() const { return indices_; }
85  virtual const double *getElements() const { return elements_; }
87 
90  void clear();
97  void setVector(int size, const int *indices, const double *elements,
98  bool testForDuplicateIndex = true);
100 
113  CoinShallowPackedVector(int size,
114  const int *indices, const double *elements,
115  bool testForDuplicateIndex = true);
123  void print();
125 
126 private:
129  const int *indices_;
132  const double *elements_;
136 };
137 
138 //#############################################################################
145 
146 #endif
147 
148 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
149 */
void print()
Print vector information.
void setVector(int size, const int *indices, const double *elements, bool testForDuplicateIndex=true)
just like the explicit constructor
virtual const int * getIndices() const
Get indices of elements.
CoinShallowPackedVector(bool testForDuplicateIndex=true)
Default constructor.
virtual const double * getElements() const
Get element values.
Abstract base class for various sparse vectors.
bool testForDuplicateIndex() const
Returns true if the vector should be tested for duplicate indices when they can occur.
friend void CoinShallowPackedVectorUnitTest()
A function that tests the methods in the CoinShallowPackedVector class.
const int * indices_
Vector indices.
CoinShallowPackedVector & operator=(const CoinShallowPackedVector &x)
Assignment operator.
const double * elements_
Vector elements.
virtual int getNumElements() const
Get length of indices and elements vectors.
virtual ~CoinShallowPackedVector()
Destructor.
void clear()
Reset the vector (as if were just created an empty vector)
int nElements_
Size of indices and elements vectors.
void CoinShallowPackedVectorUnitTest()
A function that tests the methods in the CoinShallowPackedVector class.