Changeset 1130 for cpp/frams/model
- Timestamp:
- 04/16/21 15:55:34 (4 years ago)
- Location:
- cpp/frams/model
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/autoname.cpp
r973 r1130 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-202 0Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2021 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 5 5 #include "autoname.h" 6 #include "common/nonstd_stl.h"6 #include <algorithm> 7 7 #include <ctype.h> 8 8 … … 100 100 if (model.getPartCount() > 0) 101 101 { 102 cialo = min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1);102 cialo = std::min((int)(sqrt(double(model.getPartCount()) - 1) * NAME_BODYLEN), NAME_MAXLENBODY - 1); 103 103 poz = 0; 104 104 for (i = 0; i <= cialo; i++) // budowanie "opisu" ciala … … 106 106 nextpoz = ((model.getPartCount()) * (i + 1)) / (cialo + 1) - 1; 107 107 w = 1.0; 108 for (; poz <= nextpoz; poz++) w = max(w, model.getPart(poz)->mass);109 tmpc[i] = Sp[ min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)];108 for (; poz <= nextpoz; poz++) w = std::max(w, model.getPart(poz)->mass); 109 tmpc[i] = Sp[std::min(int((w - 1.0) * NAME_BODYMASS), int(sizeof(Sp)) - 2)]; 110 110 } 111 111 tmpc[i] = 0; … … 117 117 if (model.getNeuroCount() > 0) 118 118 { 119 mozg = min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1);119 mozg = std::min((int)(sqrt((double)model.getNeuroCount()) * NAME_BRAINLEN), NAME_MAXLENBRAIN - 1); 120 120 poz = 0; 121 121 for (i = 0; i <= mozg; i++) // budowanie "opisu" mozgu … … 123 123 nextpoz = (model.getNeuroCount() * (i + 1)) / (mozg + 1) - 1; 124 124 wint = 0; 125 for (; poz <= nextpoz; poz++) wint = max(wint, model.getNeuro(poz)->getInputCount());126 tmpm[i] = Sam[ min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)];125 for (; poz <= nextpoz; poz++) wint = std::max(wint, model.getNeuro(poz)->getInputCount()); 126 tmpm[i] = Sam[std::min(int(wint * NAME_BRAININP), int(sizeof(Sam)) - 2)]; 127 127 } 128 128 tmpm[i] = 0; -
cpp/frams/model/model.h
r1118 r1130 13 13 #include <frams/util/advlist.h> 14 14 #include <frams/util/usertags.h> 15 #include <common/nonstd_stl.h> 15 16 16 17 extern ParamEntry f0_model_paramtab[]; -
cpp/frams/model/similarity/EMD/emd.c
r1064 r1130 19 19 #include <stdlib.h> 20 20 #include <math.h> 21 #include <algorithm> 21 22 22 23 #include "emd.h" … … 100 101 { 101 102 int itr; 102 int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.103 int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have. 103 104 double totalCost; 104 105 float w; … … 211 212 { 212 213 int i, j; 213 int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.214 int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have. 214 215 double sSum, dSum, diff; 215 216 feature_t *P1, *P2; … … 474 475 { 475 476 int i, j, k; 476 int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.477 int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have. 477 478 double xMin; 478 479 int steps; … … 555 556 { 556 557 int i, steps; 557 int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.558 int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have. 558 559 node2_t **CurX, *NewX; 559 560 char *IsUsed=new char[2*max_n]; … … 652 653 { 653 654 int i, j, found, minI, minJ; 654 int max_n = max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have.655 int max_n = std::max(_n1, _n2); //max_n was introduced in r1062 instead of the #defined constant MAX_SIG_SIZE1=1000 in the original implementation. max_n is better than the constant, but it would be even better to use either _n1 or _n2, if we only knew what size each individual array should precisely have. 655 656 double deltaMin, oldVal, diff; 656 657 double** Delta = new double*[_n1]; -
cpp/frams/model/similarity/measure-distribution.cpp
r1125 r1130 79 79 //int size = sampled.getPartCount(); 80 80 //if (size < (int) sqrt((double) std::numeric_limits<int>::max())) //prevent exceeding int limits 81 // samples_taken = min(samples_num, size*size);81 // samples_taken = std::min(samples_num, size*size); 82 82 83 83 rndgen.seed(55); //For determinism. Otherwise the descriptors (that choose samples pseudo-randomly) for the same Model can yield different values and so the dissimilarity between the object and its copy will not be 0.
Note: See TracChangeset
for help on using the changeset viewer.