All Classes Namespaces Files Functions Variables Typedefs Macros
clizFunctions.h
Go to the documentation of this file.
1 // clizFunctions.h - ClusterLizard helper functions header file
2 
3 // Copyright (C) 2013, 2014 Simeon Knieling, M.Sc.
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 //
9 
10 // These are internal helper functions used in the ClusterLizard library
11 
12 #pragma once
13 #ifndef _INCLUDE_CLIZFUNCTIONS
14 #define _INCLUDE_CLIZFUNCTIONS
15 
16 #include "clizThirdParty.h"
17 
18 #include <malloc.h>
19 
20 #define CHKHEAP() (check_heap(__FILE__, __LINE__))
21 
22 void check_heap(char *file, int line);
23 
24 //Required precision when comparing float values
25 #define FLOATIFPRECISION 0.000001f
26 //Some big values
27 #define BIGFLOATVALUE 4294967269.0f
28 #define BIGINTVALUE 4294967269
29 //Element swaping required for clMedian
30 #define ELEM_SWAP(a,b) { register float t=(a);(a)=(b);(b)=t; }
31 #define ELEM_SWAPUI(a,b) { unsigned int t=(a);(a)=(b);(b)=t; }
32 //Element swaping required for clSort
33 #define SWAP(a,b) temp=(a);(a)=(b);(b)=temp;
34 #define SWAPUI(a,b) temp2=(a);(a)=(b);(b)=temp2;
35 #define SWAPFFT(a,b) tempr = (a); (a) = (b); (b) = tempr
36 //Required for clSort: If an unsorted subarray has less elements than M, it will be sorted using straight insertion
37 #define M 7
38 #define SQR(x) ((x)*(x))
39 
40 
41 typedef boost::thread Thread;
42 typedef boost::mutex Mutex;
43 typedef boost::condition_variable ConVar;
44 typedef boost::mutex::scoped_lock Lock;
45 typedef boost::unique_lock< boost::shared_mutex > Writelock;
46 typedef boost::shared_lock< boost::shared_mutex > Readlock;
47 
48 
50 //Memory Manager, SK
52 
53 //BOOST thread library for multi-threading
54 #include <boost\thread.hpp>
55 
56 //Mutex locks
57 typedef boost::mutex::scoped_lock locktype;
58 typedef boost::unique_lock< boost::shared_mutex > writelocktype;
59 typedef boost::shared_lock< boost::shared_mutex > readlocktype;
60 
61 typedef int memInt;
62 typedef unsigned int memUInt;
63 typedef float memFloat;
64 typedef double memDouble;
65 typedef void memPtr;
66 typedef bool memBool;
67 typedef unsigned short memShort;
68 typedef unsigned char memByte;
69 typedef unsigned short memAdrType;
70 
71 const memShort MAXPOOLS = 2048;
72 const memShort NUMMEMMAN = 4;
74 const memUInt MEMSIZE[22] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152 };
75 const memUInt POOLCAPACITY[22] = { 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 128, 128, 64, 64, 32, 16, 8, 4, 2 };
76 const memShort METASIZE = sizeof(memAdrType);
77 
78 /*
79 In order to optimize performance, I can't search for fragments that are long enough or defragment released memory.
80 So the fastest way is that each chunk of memory has the same size and I just return a pointer to the next free chunk.
81 However, this would mean that I waste a lot of memory if only a few bytes are requested and that I can't fulfil requests of memory
82 that are bigger than my memory chunk. Thus I need chunks in different sizes. So I decided to make a pool for each size consisting of a certain number of
83 chunks. Now what if the pool is not big enough. What if more chunks of that size will be requested before some of them are released? So it should be
84 possible to add pools of a particular size if necessary. But what if I have a multi threaded program and both threads do frequent
85 memory allocation and deallocation. I can't afford to wait until the memory manager is free. Therefore, the global memory manager will have a number of
86 memory mangers and a manager that is currently free will be choosen to process the request.
87 
88 Based on these thoughts I came up with the following structure:
89 
90 GlobalMemMan (1)-> MemMan[NUMMEMMAN] (for each MemMan)-> SizedMemPool[NUMSIZES] (for each size)-> MemPool[1-MAXPOOLS] (for each MemPool)-> [startAddress, size, capacity, bitArray]
91 
92 Now to release memory again, I need to know where it came from. However, only the pointer to the first element is returned upon free or delete.
93 A solution is to actually allocate 8 Bytes more for each memory chunk (4 * short) and return a pointer to byte position 9. This way, when
94 a pointer is received by delete, it knows that 8 bytes before that memory, there is the ID of the Memory Manager used, 6 bytes before, there is the
95 ID of the Size used, 4 bytes before there is the ID of the Pool of that size used and 2 bytes before, there is the position within this pool that
96 needs to be released now.
97 
98 */
99 class MemPool
100 {
101 public:
109  MemPool(memInt iSize, memInt iCapacity)
110  {
111  size = iSize + 4 * METASIZE;
112  capacity = iCapacity;
113  numFree = iCapacity;
114  nextFreePos = 0;
115  startAddress = malloc(size*capacity);
116  while (!startAddress)
117  {
118  startAddress = malloc(size*capacity);
119  }
120  //std::cout << "Adrr" << startAddress << std::endl;
121  bitArray = (memBool*)calloc(capacity, 1);
122  while (!bitArray)
123  {
124  bitArray = (memBool*)calloc(capacity, 1);
125  }
126  };
127  inline memPtr* allocate()
128  {
129  for (int i = nextFreePos+1; i < capacity; i++)
130  {
131  if (!bitArray[i])
132  {
133  bitArray[nextFreePos] = 1;
134  numFree--;
135  memPtr* memAdr = (memByte*)startAddress + nextFreePos*size;
136  //std::cout << startAddress << " " << nextFreePos << " " << size << " " << i << " " << numFree << std::endl;
137  ((memAdrType*)memAdr)[3] = (memAdrType)nextFreePos;
138  nextFreePos = i;
139  return memAdr;
140  }
141  }
142  for (int i = 0; i < nextFreePos; i++)
143  {
144  if (!bitArray[i])
145  {
146  bitArray[nextFreePos] = 1;
147  numFree--;
148  memPtr* memAdr = (memByte*)startAddress + nextFreePos*size;
149  //std::cout << startAddress << " " << nextFreePos << " " << size << " " << i << " " << numFree << std::endl;
150  ((memAdrType*)memAdr)[3] = (memAdrType)nextFreePos;
151  nextFreePos = i;
152  return memAdr;
153  }
154  }
155  if (numFree < 1)
156  {
157  return NULL;
158  }
159  //std::cout << "PROBLEM INCOMMING!!!" << std::endl;
160  if (bitArray[nextFreePos])
161  {
162  //std::cout << "WTF THIS SHOULD NOT HAPPEN!" << std::endl;
163  //getchar();
164  }
165  numFree--;
166  //std::cout << startAddress << " " << nextFreePos << " " << size << " " << numFree << std::endl;
167  bitArray[nextFreePos] = 1;
168  memPtr* memAdr = (memByte*)startAddress + nextFreePos*size;
169  ((memAdrType*)memAdr)[3] = (memAdrType)nextFreePos;
170  nextFreePos = -1;
171  return memAdr;
172  }
173  inline void free(memPtr* memAdr)
174  {
175  memAdrType* adrPos = (memAdrType*)memAdr - 1;
176  memAdrType freePos = (*adrPos);
177  bitArray[freePos] = 0;
178  nextFreePos = freePos;
179  numFree++;
180  //std::cout << startAddress << " " << nextFreePos << " " << size << " " << numFree << std::endl;
181  };
183  {
184  ::free(startAddress);
185  ::free(bitArray);
186  };
187 };
188 
190 {
191 public:
197  SizedMemPool(memInt iSize, memInt iPoolCapacity)
198  {
199  size = iSize;
200  poolCapacity = iPoolCapacity;
201  numPools = 1;
202  poolInUse = 0;
203  pool = (MemPool*)malloc(sizeof(MemPool)*MAXPOOLS);
204  new(&pool[0]) MemPool(size, poolCapacity);
205  };
206  inline memPtr* allocate()
207  {
208  if (pool[poolInUse].numFree > 0)
209  {
210  memPtr* memAdr = pool[poolInUse].allocate();
211  ((memAdrType*)memAdr)[2] = (memAdrType)poolInUse;
212  return memAdr;
213  }
214  memInt oldPoolInUse = poolInUse;
215  for (int i = poolInUse+1; i < numPools; i++)
216  {
217  if (pool[i].numFree > 0)
218  {
219  poolInUse = i;
220  memPtr* memAdr = pool[poolInUse].allocate();
221  ((memAdrType*)memAdr)[2] = (memAdrType)poolInUse;
222  return memAdr;
223  }
224  }
225  for (int i = 0; i < poolInUse; i++)
226  {
227  if (pool[i].numFree > 0)
228  {
229  poolInUse = i;
230  memPtr* memAdr = pool[poolInUse].allocate();
231  ((memAdrType*)memAdr)[2] = (memAdrType)poolInUse;
232  return memAdr;
233  }
234  }
235  //CHKHEAP();
236  //std::cout << numPools << std::endl;
237  this->spawnNewPool();
238  //Was ist wenn max pool erreicht ist!?
239  memPtr* memAdr = pool[poolInUse].allocate();
240  ((memAdrType*)memAdr)[2] = (memAdrType)poolInUse;
241  return memAdr;
242  }
243  inline void free(memPtr* memAdr)
244  {
245  memAdrType* adrPool = (memAdrType*)memAdr - 2;
246  memAdrType freePool = (*adrPool);
247  pool[freePool].free(memAdr);
248  };
249  inline void spawnNewPool()
250  {
251  if (numPools < MAXPOOLS)
252  {
253  new(&(pool[numPools])) MemPool(size, poolCapacity);
254  poolInUse = numPools++;
255  }
256  //std::cout << size << " " << numPools << " " << MAXPOOLS << std::endl;
257  };
259  {
260  for (int i = 0; i < numPools; i++)
261  {
262  pool[i].~MemPool();
263  }
264  ::free(pool);
265  };
266 };
267 
269 {
270 public:
274  {
275  isFree = 1;
276  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*MEMSIZECOUNT);
277  while (!sizedPools)
278  {
279  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*MEMSIZECOUNT);
280  }
281  for (int i = 0; i < MEMSIZECOUNT; i++)
282  {
283  new(&sizedPools[i]) SizedMemPool(MEMSIZE[i], POOLCAPACITY[i]);
284  }
285  };
286  MemoryManager(int memSizes)
287  {
288  isFree = 1;
289  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*memSizes);
290  while (!sizedPools)
291  {
292  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*memSizes);
293  }
294  for (int i = 0; i < memSizes; i++)
295  {
296  new(&sizedPools[i]) SizedMemPool(MEMSIZE[i], POOLCAPACITY[i]);
297  }
298  };
300  {
301  for (int i = 0; i < MEMSIZECOUNT; i++)
302  {
303  sizedPools[i].~SizedMemPool();
304  }
305  ::free(sizedPools);
306  };
307  inline memPtr* allocate(size_t numBytes)
308  {
309  for (int i = 0; i < MEMSIZECOUNT; i++)
310  {
311  if (numBytes < MEMSIZE[i])
312  {
313  memPtr* memAdr = sizedPools[i].allocate();
314  ((memAdrType*)memAdr)[1] = (memAdrType)i;
315  memAdr = (memByte*)memAdr + 4 * METASIZE;
316  return memAdr;
317  }
318  }
319 
320  std::cout << "malloc" << std::endl;
321 
322  memPtr* memAdr = malloc(numBytes + 4 * METASIZE);
323  while (!memAdr)
324  {
325  memAdr = malloc(numBytes + 4 * METASIZE);
326  }
327  ((memAdrType*)memAdr)[1] = (memAdrType)MEMSIZECOUNT;
328  memAdr = (memByte*)memAdr + 4 * METASIZE;
329  return memAdr;
330  };
331  inline void free(memPtr* memAdr)
332  {
333  memAdrType* adrSizePool = (memAdrType*)memAdr - 3;
334  memAdrType freeSizePool = (*adrSizePool);
335  if (freeSizePool < MEMSIZECOUNT)
336  {
337  sizedPools[freeSizePool].free(memAdr);
338  }
339  else
340  {
341  //std::cout << "free" << std::endl;
342  memAdr = (memByte*)memAdr - 4 * METASIZE;
343  //std::cout << memAdr << std::endl;
344  ::free(memAdr);
345  }
346  };
347 };
348 
350 {
351 public:
355  {
356  isFree = 1;
357  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*MEMSIZECOUNT);
358  while (!sizedPools)
359  {
360  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*MEMSIZECOUNT);
361  }
362  for (int i = 0; i < MEMSIZECOUNT; i++)
363  {
364  new(&sizedPools[i]) SizedMemPool(MEMSIZE[i], POOLCAPACITY[i]);
365  }
366  };
367  MemoryManagerPart(int memSizes)
368  {
369  isFree = 1;
370  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*memSizes);
371  while (!sizedPools)
372  {
373  sizedPools = (SizedMemPool*)malloc(sizeof(SizedMemPool)*memSizes);
374  }
375  for (int i = 0; i < memSizes; i++)
376  {
377  new(&sizedPools[i]) SizedMemPool(MEMSIZE[i], POOLCAPACITY[i]);
378  }
379  };
381  {
382  for (int i = 0; i < MEMSIZECOUNT; i++)
383  {
384  sizedPools[i].~SizedMemPool();
385  }
386  ::free(sizedPools);
387  };
388  inline memPtr* allocate(size_t numBytes)
389  {
390  for (int i = 0; i < MEMSIZECOUNT; i++)
391  {
392  if (numBytes < MEMSIZE[i])
393  {
394  memPtr* memAdr = sizedPools[i].allocate();
395  ((memAdrType*)memAdr)[1] = (memAdrType)i;
396  return memAdr;
397  }
398  }
399 
400  std::cout << "malloc" << std::endl;
401 
402  memPtr* memAdr = malloc(numBytes + 4 * METASIZE);
403  while (!memAdr)
404  {
405  memAdr = malloc(numBytes + 4 * METASIZE);
406  }
407  ((memAdrType*)memAdr)[1] = (memAdrType)MEMSIZECOUNT;
408  memAdr = (memByte*)memAdr + 4 * METASIZE;
409  return memAdr;
410  };
411  inline void free(memPtr* memAdr)
412  {
413  memAdrType* adrSizePool = (memAdrType*)memAdr - 3;
414  memAdrType freeSizePool = (*adrSizePool);
415  if (freeSizePool < MEMSIZECOUNT)
416  {
417  sizedPools[freeSizePool].free(memAdr);
418  }
419  else
420  {
421  //std::cout << "free" << std::endl;
422  memAdr = (memByte*)memAdr - 4 * METASIZE;
423  //std::cout << memAdr << std::endl;
424  ::free(memAdr);
425  }
426  };
427 };
428 
430 {
431 public:
432  boost::mutex memManMutex;
435  {
436  memMan = (MemoryManagerPart*)malloc(NUMMEMMAN*sizeof(MemoryManagerPart));
437  while (!memMan)
438  {
439  memMan = (MemoryManagerPart*)malloc(NUMMEMMAN*sizeof(MemoryManagerPart));
440  }
441  for (int i = 0; i < NUMMEMMAN; i++)
442  {
443  new(&memMan[i]) MemoryManagerPart();
444  }
445  //CHKHEAP();
446  }
447  inline memPtr* allocate(size_t numBytes)
448  {
449  memShort memManInUse = 0;
450  while (!memManMutex.try_lock());
451  for (int i = 0; i < NUMMEMMAN; i++)
452  {
453  if (memMan[i].isFree == 1)
454  {
455  memManInUse = i;
456  memMan[i].isFree = 0;
457  break;
458  }
459  else if (i == NUMMEMMAN - 1)
460  {
461  //All Busy
462  i = 0;
463  }
464  }
465 
466  //lockProtection.unlock();
467  //std::cout << "#";
468 
469  //CHKHEAP();
470  //std::cout << numBytes << std::endl;
471  memPtr* memAdr = memMan[memManInUse].allocate(numBytes);
472  memManMutex.unlock();
473  ((memAdrType*)memAdr)[0] = (memAdrType)memManInUse;
474  memAdr = (memByte*)memAdr + 4 * METASIZE;
475  memMan[memManInUse].isFree = 1;
476  //CHKHEAP();
477  //memManMutex.unlock();
478  return memAdr;
479  }
480  inline void free(memPtr* memAdr)
481  {
482 
483  //CHKHEAP();
484  memAdrType* adrMemMan = (memAdrType*)memAdr - 4;
485  memAdrType freeMemMan = (*adrMemMan);
486  while (!memManMutex.try_lock());
487  memMan[freeMemMan].free(memAdr);
488  //CHKHEAP();
489  memManMutex.unlock();
490  };
491 };
492 
494 
495 
496 
503 int clBinomial(int n, int k);
504 
509 float clSign(float x);
510 
516 int clMax(int a, int b);
517 
522 void clSort(float vec[], int n);
523 
528 void clSort(unsigned int vec[], int n);
529 
536 void clSortTwo(unsigned int vec[], unsigned int vec2[], int n);
537 
544 void clSortTwo(float vec[], float vec2[], int n);
545 
552 void clSortTwo(float vec[], unsigned int vec2[], int n);
553 
559 float clMedian(float vec[], int n);
560 
566 float clMedian(unsigned int vec[], int n);
567 
572 float clMean(float arr[], uint32_t n);
573 
578 double clMean(double arr[], uint32_t n);
579 
584 float clStd(float arr[], uint32_t n);
585 
591 inline float clStdWithMean(float arr[], uint32_t n, float mean);
592 
597 float *clAbs(float arr[], uint32_t n);
598 
604 uint32_t clMaxIndex(float arr[], uint32_t begin, uint32_t end);
605 
611 uint32_t clMaxAbsIndex(float arr[], uint32_t begin, uint32_t end);
612 
618 uint32_t clMinIndex(float arr[], uint32_t begin, uint32_t end);
619 
623 inline float clErfc(float x);
624 
630 float clKSTest(float arr[], uint32_t n, MemoryManager &memMan);
631 
638 void clFindHighestIndices(float arr[], uint32_t n, uint32_t output[], uint32_t numindices, MemoryManager &memMan);
639 
646 void clFindLowestIndices(float arr[], uint32_t n, uint32_t output[], uint32_t numindices, MemoryManager &memMan);
647 
648 
659 void clSplineGetY2(float y[], int n, float y2[], MemoryManager &memMan);
660 
671 float clSplineInterp(float y[], float y2[], float x);
672 
673 
681 void clHaarWaveDecWithOffset(float spikes[], unsigned int size, uint8_t scales, float output[], uint32_t offset, MemoryManager &memMan);
682 
690 void clXCorr(float *X, float *Y, unsigned int n, int maxshift, float *&output, MemoryManager &memMan);
691 
699 void clXCorr(double *X, double *Y, unsigned int n, int maxshift, double *&output, MemoryManager &memMan);
700 
701 #endif
void free(memPtr *memAdr)
Definition: clizFunctions.h:173
Definition: clizFunctions.h:429
memPtr * allocate(size_t numBytes)
Definition: clizFunctions.h:388
void clHaarWaveDecWithOffset(float spikes[], unsigned int size, uint8_t scales, float output[], uint32_t offset, MemoryManager &memMan)
Definition: clizFunctions.cpp:1195
const memShort METASIZE
Definition: clizFunctions.h:76
memInt poolInUse
Definition: clizFunctions.h:196
void spawnNewPool()
Definition: clizFunctions.h:249
memPtr * allocate()
Definition: clizFunctions.h:206
SizedMemPool * sizedPools
Definition: clizFunctions.h:272
const memUInt POOLCAPACITY[22]
Definition: clizFunctions.h:75
void clSplineGetY2(float y[], int n, float y2[], MemoryManager &memMan)
Definition: clizFunctions.cpp:1142
unsigned char memByte
Definition: clizFunctions.h:68
MemoryManager()
Definition: clizFunctions.h:273
memBool isFree
Definition: clizFunctions.h:271
memInt numFree
Definition: clizFunctions.h:105
~MemPool()
Definition: clizFunctions.h:182
void free(memPtr *memAdr)
Definition: clizFunctions.h:243
uint32_t clMaxAbsIndex(float arr[], uint32_t begin, uint32_t end)
Definition: clizFunctions.cpp:894
float clStd(float arr[], uint32_t n)
Definition: clizFunctions.cpp:827
void clXCorr(float *X, float *Y, unsigned int n, int maxshift, float *&output, MemoryManager &memMan)
Definition: clizFunctions.cpp:1241
memInt poolCapacity
Definition: clizFunctions.h:195
boost::unique_lock< boost::shared_mutex > writelocktype
Definition: clizFunctions.h:58
~SizedMemPool()
Definition: clizFunctions.h:258
double memDouble
Definition: clizFunctions.h:64
memInt getNextFreePos()
float memFloat
Definition: clizFunctions.h:63
unsigned int memUInt
Definition: clizFunctions.h:62
boost::thread Thread
Definition: clizFunctions.h:41
memInt numPools
Definition: clizFunctions.h:194
Definition: clizFunctions.h:99
bool memBool
Definition: clizFunctions.h:66
~MemoryManagerPart()
Definition: clizFunctions.h:380
int clBinomial(int n, int k)
Definition: clizFunctions.cpp:42
uint32_t clMinIndex(float arr[], uint32_t begin, uint32_t end)
Definition: clizFunctions.cpp:914
void clSortTwo(unsigned int vec[], unsigned int vec2[], int n)
Definition: clizFunctions.cpp:298
boost::shared_lock< boost::shared_mutex > Readlock
Definition: clizFunctions.h:46
void free(memPtr *memAdr)
Definition: clizFunctions.h:411
memInt size
Definition: clizFunctions.h:102
const memShort MEMSIZECOUNT
Definition: clizFunctions.h:73
SizedMemPool(memInt iSize, memInt iPoolCapacity)
Definition: clizFunctions.h:197
Definition: clizFunctions.h:268
void free(memPtr *memAdr)
Definition: clizFunctions.h:480
MemoryManagerPart * memMan
Definition: clizFunctions.h:433
GlobalMemoryManager()
Definition: clizFunctions.h:434
SizedMemPool * sizedPools
Definition: clizFunctions.h:353
memPtr * allocate(size_t numBytes)
Definition: clizFunctions.h:307
unsigned short memShort
Definition: clizFunctions.h:67
MemPool * pool
Definition: clizFunctions.h:192
int memInt
Definition: clizFunctions.h:61
boost::unique_lock< boost::shared_mutex > Writelock
Definition: clizFunctions.h:45
unsigned short memAdrType
Definition: clizFunctions.h:69
boost::mutex::scoped_lock Lock
Definition: clizFunctions.h:44
void clFindHighestIndices(float arr[], uint32_t n, uint32_t output[], uint32_t numindices, MemoryManager &memMan)
Definition: clizFunctions.cpp:1070
void free(memPtr *memAdr)
Definition: clizFunctions.h:331
memBool isFree
Definition: clizFunctions.h:352
int clMax(int a, int b)
Definition: clizFunctions.cpp:78
memPtr * allocate(size_t numBytes)
Definition: clizFunctions.h:447
void check_heap(char *file, int line)
Definition: clizFunctions.cpp:16
float clMedian(float vec[], int n)
Definition: clizFunctions.cpp:642
memPtr * startAddress
Definition: clizFunctions.h:103
float * clAbs(float arr[], uint32_t n)
Definition: clizFunctions.cpp:857
uint32_t clMaxIndex(float arr[], uint32_t begin, uint32_t end)
Definition: clizFunctions.cpp:874
const memUInt MEMSIZE[22]
Definition: clizFunctions.h:74
boost::mutex::scoped_lock locktype
Definition: clizFunctions.h:57
float clSplineInterp(float y[], float y2[], float x)
Definition: clizFunctions.cpp:1175
float clKSTest(float arr[], uint32_t n, MemoryManager &memMan)
Definition: clizFunctions.cpp:999
MemoryManagerPart(int memSizes)
Definition: clizFunctions.h:367
Definition: clizFunctions.h:189
void clFindLowestIndices(float arr[], uint32_t n, uint32_t output[], uint32_t numindices, MemoryManager &memMan)
Definition: clizFunctions.cpp:1104
memInt nextFreePos
Definition: clizFunctions.h:107
memBool * bitArray
Definition: clizFunctions.h:106
GlobalMemoryManager gMemMan
Definition: clizFunctions.cpp:14
float clStdWithMean(float arr[], uint32_t n, float mean)
Definition: clizFunctions.cpp:843
boost::shared_lock< boost::shared_mutex > readlocktype
Definition: clizFunctions.h:59
memInt capacity
Definition: clizFunctions.h:104
boost::mutex Mutex
Definition: clizFunctions.h:42
void clSort(float vec[], int n)
Definition: clizFunctions.cpp:92
memInt size
Definition: clizFunctions.h:193
const memShort MAXPOOLS
Definition: clizFunctions.h:71
~MemoryManager()
Definition: clizFunctions.h:299
MemoryManagerPart()
Definition: clizFunctions.h:354
const memShort NUMMEMMAN
Definition: clizFunctions.h:72
float clMean(float arr[], uint32_t n)
Definition: clizFunctions.cpp:799
float clSign(float x)
Definition: clizFunctions.cpp:61
boost::condition_variable ConVar
Definition: clizFunctions.h:43
boost::mutex memManMutex
Definition: clizFunctions.h:432
MemPool(memInt iSize, memInt iCapacity)
Definition: clizFunctions.h:109
void memPtr
Definition: clizFunctions.h:65
float clErfc(float x)
Definition: clizFunctions.h:349
memPtr * allocate()
Definition: clizFunctions.h:127
MemoryManager(int memSizes)
Definition: clizFunctions.h:286