Clp 1.17.6

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CoinIndexedVector.hpp
Go to the documentation of this file.
1 /* $Id: CoinIndexedVector.hpp 2084 2019-01-09 14:17:08Z forrest $ */
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 CoinIndexedVector_H
7 #define CoinIndexedVector_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 <map>
15 #include "CoinFinite.hpp"
16 #ifndef CLP_NO_VECTOR
17 #include "CoinPackedVectorBase.hpp"
18 #endif
19 #include "CoinSort.hpp"
20 #include "CoinHelperFunctions.hpp"
21 #include <cassert>
22
23 #ifndef COIN_FLOAT
24 #define COIN_INDEXED_TINY_ELEMENT 1.0e-50
25 #define COIN_INDEXED_REALLY_TINY_ELEMENT 1.0e-100
26 #else
27 #define COIN_INDEXED_TINY_ELEMENT 1.0e-35
28 #define COIN_INDEXED_REALLY_TINY_ELEMENT 1.0e-39
29 #endif
30
104 class CoinIndexedVector {
105 friend void CoinIndexedVectorUnitTest();
106
107 public:
110 inline int getNumElements() const { return nElements_; }
113 inline const int *getIndices() const { return indices_; }
115 // ** No longer supported virtual const double * getElements() const ;
117 inline int *getIndices() { return indices_; }
121 inline double *denseVector() const { return elements_; }
123 inline void setDenseVector(double *array)
124 {
125 elements_ = array;
126 }
128 inline void setIndexVector(int *array)
129 {
130 indices_ = array;
131 }
134 double &operator[](int i) const;
135
137
138 //-------------------------------------------------------------------
139 // Set indices and elements
140 //-------------------------------------------------------------------
143 inline void setNumElements(int value)
145 {
146 nElements_ = value;
147 if (!nElements_)
148 packedMode_ = false;
149 }
151 void clear();
153 void empty();
155 void reallyClear();
157 CoinIndexedVector &operator=(const CoinIndexedVector &);
158 #ifndef CLP_NO_VECTOR
159
161 CoinIndexedVector &operator=(const CoinPackedVectorBase &rhs);
162 #endif
163
166 void copy(const CoinIndexedVector &rhs, double multiplier = 1.0);
167
170 void borrowVector(int size, int numberIndices, int *inds, double *elems);
171
175 void returnVector();
176
181 void setVector(int numberIndices, const int *inds, const double *elems);
182
187 void setVector(int size, int numberIndices, const int *inds, const double *elems);
188
190 void setConstant(int size, const int *inds, double elems);
191
193 void setFull(int size, const double *elems);
194
198 void setElement(int index, double element);
199
201 void insert(int index, double element);
203 inline void quickInsert(int index, double element)
204 {
205 assert(!elements_[index]);
206 indices_[nElements_++] = index;
207 assert(nElements_ <= capacity_);
208 elements_[index] = element;
209 }
212 void add(int index, double element);
216 inline void quickAdd(int index, double element)
217 {
218 if (elements_[index]) {
219 element += elements_[index];
220 if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) {
221 elements_[index] = element;
222 } else {
223 elements_[index] = 1.0e-100;
224 }
225 } else if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) {
226 indices_[nElements_++] = index;
227 assert(nElements_ <= capacity_);
228 elements_[index] = element;
229 }
230 }
235 inline void quickAddNonZero(int index, double element)
236 {
237 assert(element);
238 if (elements_[index]) {
239 element += elements_[index];
240 if ((element > 0 ? element : -element) >= COIN_INDEXED_TINY_ELEMENT) {
241 elements_[index] = element;
242 } else {
243 elements_[index] = COIN_DBL_MIN;
244 }
245 } else {
246 indices_[nElements_++] = index;
247 assert(nElements_ <= capacity_);
248 elements_[index] = element;
249 }
250 }
253 inline void zero(int index)
254 {
255 if (elements_[index])
256 elements_[index] = COIN_DBL_MIN;
257 }
260 int clean(double tolerance);
262 int cleanAndPack(double tolerance);
264 int cleanAndPackSafe(double tolerance);
266 inline void setPacked()
267 {
268 packedMode_ = true;
269 }
270 #ifndef NDEBUG
271 void checkClear();
274 void checkClean();
275 #else
276 inline void checkClear() {};
277 inline void checkClean() {};
278 #endif
279 int scan();
284 int scan(int start, int end);
287 int scan(double tolerance);
291 int scan(int start, int end, double tolerance);
293 int scanAndPack();
294 int scanAndPack(int start, int end);
295 int scanAndPack(double tolerance);
296 int scanAndPack(int start, int end, double tolerance);
298 void createPacked(int number, const int *indices,
299 const double *elements);
301 void createUnpacked(int number, const int *indices,
302 const double *elements);
304 void createOneUnpackedElement(int index, double element);
306 void expand();
307 #ifndef CLP_NO_VECTOR
308 void append(const CoinPackedVectorBase &caboose);
310 #endif
311 void append(const CoinIndexedVector &caboose);
314 void append(CoinIndexedVector &other, int adjustIndex, bool zapElements = false);
315
317 void swap(int i, int j);
318
320 void truncate(int newSize);
322 void print() const;
324
326 void operator+=(double value);
329 void operator-=(double value);
331 void operator*=(double value);
333 void operator/=(double value);
335
338 #ifndef CLP_NO_VECTOR
339
341 bool operator==(const CoinPackedVectorBase &rhs) const;
343 bool operator!=(const CoinPackedVectorBase &rhs) const;
344 #endif
345
347 bool operator==(const CoinIndexedVector &rhs) const;
349 bool operator!=(const CoinIndexedVector &rhs) const;
351 int isApproximatelyEqual(const CoinIndexedVector &rhs, double tolerance = 1.0e-8) const;
353
356 int getMaxIndex() const;
359 int getMinIndex() const;
361
365 void sort()
366 {
367 std::sort(indices_, indices_ + nElements_);
368 }
369
370 void sortIncrIndex()
371 {
372 std::sort(indices_, indices_ + nElements_);
373 }
374
375 void sortDecrIndex();
376
377 void sortIncrElement();
378
379 void sortDecrElement();
380 void sortPacked();
381
383
384 //#############################################################################
385
397 CoinIndexedVector operator+(
399 const CoinIndexedVector &op2);
400
402 CoinIndexedVector operator-(
403 const CoinIndexedVector &op2);
404
406 CoinIndexedVector operator*(
407 const CoinIndexedVector &op2);
408
410 CoinIndexedVector operator/(
411 const CoinIndexedVector &op2);
413 void operator+=(const CoinIndexedVector &op2);
414
416 void operator-=(const CoinIndexedVector &op2);
417
419 void operator*=(const CoinIndexedVector &op2);
420
422 void operator/=(const CoinIndexedVector &op2);
424
431 void reserve(int n);
435 inline int capacity() const { return capacity_; }
436 inline void setCapacity(int value)
437 {
438 capacity_ = value;
439 }
441 inline void setPackedMode(bool yesNo)
442 {
443 packedMode_ = yesNo;
444 }
446 inline bool packedMode() const
447 {
448 return packedMode_;
449 }
451
455 CoinIndexedVector();
457 CoinIndexedVector(int size, const int *inds, const double *elems);
459 CoinIndexedVector(int size, const int *inds, double element);
462 CoinIndexedVector(int size, const double *elements);
464 CoinIndexedVector(int size);
466 CoinIndexedVector(const CoinIndexedVector &);
468 CoinIndexedVector(const CoinIndexedVector *);
469 #ifndef CLP_NO_VECTOR
470
471 CoinIndexedVector(const CoinPackedVectorBase &rhs);
472 #endif
473
474 ~CoinIndexedVector();
476
477 private:
480 void gutsOfSetVector(int size,
482 const int *inds, const double *elems);
483 void gutsOfSetVector(int size, int numberIndices,
484 const int *inds, const double *elems);
485 void gutsOfSetPackedVector(int size, int numberIndices,
486 const int *inds, const double *elems);
488 void gutsOfSetConstant(int size,
489 const int *inds, double value);
491
492 protected:
495 int *indices_;
498 double *elements_;
500 int nElements_;
502 int capacity_;
504 int offset_;
506 bool packedMode_;
508 };
509
510 //#############################################################################
516 void CoinIndexedVectorUnitTest();
533 class CoinArrayWithLength {
534
535 public:
538 inline CoinBigIndex getSize() const
540 {
541 return static_cast< CoinBigIndex >(size_);
542 }
544 inline CoinBigIndex rawSize() const
545 {
546 return static_cast< CoinBigIndex >(size_);
547 }
549 inline bool switchedOn() const
550 {
551 return size_ != -1;
552 }
554 inline CoinBigIndex capacity() const
555 {
556 return (size_ > -2) ? static_cast< CoinBigIndex >(size_) : static_cast< CoinBigIndex >((-size_) - 2);
557 }
559 inline void setCapacity()
560 {
561 if (size_ <= -2)
562 size_ = (-size_) - 2;
563 }
565 inline const char *array() const
566 {
567 return (size_ > -2) ? array_ : NULL;
568 }
570
573 inline void setSize(int value)
575 {
576 size_ = value;
577 }
578 #if COIN_BIG_INDEX
579 inline void setSize(long long value)
581 {
582 size_ = value;
583 }
584 #endif
585 inline void switchOff()
587 {
588 size_ = -1;
589 }
591 inline void switchOn(int alignment = 3)
592 {
593 size_ = -2;
594 alignment_ = alignment;
595 }
597 void setPersistence(int flag, int currentLength);
599 void clear();
601 void swap(CoinArrayWithLength &other);
603 void extend(int newSize);
604 #if COIN_BIG_INDEX
605 void extend(long long newSize);
607 #endif
608
609
612 char *conditionalNew(CoinBigIndex sizeWanted);
615 void conditionalDelete();
617
621 inline CoinArrayWithLength()
622 : array_(NULL)
623 , size_(-1)
624 , offset_(0)
625 , alignment_(0)
626 {
627 }
629 inline CoinArrayWithLength(CoinBigIndex size)
630 : size_(-1)
631 , offset_(0)
632 , alignment_(0)
633 {
634 array_ = new char[size];
635 }
642 CoinArrayWithLength(CoinBigIndex size, int mode);
644 CoinArrayWithLength(const CoinArrayWithLength &rhs);
646 CoinArrayWithLength(const CoinArrayWithLength *rhs);
648 CoinArrayWithLength &operator=(const CoinArrayWithLength &rhs);
650 void copy(const CoinArrayWithLength &rhs, int numberBytes = -1);
652 void allocate(const CoinArrayWithLength &rhs, CoinBigIndex numberBytes);
654 ~CoinArrayWithLength();
656 void getArray(CoinBigIndex size);
658 void reallyFreeArray();
660 void getCapacity(CoinBigIndex numberBytes, CoinBigIndex numberIfNeeded = -1);
662
663 protected:
666 char *array_;
669 CoinBigIndex size_;
671 int offset_;
673 int alignment_;
675 };
677
678 class CoinDoubleArrayWithLength : public CoinArrayWithLength {
679
680 public:
683 inline CoinBigIndex getSize() const
685 {
686 return size_ / CoinSizeofAsInt(double);
687 }
689 inline double *array() const
690 {
691 return reinterpret_cast< double * >((size_ > -2) ? array_ : NULL);
692 }
694
697 inline void setSize(int value)
699 {
700 size_ = value * CoinSizeofAsInt(double);
701 }
703
706 inline double *conditionalNew(CoinBigIndex sizeWanted)
708 {
709 return reinterpret_cast< double * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(double)) : -1));
710 }
712
716 inline CoinDoubleArrayWithLength()
717 {
718 array_ = NULL;
719 size_ = -1;
720 }
722 inline CoinDoubleArrayWithLength(int size)
723 {
724 array_ = new char[size * CoinSizeofAsInt(double)];
725 size_ = -1;
726 }
731 inline CoinDoubleArrayWithLength(int size, int mode)
732 : CoinArrayWithLength(size * CoinSizeofAsInt(double), mode)
733 {
734 }
736 inline CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength &rhs)
737 : CoinArrayWithLength(rhs)
738 {
739 }
741 inline CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength *rhs)
742 : CoinArrayWithLength(rhs)
743 {
744 }
746 inline CoinDoubleArrayWithLength &operator=(const CoinDoubleArrayWithLength &rhs)
747 {
748 CoinArrayWithLength::operator=(rhs);
749 return *this;
750 }
752 };
754
755 class CoinFactorizationDoubleArrayWithLength : public CoinArrayWithLength {
756
757 public:
760 inline CoinBigIndex getSize() const
762 {
763 return size_ / CoinSizeofAsInt(CoinFactorizationDouble);
764 }
766 inline CoinFactorizationDouble *array() const
767 {
768 return reinterpret_cast< CoinFactorizationDouble * >((size_ > -2) ? array_ : NULL);
769 }
771
774 inline void setSize(int value)
776 {
777 size_ = value * CoinSizeofAsInt(CoinFactorizationDouble);
778 }
780
783 inline CoinFactorizationDouble *conditionalNew(CoinBigIndex sizeWanted)
785 {
786 return reinterpret_cast< CoinFactorizationDouble * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(CoinFactorizationDouble)) : -1));
787 }
789
793 inline CoinFactorizationDoubleArrayWithLength()
794 {
795 array_ = NULL;
796 size_ = -1;
797 }
799 inline CoinFactorizationDoubleArrayWithLength(int size)
800 {
801 array_ = new char[size * CoinSizeofAsInt(CoinFactorizationDouble)];
802 size_ = -1;
803 }
808 inline CoinFactorizationDoubleArrayWithLength(int size, int mode)
809 : CoinArrayWithLength(size * CoinSizeofAsInt(CoinFactorizationDouble), mode)
810 {
811 }
813 inline CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength &rhs)
814 : CoinArrayWithLength(rhs)
815 {
816 }
818 inline CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength *rhs)
819 : CoinArrayWithLength(rhs)
820 {
821 }
823 inline CoinFactorizationDoubleArrayWithLength &operator=(const CoinFactorizationDoubleArrayWithLength &rhs)
824 {
825 CoinArrayWithLength::operator=(rhs);
826 return *this;
827 }
829 };
831
832 class CoinFactorizationLongDoubleArrayWithLength : public CoinArrayWithLength {
833
834 public:
837 inline CoinBigIndex getSize() const
839 {
840 return size_ / CoinSizeofAsInt(long double);
841 }
843 inline long double *array() const
844 {
845 return reinterpret_cast< long double * >((size_ > -2) ? array_ : NULL);
846 }
848
851 inline void setSize(int value)
853 {
854 size_ = value * CoinSizeofAsInt(long double);
855 }
857
860 inline long double *conditionalNew(CoinBigIndex sizeWanted)
862 {
863 return reinterpret_cast< long double * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(long double)) : -1));
864 }
866
870 inline CoinFactorizationLongDoubleArrayWithLength()
871 {
872 array_ = NULL;
873 size_ = -1;
874 }
876 inline CoinFactorizationLongDoubleArrayWithLength(int size)
877 {
878 array_ = new char[size * CoinSizeofAsInt(long double)];
879 size_ = -1;
880 }
885 inline CoinFactorizationLongDoubleArrayWithLength(int size, int mode)
886 : CoinArrayWithLength(size * CoinSizeofAsInt(long double), mode)
887 {
888 }
890 inline CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength &rhs)
891 : CoinArrayWithLength(rhs)
892 {
893 }
895 inline CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength *rhs)
896 : CoinArrayWithLength(rhs)
897 {
898 }
900 inline CoinFactorizationLongDoubleArrayWithLength &operator=(const CoinFactorizationLongDoubleArrayWithLength &rhs)
901 {
902 CoinArrayWithLength::operator=(rhs);
903 return *this;
904 }
906 };
908
909 class CoinIntArrayWithLength : public CoinArrayWithLength {
910
911 public:
914 inline CoinBigIndex getSize() const
916 {
917 return size_ / CoinSizeofAsInt(int);
918 }
920 inline int *array() const
921 {
922 return reinterpret_cast< int * >((size_ > -2) ? array_ : NULL);
923 }
925
928 inline void setSize(int value)
930 {
931 size_ = value * CoinSizeofAsInt(int);
932 }
934
937 inline int *conditionalNew(CoinBigIndex sizeWanted)
939 {
940 return reinterpret_cast< int * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(int)) : -1));
941 }
943
947 inline CoinIntArrayWithLength()
948 {
949 array_ = NULL;
950 size_ = -1;
951 }
953 inline CoinIntArrayWithLength(int size)
954 {
955 array_ = new char[size * CoinSizeofAsInt(int)];
956 size_ = -1;
957 }
962 inline CoinIntArrayWithLength(int size, int mode)
963 : CoinArrayWithLength(size * CoinSizeofAsInt(int), mode)
964 {
965 }
967 inline CoinIntArrayWithLength(const CoinIntArrayWithLength &rhs)
968 : CoinArrayWithLength(rhs)
969 {
970 }
972 inline CoinIntArrayWithLength(const CoinIntArrayWithLength *rhs)
973 : CoinArrayWithLength(rhs)
974 {
975 }
977 inline CoinIntArrayWithLength &operator=(const CoinIntArrayWithLength &rhs)
978 {
979 CoinArrayWithLength::operator=(rhs);
980 return *this;
981 }
983 };
985
986 class CoinBigIndexArrayWithLength : public CoinArrayWithLength {
987
988 public:
991 inline CoinBigIndex getSize() const
993 {
994 return size_ / CoinSizeofAsInt(CoinBigIndex);
995 }
997 inline CoinBigIndex *array() const
998 {
999 return reinterpret_cast< CoinBigIndex * >((size_ > -2) ? array_ : NULL);
1000 }
1002
1005 inline void setSize(CoinBigIndex value)
1007 {
1008 size_ = value * CoinSizeofAsInt(CoinBigIndex);
1009 }
1011
1014 inline CoinBigIndex *conditionalNew(CoinBigIndex sizeWanted)
1016 {
1017 return reinterpret_cast< CoinBigIndex * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(CoinBigIndex)) : -1));
1018 }
1020
1024 inline CoinBigIndexArrayWithLength()
1025 {
1026 array_ = NULL;
1027 size_ = -1;
1028 }
1030 inline CoinBigIndexArrayWithLength(CoinBigIndex size)
1031 {
1032 array_ = new char[size * CoinSizeofAsInt(CoinBigIndex)];
1033 size_ = -1;
1034 }
1039 inline CoinBigIndexArrayWithLength(CoinBigIndex size, int mode)
1040 : CoinArrayWithLength(size * CoinSizeofAsInt(CoinBigIndex), mode)
1041 {
1042 }
1044 inline CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength &rhs)
1045 : CoinArrayWithLength(rhs)
1046 {
1047 }
1049 inline CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength *rhs)
1050 : CoinArrayWithLength(rhs)
1051 {
1052 }
1054 inline CoinBigIndexArrayWithLength &operator=(const CoinBigIndexArrayWithLength &rhs)
1055 {
1056 CoinArrayWithLength::operator=(rhs);
1057 return *this;
1058 }
1060 };
1062
1063 class CoinUnsignedIntArrayWithLength : public CoinArrayWithLength {
1064
1065 public:
1068 inline CoinBigIndex getSize() const
1070 {
1071 return size_ / CoinSizeofAsInt(unsigned int);
1072 }
1074 inline unsigned int *array() const
1075 {
1076 return reinterpret_cast< unsigned int * >((size_ > -2) ? array_ : NULL);
1077 }
1079
1082 inline void setSize(int value)
1084 {
1085 size_ = value * CoinSizeofAsInt(unsigned int);
1086 }
1088
1091 inline unsigned int *conditionalNew(CoinBigIndex sizeWanted)
1093 {
1094 return reinterpret_cast< unsigned int * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(unsigned int)) : -1));
1095 }
1097
1101 inline CoinUnsignedIntArrayWithLength()
1102 {
1103 array_ = NULL;
1104 size_ = -1;
1105 }
1107 inline CoinUnsignedIntArrayWithLength(int size)
1108 {
1109 array_ = new char[size * CoinSizeofAsInt(unsigned int)];
1110 size_ = -1;
1111 }
1116 inline CoinUnsignedIntArrayWithLength(int size, int mode)
1117 : CoinArrayWithLength(size * CoinSizeofAsInt(unsigned int), mode)
1118 {
1119 }
1121 inline CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength &rhs)
1122 : CoinArrayWithLength(rhs)
1123 {
1124 }
1126 inline CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength *rhs)
1127 : CoinArrayWithLength(rhs)
1128 {
1129 }
1131 inline CoinUnsignedIntArrayWithLength &operator=(const CoinUnsignedIntArrayWithLength &rhs)
1132 {
1133 CoinArrayWithLength::operator=(rhs);
1134 return *this;
1135 }
1137 };
1139
1140 class CoinVoidStarArrayWithLength : public CoinArrayWithLength {
1141
1142 public:
1145 inline CoinBigIndex getSize() const
1147 {
1148 return size_ / CoinSizeofAsInt(void *);
1149 }
1151 inline void **array() const
1152 {
1153 return reinterpret_cast< void ** >((size_ > -2) ? array_ : NULL);
1154 }
1156
1159 inline void setSize(int value)
1161 {
1162 size_ = value * CoinSizeofAsInt(void *);
1163 }
1165
1168 inline void **conditionalNew(CoinBigIndex sizeWanted)
1170 {
1171 return reinterpret_cast< void ** >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*CoinSizeofAsInt(void *)) : -1));
1172 }
1174
1178 inline CoinVoidStarArrayWithLength()
1179 {
1180 array_ = NULL;
1181 size_ = -1;
1182 }
1184 inline CoinVoidStarArrayWithLength(int size)
1185 {
1186 array_ = new char[size * CoinSizeofAsInt(void *)];
1187 size_ = -1;
1188 }
1193 inline CoinVoidStarArrayWithLength(int size, int mode)
1194 : CoinArrayWithLength(size * CoinSizeofAsInt(void *), mode)
1195 {
1196 }
1198 inline CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength &rhs)
1199 : CoinArrayWithLength(rhs)
1200 {
1201 }
1203 inline CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength *rhs)
1204 : CoinArrayWithLength(rhs)
1205 {
1206 }
1208 inline CoinVoidStarArrayWithLength &operator=(const CoinVoidStarArrayWithLength &rhs)
1209 {
1210 CoinArrayWithLength::operator=(rhs);
1211 return *this;
1212 }
1214 };
1216
1217 class CoinArbitraryArrayWithLength : public CoinArrayWithLength {
1218
1219 public:
1222 inline CoinBigIndex getSize() const
1224 {
1225 return size_ / lengthInBytes_;
1226 }
1228 inline void **array() const
1229 {
1230 return reinterpret_cast< void ** >((size_ > -2) ? array_ : NULL);
1231 }
1233
1236 inline void setSize(int value)
1238 {
1239 size_ = value * lengthInBytes_;
1240 }
1242
1245 inline char *conditionalNew(CoinBigIndex length, CoinBigIndex sizeWanted)
1247 {
1248 lengthInBytes_ = length;
1249 return reinterpret_cast< char * >(CoinArrayWithLength::conditionalNew(sizeWanted >= 0 ? static_cast< long long >((sizeWanted)*lengthInBytes_) : -1));
1250 }
1252
1256 inline CoinArbitraryArrayWithLength(int length = 1)
1257 {
1258 array_ = NULL;
1259 size_ = -1;
1260 lengthInBytes_ = length;
1261 }
1263 inline CoinArbitraryArrayWithLength(int length, int size)
1264 {
1265 array_ = new char[size * length];
1266 size_ = -1;
1267 lengthInBytes_ = length;
1268 }
1273 inline CoinArbitraryArrayWithLength(int length, int size, int mode)
1274 : CoinArrayWithLength(size * length, mode)
1275 {
1276 lengthInBytes_ = length;
1277 }
1279 inline CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength &rhs)
1280 : CoinArrayWithLength(rhs)
1281 {
1282 }
1284 inline CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength *rhs)
1285 : CoinArrayWithLength(rhs)
1286 {
1287 }
1289 inline CoinArbitraryArrayWithLength &operator=(const CoinArbitraryArrayWithLength &rhs)
1290 {
1291 CoinArrayWithLength::operator=(rhs);
1292 return *this;
1293 }
1295
1296 protected:
1299 CoinBigIndex lengthInBytes_;
1302 };
1303 class CoinPartitionedVector : public CoinIndexedVector {
1304
1305 public:
1306 #ifndef COIN_PARTITIONS
1307 #define COIN_PARTITIONS 8
1308 #endif
1309
1311 inline int getNumElements(int partition) const
1313 {
1314 assert(partition < COIN_PARTITIONS);
1315 return numberElementsPartition_[partition];
1316 }
1318 inline int getNumPartitions() const
1319 {
1320 return numberPartitions_;
1321 }
1323 inline int getNumElements() const { return nElements_; }
1325 inline int startPartition(int partition) const
1326 {
1327 assert(partition <= COIN_PARTITIONS);
1328 return startPartition_[partition];
1329 }
1331 inline const int *startPartitions() const
1332 {
1333 return startPartition_;
1334 }
1336
1337 //-------------------------------------------------------------------
1338 // Set indices and elements
1339 //-------------------------------------------------------------------
1342 inline void setNumElementsPartition(int partition, int value)
1344 {
1345 assert(partition < COIN_PARTITIONS);
1346 if (numberPartitions_)
1347 numberElementsPartition_[partition] = value;
1348 }
1350 inline void setTempNumElementsPartition(int partition, int value)
1351 {
1352 assert(partition < COIN_PARTITIONS);
1353 numberElementsPartition_[partition] = value;
1354 }
1356 void computeNumberElements();
1358 void compact();
1361 void reserve(int n);
1363 void setPartitions(int number, const int *starts);
1365 void clearAndReset();
1367 void clearAndKeep();
1369 void clearPartition(int partition);
1370 #ifndef NDEBUG
1371 void checkClear();
1374 void checkClean();
1375 #else
1376 inline void checkClear() {};
1377 inline void checkClean() {};
1378 #endif
1379 int scan(int partition, double tolerance = 0.0);
1384 void print() const;
1387
1391 void sort();
1393
1397 CoinPartitionedVector();
1399 CoinPartitionedVector(int size, const int *inds, const double *elems);
1401 CoinPartitionedVector(int size, const int *inds, double element);
1404 CoinPartitionedVector(int size, const double *elements);
1406 CoinPartitionedVector(int size);
1408 CoinPartitionedVector(const CoinPartitionedVector &);
1410 CoinPartitionedVector(const CoinPartitionedVector *);
1412 CoinPartitionedVector &operator=(const CoinPartitionedVector &);
1414 ~CoinPartitionedVector();
1416 protected:
1419 int startPartition_[COIN_PARTITIONS + 1];
1422 int numberElementsPartition_[COIN_PARTITIONS];
1424 int numberPartitions_;
1426 };
1427 inline double *roundUpDouble(double *address)
1428 {
1429 // align on 64 byte boundary
1430 CoinInt64 xx = reinterpret_cast< CoinInt64 >(address);
1431 int iBottom = static_cast< int >(xx & 63);
1432 if (iBottom)
1433 return address + ((64 - iBottom) >> 3);
1434 else
1435 return address;
1436 }
1437 #endif
CoinBigIndexArrayWithLength::array
CoinBigIndex * array() const
Get Array.
Definition: CoinIndexedVector.hpp:997
CoinPartitionedVector::getNumPartitions
int getNumPartitions() const
Get number of partitions.
Definition: CoinIndexedVector.hpp:1318
CoinHelperFunctions.hpp
CoinDoubleArrayWithLength::CoinDoubleArrayWithLength
CoinDoubleArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:716
CoinArrayWithLength::alignment_
int alignment_
Alignment wanted (power of 2)
Definition: CoinIndexedVector.hpp:673
CoinFactorizationLongDoubleArrayWithLength::CoinFactorizationLongDoubleArrayWithLength
CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:895
CoinVoidStarArrayWithLength
void * version
Definition: CoinIndexedVector.hpp:1140
CoinArbitraryArrayWithLength::CoinArbitraryArrayWithLength
CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:1284
CoinIndexedVector::sortPacked
void sortPacked()
CoinUnsignedIntArrayWithLength
unsigned int * version
Definition: CoinIndexedVector.hpp:1063
CoinPartitionedVector::setPartitions
void setPartitions(int number, const int *starts)
Setup partitions (needs end as well)
CoinIndexedVector::sortIncrIndex
void sortIncrIndex()
Definition: CoinIndexedVector.hpp:370
CoinFactorizationDoubleArrayWithLength::CoinFactorizationDoubleArrayWithLength
CoinFactorizationDoubleArrayWithLength(int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:808
CoinArrayWithLength
Pointer with length in bytes.
Definition: CoinIndexedVector.hpp:533
CoinIndexedVector::setVector
void setVector(int numberIndices, const int *inds, const double *elems)
Set vector numberIndices, indices, and elements.
CoinIndexedVector::quickAddNonZero
void quickAddNonZero(int index, double element)
Insert or if exists add an element into the vector Any resulting zero elements will be made tiny...
Definition: CoinIndexedVector.hpp:235
CoinUnsignedIntArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:1069
CoinIndexedVector::operator-
CoinIndexedVector operator-(const CoinIndexedVector &op2)
Return the difference of two indexed vectors.
CoinIntArrayWithLength::CoinIntArrayWithLength
CoinIntArrayWithLength(const CoinIntArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:967
CoinIndexedVector::reserve
void reserve(int n)
Reserve space.
CoinIndexedVector::setConstant
void setConstant(int size, const int *inds, double elems)
Elements set to have the same scalar value.
CoinPartitionedVector::clearAndReset
void clearAndReset()
Reset the vector (as if were just created an empty vector). Gets rid of partitions.
CoinUnsignedIntArrayWithLength::conditionalNew
unsigned int * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:1092
CoinFactorizationLongDoubleArrayWithLength::conditionalNew
long double * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:861
CoinVoidStarArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:1146
CoinIndexedVector::operator+=
void operator+=(double value)
add value to every entry
CoinPartitionedVector::getNumElements
int getNumElements() const
Get the size.
Definition: CoinIndexedVector.hpp:1323
CoinDoubleArrayWithLength
double * version
Definition: CoinIndexedVector.hpp:678
CoinIndexedVector::indices_
int * indices_
Vector indices.
Definition: CoinIndexedVector.hpp:496
CoinFactorizationLongDoubleArrayWithLength::CoinFactorizationLongDoubleArrayWithLength
CoinFactorizationLongDoubleArrayWithLength(const CoinFactorizationLongDoubleArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:890
CoinIndexedVector::copy
void copy(const CoinIndexedVector &rhs, double multiplier=1.0)
Copy the contents of one vector into another.
CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength
CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:1121
CoinArrayWithLength::clear
void clear()
Zero out array.
CoinIndexedVector::operator[]
double & operator[](int i) const
Access the i&#39;th element of the full storage vector.
CoinArbitraryArrayWithLength::CoinArbitraryArrayWithLength
CoinArbitraryArrayWithLength(int length, int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:1263
CoinFactorizationLongDoubleArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:838
CoinArrayWithLength::switchOff
void switchOff()
Set the size to -1.
Definition: CoinIndexedVector.hpp:586
CoinIndexedVector::setElement
void setElement(int index, double element)
Set an existing element in the indexed vector The first argument is the &quot;index&quot; into the elements() a...
CoinArrayWithLength::reallyFreeArray
void reallyFreeArray()
Really get rid of array with alignment.
CoinIndexedVector::offset_
int offset_
Offset to get where new allocated array.
Definition: CoinIndexedVector.hpp:504
CoinIndexedVector::sortDecrIndex
void sortDecrIndex()
CoinFactorizationLongDoubleArrayWithLength::array
long double * array() const
Get Array.
Definition: CoinIndexedVector.hpp:843
CoinIndexedVector::packedMode
bool packedMode() const
Gets packed mode.
Definition: CoinIndexedVector.hpp:446
CoinFactorizationDoubleArrayWithLength::CoinFactorizationDoubleArrayWithLength
CoinFactorizationDoubleArrayWithLength(int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:799
CoinUnsignedIntArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:1083
CoinArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:574
CoinPartitionedVector::numberPartitions_
int numberPartitions_
Number of partitions (0 means off)
Definition: CoinIndexedVector.hpp:1424
CoinIndexedVector::sortDecrElement
void sortDecrElement()
CoinIndexedVector::reallyClear
void reallyClear()
Clear even if in a bad way.
CoinUnsignedIntArrayWithLength::operator=
CoinUnsignedIntArrayWithLength & operator=(const CoinUnsignedIntArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:1131
CoinIndexedVector::add
void add(int index, double element)
Insert or if exists add an element into the vector Any resulting zero elements will be made tiny...
CoinArrayWithLength::setPersistence
void setPersistence(int flag, int currentLength)
Does what is needed to set persistence.
CoinArrayWithLength::getArray
void getArray(CoinBigIndex size)
Get array with alignment.
CoinIndexedVector::operator+
CoinIndexedVector operator+(const CoinIndexedVector &op2)
Return the sum of two indexed vectors.
CoinFactorizationDoubleArrayWithLength::conditionalNew
CoinFactorizationDouble * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:784
CoinFactorizationLongDoubleArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:852
CoinIndexedVector::checkClear
void checkClear()
For debug check vector is clear i.e. no elements.
CoinPartitionedVector::CoinPartitionedVector
CoinPartitionedVector()
Default constructor.
CoinIndexedVector::print
void print() const
Print out.
CoinIndexedVector::zero
void zero(int index)
Makes nonzero tiny.
Definition: CoinIndexedVector.hpp:253
CoinArbitraryArrayWithLength::operator=
CoinArbitraryArrayWithLength & operator=(const CoinArbitraryArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:1289
CoinPartitionedVector::~CoinPartitionedVector
~CoinPartitionedVector()
Destructor.
CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength
CoinBigIndexArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:1024
CoinArbitraryArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:1237
CoinArrayWithLength::capacity
CoinBigIndex capacity() const
Get the capacity (just read it)
Definition: CoinIndexedVector.hpp:554
CoinArrayWithLength::setCapacity
void setCapacity()
Set the capacity to &gt;=0 if &lt;=-2.
Definition: CoinIndexedVector.hpp:559
CoinIndexedVector::denseVector
double * denseVector() const
Get the vector as a dense vector.
Definition: CoinIndexedVector.hpp:121
CoinIndexedVector::operator!=
bool operator!=(const CoinPackedVectorBase &rhs) const
Not equal.
CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength
CoinUnsignedIntArrayWithLength(int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:1116
CoinIndexedVector::setPackedMode
void setPackedMode(bool yesNo)
Sets packed mode.
Definition: CoinIndexedVector.hpp:441
CoinIndexedVector::setIndexVector
void setIndexVector(int *array)
For very temporary use when user needs to borrow an index vector.
Definition: CoinIndexedVector.hpp:128
CoinIndexedVector::elements_
double * elements_
Vector elements.
Definition: CoinIndexedVector.hpp:498
CoinIndexedVector::packedMode_
bool packedMode_
If true then is operating in packed mode.
Definition: CoinIndexedVector.hpp:506
CoinIndexedVector::returnVector
void returnVector()
Return ownership of the arguments to this vector.
CoinArbitraryArrayWithLength::lengthInBytes_
CoinBigIndex lengthInBytes_
Length in bytes.
Definition: CoinIndexedVector.hpp:1300
CoinFinite.hpp
CoinFactorizationLongDoubleArrayWithLength::CoinFactorizationLongDoubleArrayWithLength
CoinFactorizationLongDoubleArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:870
CoinArrayWithLength::CoinArrayWithLength
CoinArrayWithLength(CoinBigIndex size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:629
COIN_PARTITIONS
#define COIN_PARTITIONS
Definition: CoinIndexedVector.hpp:1307
CoinPartitionedVector::reserve
void reserve(int n)
Reserve space.
CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength
CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:1049
CoinIndexedVector::operator*=
void operator*=(double value)
multiply every entry by value
CoinPartitionedVector::sort
void sort()
Sort the indexed storage vector (increasing indices).
COIN_DBL_MIN
const double COIN_DBL_MIN
Definition: CoinFinite.hpp:17
CoinArbitraryArrayWithLength::CoinArbitraryArrayWithLength
CoinArbitraryArrayWithLength(int length=1)
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:1256
CoinIndexedVector::nElements_
int nElements_
Size of indices and packed elements vectors.
Definition: CoinIndexedVector.hpp:500
CoinPackedVectorBase
Abstract base class for various sparse vectors.
Definition: CoinPackedVectorBase.hpp:23
CoinIndexedVector::setNumElements
void setNumElements(int value)
Set the size.
Definition: CoinIndexedVector.hpp:144
CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength
CoinUnsignedIntArrayWithLength(int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:1107
CoinIndexedVector::swap
void swap(int i, int j)
Swap values in positions i and j of indices and elements.
CoinIntArrayWithLength::CoinIntArrayWithLength
CoinIntArrayWithLength(const CoinIntArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:972
CoinIndexedVector::borrowVector
void borrowVector(int size, int numberIndices, int *inds, double *elems)
Borrow ownership of the arguments to this vector.
CoinPartitionedVector
Definition: CoinIndexedVector.hpp:1303
CoinIndexedVector::getNumElements
int getNumElements() const
Get the size.
Definition: CoinIndexedVector.hpp:111
CoinPartitionedVector::print
void print() const
Scan dense region from start to &lt; end and set up indices returns number found.
CoinIndexedVector::operator-=
void operator-=(double value)
subtract value from every entry
CoinIndexedVector::cleanAndPack
int cleanAndPack(double tolerance)
Same but packs down.
CoinFactorizationDoubleArrayWithLength::array
CoinFactorizationDouble * array() const
Get Array.
Definition: CoinIndexedVector.hpp:766
CoinFactorizationDoubleArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:761
CoinIndexedVector::~CoinIndexedVector
~CoinIndexedVector()
Destructor.
CoinSizeofAsInt
#define CoinSizeofAsInt(type)
Cube Root.
Definition: CoinHelperFunctions.hpp:1078
CoinFactorizationDouble
double CoinFactorizationDouble
Definition: CoinTypes.hpp:57
CoinVoidStarArrayWithLength::CoinVoidStarArrayWithLength
CoinVoidStarArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:1178
CoinIndexedVector::sortIncrElement
void sortIncrElement()
CoinArrayWithLength::array_
char * array_
Array.
Definition: CoinIndexedVector.hpp:667
CoinFactorizationDoubleArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:775
CoinPackedVectorBase.hpp
CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength
CoinBigIndexArrayWithLength(const CoinBigIndexArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:1044
CoinIntArrayWithLength::CoinIntArrayWithLength
CoinIntArrayWithLength(int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:953
CoinIndexedVector::getMaxIndex
int getMaxIndex() const
Get value of maximum index.
CoinArrayWithLength::swap
void swap(CoinArrayWithLength &other)
Swaps memory between two members.
CoinIndexedVector::expand
void expand()
This is mainly for testing - goes from packed to indexed.
CoinBigIndexArrayWithLength
CoinBigIndex * version.
Definition: CoinIndexedVector.hpp:986
CoinIndexedVector
Indexed Vector.
Definition: CoinIndexedVector.hpp:104
CoinIndexedVector::clean
int clean(double tolerance)
set all small values to zero and return number remaining
CoinFactorizationDoubleArrayWithLength::CoinFactorizationDoubleArrayWithLength
CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:813
CoinIndexedVector::scan
int scan()
Scan dense region and set up indices (returns number found)
CoinIntArrayWithLength::CoinIntArrayWithLength
CoinIntArrayWithLength(int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:962
CoinIndexedVector::capacity_
int capacity_
Amount of memory allocated for indices_, and elements_.
Definition: CoinIndexedVector.hpp:502
CoinVoidStarArrayWithLength::CoinVoidStarArrayWithLength
CoinVoidStarArrayWithLength(int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:1193
CoinFactorizationDoubleArrayWithLength::CoinFactorizationDoubleArrayWithLength
CoinFactorizationDoubleArrayWithLength(const CoinFactorizationDoubleArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:818
CoinArrayWithLength::operator=
CoinArrayWithLength & operator=(const CoinArrayWithLength &rhs)
Assignment operator.
CoinIndexedVector::createOneUnpackedElement
void createOneUnpackedElement(int index, double element)
Create unpacked singleton.
CoinIndexedVector::createUnpacked
void createUnpacked(int number, const int *indices, const double *elements)
Create unpacked array.
CoinDoubleArrayWithLength::CoinDoubleArrayWithLength
CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:741
CoinDoubleArrayWithLength::array
double * array() const
Get Array.
Definition: CoinIndexedVector.hpp:689
CoinIndexedVector::operator/
CoinIndexedVector operator/(const CoinIndexedVector &op2)
Return the element-wise ratio of two indexed vectors (0.0/0.0 =&gt; 0.0) (0 vanishes) ...
CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength
CoinUnsignedIntArrayWithLength(const CoinUnsignedIntArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:1126
CoinIntArrayWithLength::operator=
CoinIntArrayWithLength & operator=(const CoinIntArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:977
CoinIndexedVector::empty
void empty()
Reset the vector (as if were just created an empty vector)
CoinIndexedVector::getIndices
const int * getIndices() const
Get indices of elements.
Definition: CoinIndexedVector.hpp:113
CoinIndexedVector::gutsOfSetPackedVector
void gutsOfSetPackedVector(int size, int numberIndices, const int *inds, const double *elems)
CoinArrayWithLength::size_
CoinBigIndex size_
Size of array in bytes.
Definition: CoinIndexedVector.hpp:669
CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength
CoinBigIndexArrayWithLength(CoinBigIndex size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:1030
CoinIndexedVector::append
void append(const CoinPackedVectorBase &caboose)
Append a CoinPackedVector to the end.
CoinVoidStarArrayWithLength::CoinVoidStarArrayWithLength
CoinVoidStarArrayWithLength(int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:1184
CoinPartitionedVector::operator=
CoinPartitionedVector & operator=(const CoinPartitionedVector &)
Assignment operator.
CoinIndexedVector::gutsOfSetConstant
void gutsOfSetConstant(int size, const int *inds, double value)
CoinArbitraryArrayWithLength::array
void ** array() const
Get Array.
Definition: CoinIndexedVector.hpp:1228
CoinIntArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:915
CoinIndexedVector::setFull
void setFull(int size, const double *elems)
Indices are not specified and are taken to be 0,1,...,size-1.
CoinSort.hpp
CoinIndexedVector::sort
void sort()
Sort the indexed storage vector (increasing indices).
Definition: CoinIndexedVector.hpp:365
CoinFactorizationLongDoubleArrayWithLength::CoinFactorizationLongDoubleArrayWithLength
CoinFactorizationLongDoubleArrayWithLength(int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:885
CoinIndexedVector::gutsOfSetVector
void gutsOfSetVector(int size, const int *inds, const double *elems)
Copy internal data.
CoinIndexedVector::capacity
int capacity() const
capacity returns the size which could be accomodated without having to reallocate storage...
Definition: CoinIndexedVector.hpp:435
CoinVoidStarArrayWithLength::CoinVoidStarArrayWithLength
CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength *rhs)
Copy constructor.2.
Definition: CoinIndexedVector.hpp:1203
CoinArrayWithLength::CoinArrayWithLength
CoinArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:621
CoinPartitionedVector::checkClear
void checkClear()
For debug check vector is clear i.e. no elements.
CoinIntArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:929
CoinArbitraryArrayWithLength::conditionalNew
char * conditionalNew(CoinBigIndex length, CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:1246
CoinArrayWithLength::offset_
int offset_
Offset of array.
Definition: CoinIndexedVector.hpp:671
roundUpDouble
double * roundUpDouble(double *address)
Definition: CoinIndexedVector.hpp:1427
CoinArrayWithLength::getCapacity
void getCapacity(CoinBigIndex numberBytes, CoinBigIndex numberIfNeeded=-1)
Get enough space (if more needed then do at least needed)
CoinDoubleArrayWithLength::operator=
CoinDoubleArrayWithLength & operator=(const CoinDoubleArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:746
CoinIntArrayWithLength::CoinIntArrayWithLength
CoinIntArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:947
CoinPartitionedVector::clearAndKeep
void clearAndKeep()
Reset the vector (as if were just created an empty vector). Keeps partitions.
CoinIndexedVector::checkClean
void checkClean()
For debug check vector is clean i.e. elements match indices.
CoinDoubleArrayWithLength::CoinDoubleArrayWithLength
CoinDoubleArrayWithLength(int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:722
CoinBigIndexArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:992
CoinIndexedVectorUnitTest
void CoinIndexedVectorUnitTest()
A function that tests the methods in the CoinIndexedVector class.
CoinArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:539
CoinArrayWithLength::conditionalDelete
void conditionalDelete()
Conditionally deletes.
CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength
CoinBigIndexArrayWithLength(CoinBigIndex size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:1039
CoinFactorizationDoubleArrayWithLength::CoinFactorizationDoubleArrayWithLength
CoinFactorizationDoubleArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:793
CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength
CoinUnsignedIntArrayWithLength()
Default constructor - NULL.
Definition: CoinIndexedVector.hpp:1101
CoinUnsignedIntArrayWithLength::array
unsigned int * array() const
Get Array.
Definition: CoinIndexedVector.hpp:1074
CoinVoidStarArrayWithLength::conditionalNew
void ** conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:1169
CoinVoidStarArrayWithLength::operator=
CoinVoidStarArrayWithLength & operator=(const CoinVoidStarArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:1208
CoinIndexedVector::isApproximatelyEqual
int isApproximatelyEqual(const CoinIndexedVector &rhs, double tolerance=1.0e-8) const
Equal with a tolerance (returns -1 or position of inequality).
CoinBigIndexArrayWithLength::setSize
void setSize(CoinBigIndex value)
Set the size.
Definition: CoinIndexedVector.hpp:1006
CoinIndexedVector::quickInsert
void quickInsert(int index, double element)
Insert a nonzero element into the vector.
Definition: CoinIndexedVector.hpp:203
CoinArrayWithLength::switchOn
void switchOn(int alignment=3)
Set the size to -2 and alignment.
Definition: CoinIndexedVector.hpp:591
CoinFactorizationDoubleArrayWithLength
CoinFactorizationDouble * version.
Definition: CoinIndexedVector.hpp:755
CoinBigIndex
int CoinBigIndex
Definition: Coin_C_defines.h:136
CoinVoidStarArrayWithLength::array
void ** array() const
Get Array.
Definition: CoinIndexedVector.hpp:1151
CoinArrayWithLength::allocate
void allocate(const CoinArrayWithLength &rhs, CoinBigIndex numberBytes)
Assignment with length - does not copy.
CoinPartitionedVector::numberElementsPartition_
int numberElementsPartition_[COIN_PARTITIONS]
Size of indices in a partition.
Definition: CoinIndexedVector.hpp:1422
CoinArrayWithLength::conditionalNew
char * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
CoinVoidStarArrayWithLength::CoinVoidStarArrayWithLength
CoinVoidStarArrayWithLength(const CoinVoidStarArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:1198
CoinIndexedVector::setPacked
void setPacked()
Mark as packed.
Definition: CoinIndexedVector.hpp:266
CoinPartitionedVector::compact
void compact()
Add up number of elements in partitions and pack and get rid of partitions.
CoinInt64
#define CoinInt64
Definition: CoinTypes.hpp:18
CoinFactorizationLongDoubleArrayWithLength
CoinFactorizationLongDouble * version.
Definition: CoinIndexedVector.hpp:832
CoinFactorizationLongDoubleArrayWithLength::CoinFactorizationLongDoubleArrayWithLength
CoinFactorizationLongDoubleArrayWithLength(int size)
Alternate Constructor - length in bytes - size_ -1.
Definition: CoinIndexedVector.hpp:876
CoinArrayWithLength::~CoinArrayWithLength
~CoinArrayWithLength()
Destructor.
CoinIndexedVector::createPacked
void createPacked(int number, const int *indices, const double *elements)
Create packed array.
CoinPartitionedVector::setNumElementsPartition
void setNumElementsPartition(int partition, int value)
Set the size of a partition.
Definition: CoinIndexedVector.hpp:1343
CoinIntArrayWithLength::array
int * array() const
Get Array.
Definition: CoinIndexedVector.hpp:920
CoinPartitionedVector::startPartition_
int startPartition_[COIN_PARTITIONS+1]
Starts.
Definition: CoinIndexedVector.hpp:1420
CoinIndexedVector::getIndices
int * getIndices()
Get element values.
Definition: CoinIndexedVector.hpp:117
CoinArbitraryArrayWithLength::CoinArbitraryArrayWithLength
CoinArbitraryArrayWithLength(const CoinArbitraryArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:1279
CoinArrayWithLength::extend
void extend(int newSize)
Extend a persistent array keeping data (size in bytes)
CoinIntArrayWithLength::conditionalNew
int * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:938
CoinIndexedVector::CoinIndexedVector
CoinIndexedVector()
Default constructor.
CoinFactorizationDoubleArrayWithLength::operator=
CoinFactorizationDoubleArrayWithLength & operator=(const CoinFactorizationDoubleArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:823
CoinArrayWithLength::copy
void copy(const CoinArrayWithLength &rhs, int numberBytes=-1)
Assignment with length (if -1 use internal length)
CoinIndexedVector::cleanAndPackSafe
int cleanAndPackSafe(double tolerance)
Same but packs down and is safe (i.e. if order is odd)
CoinArbitraryArrayWithLength::CoinArbitraryArrayWithLength
CoinArbitraryArrayWithLength(int length, int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:1273
CoinIntArrayWithLength
int * version
Definition: CoinIndexedVector.hpp:909
CoinPartitionedVector::setTempNumElementsPartition
void setTempNumElementsPartition(int partition, int value)
Set the size of a partition (just for a tiny while)
Definition: CoinIndexedVector.hpp:1350
CoinDoubleArrayWithLength::conditionalNew
double * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:707
CoinPartitionedVector::startPartition
int startPartition(int partition) const
Get starts.
Definition: CoinIndexedVector.hpp:1325
CoinIndexedVector::getMinIndex
int getMinIndex() const
Get value of minimum index.
CoinDoubleArrayWithLength::CoinDoubleArrayWithLength
CoinDoubleArrayWithLength(int size, int mode)
Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed...
Definition: CoinIndexedVector.hpp:731
CoinArrayWithLength::rawSize
CoinBigIndex rawSize() const
Get the size.
Definition: CoinIndexedVector.hpp:544
CoinBigIndexArrayWithLength::operator=
CoinBigIndexArrayWithLength & operator=(const CoinBigIndexArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:1054
CoinArbitraryArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:1223
CoinIndexedVector::operator*
CoinIndexedVector operator*(const CoinIndexedVector &op2)
Return the element-wise product of two indexed vectors.
CoinIndexedVector::operator=
CoinIndexedVector & operator=(const CoinIndexedVector &)
Assignment operator.
CoinIndexedVector::quickAdd
void quickAdd(int index, double element)
Insert or if exists add an element into the vector Any resulting zero elements will be made tiny...
Definition: CoinIndexedVector.hpp:216
CoinFactorizationLongDoubleArrayWithLength::operator=
CoinFactorizationLongDoubleArrayWithLength & operator=(const CoinFactorizationLongDoubleArrayWithLength &rhs)
Assignment operator.
Definition: CoinIndexedVector.hpp:900
CoinIndexedVector::clear
void clear()
Reset the vector (as if were just created an empty vector). This leaves arrays!
CoinIndexedVector::setDenseVector
void setDenseVector(double *array)
For very temporary use when user needs to borrow a dense vector.
Definition: CoinIndexedVector.hpp:123
CoinIndexedVector::operator==
bool operator==(const CoinPackedVectorBase &rhs) const
Equal.
CoinPartitionedVector::computeNumberElements
void computeNumberElements()
Add up number of elements in partitions.
CoinIndexedVector::setCapacity
void setCapacity(int value)
Definition: CoinIndexedVector.hpp:436
CoinArbitraryArrayWithLength
arbitrary version
Definition: CoinIndexedVector.hpp:1217
CoinBigIndexArrayWithLength::conditionalNew
CoinBigIndex * conditionalNew(CoinBigIndex sizeWanted)
Conditionally gets new array.
Definition: CoinIndexedVector.hpp:1015
CoinArrayWithLength::array
const char * array() const
Get Array.
Definition: CoinIndexedVector.hpp:565
COIN_INDEXED_TINY_ELEMENT
#define COIN_INDEXED_TINY_ELEMENT
Definition: CoinIndexedVector.hpp:24
CoinIndexedVector::operator/=
void operator/=(double value)
divide every entry by value (** 0 vanishes)
CoinDoubleArrayWithLength::CoinDoubleArrayWithLength
CoinDoubleArrayWithLength(const CoinDoubleArrayWithLength &rhs)
Copy constructor.
Definition: CoinIndexedVector.hpp:736
CoinPartitionedVector::clearPartition
void clearPartition(int partition)
Clear a partition.
CoinIndexedVector::CoinIndexedVectorUnitTest
friend void CoinIndexedVectorUnitTest()
A function that tests the methods in the CoinIndexedVector class.
CoinPartitionedVector::checkClean
void checkClean()
For debug check vector is clean i.e. elements match indices.
CoinIndexedVector::insert
void insert(int index, double element)
Insert an element into the vector.
CoinPartitionedVector::startPartitions
const int * startPartitions() const
Get starts.
Definition: CoinIndexedVector.hpp:1331
CoinDoubleArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:698
CoinDoubleArrayWithLength::getSize
CoinBigIndex getSize() const
Get the size.
Definition: CoinIndexedVector.hpp:684
CoinArrayWithLength::switchedOn
bool switchedOn() const
See if persistence already on.
Definition: CoinIndexedVector.hpp:549
CoinIndexedVector::scanAndPack
int scanAndPack()
These are same but pack down.
CoinIndexedVector::truncate
void truncate(int newSize)
Throw away all entries in rows &gt;= newSize.
CoinVoidStarArrayWithLength::setSize
void setSize(int value)
Set the size.
Definition: CoinIndexedVector.hpp:1160