Xmipp  v3.23.11-Nereus
MultInd.h
Go to the documentation of this file.
1 /*
2 
3 CONDOR 1.06 - COnstrained, Non-linear, Direct, parallel Optimization
4  using trust Region method for high-computing load,
5  noisy functions
6 Copyright (C) 2004 Frank Vanden Berghen
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation version 2
11 of the License.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 
22 If you want to include this tools in any commercial product,
23 you can contact the author at fvandenb@iridia.ulb.ac.be
24 
25 */
26 
27 //
28 // class Multiindex
29 //
30 #ifndef _INCLUDE_MULTIND_H_
31 #define _INCLUDE_MULTIND_H_
32 
33 #include "VectorInt.h"
34 
35 class MultInd;
36 
37 class MultIndCache {
38  public:
39  MultIndCache();
40  ~MultIndCache();
41  MultInd *get(unsigned _dim, unsigned _deg);
42  private:
43  MultInd *head;
44 };
45 
46 #ifndef __INSIDE_MULTIND_CPP__
48 #endif
49 
50 class MultInd {
51 friend class MultIndCache;
52 public:
53  unsigned dim, deg;
54 
55  unsigned *lastChanges();
56  unsigned *indexesOfCoefInLexOrder();
57 
58  MultInd(unsigned d=0);
59  ~MultInd();
60 
61  void resetCounter();
62  MultInd& operator++(); // prefix
63  MultInd& operator++( int ) { return this->operator++(); } // postfix
64 // unsigned &operator[]( unsigned i) {return coeffDeg[i];};
65  inline operator unsigned*() const { return coeffDeg; };
66  MultInd& operator=( const MultInd &P );
67  bool operator==( const MultInd& m );
68  unsigned index() {return indexV;};
69  unsigned len();
70 
71  // Print it
72  void print();
73 
74 private:
75  MultInd( unsigned _dim, unsigned _deg );
76  void fullInit();
77  void standardInit();
78 
79  VectorInt lastChangesV, indexesOfCoefInLexOrderV;
80  unsigned *coeffDeg, *coeffLex, indexV;
81 
82  static unsigned *buffer, maxDim;
83  // to do the cache:
84  MultInd *next;
85 };
86 
87 
88 #endif
bool operator==(faketype, faketype)
Definition: gtest.h:1366
HBITMAP buffer
Definition: svm-toy.cpp:37
doublereal * d
MultIndCache cacheMultInd
Definition: MultInd.cpp:42
int m
unsigned index()
Definition: MultInd.h:68
#define len
unsigned dim
Definition: MultInd.h:53
MultInd & operator++(int)
Definition: MultInd.h:63