- Timestamp:
- 05/24/15 21:01:18 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/similarity/SVD/lapack.cpp
r368 r388 47 47 * AutoBuffer from https://github.com/Itseez/opencv/blob/master/modules/core/include/opencv2/core/utility.hpp 48 48 * VBLAS, JacobiSVDImpl_ from https://github.com/Itseez/opencv/blob/master/modules/core/src/lapack.cpp 49 * changes: 50 * - "RNG rng(0x12345678)" replaced with "srand(time(NULL))" 51 * - "rng.next()" replaced with "rand()" 52 * MK, 04.2015: 53 * - commented out "srand(time(NULL))" - this line would affect everything else that uses the standard global r.n.g., and would introduce uncontrolled indeterminism 49 * changes MK, May 2015: 50 * - "RNG rng(0x12345678)" and "rng.next()" replaced with a local PRBS-7 implementation so that this file does not depend on external random number generators. 54 51 */ 55 52 #include <cstdlib> … … 58 55 #include <limits> 59 56 #include <cfloat> 60 #include <assert.h> 57 //#include <assert.h> 58 #include <math.h> //hypot(), embarcadero 59 #include <stdint.h> //uint8_t 61 60 #include "lapack.h" 62 #include <stdlib.h> //rand(), embarcadero 63 #include <math.h> //hypot(), embarcadero 64 65 typedef unsigned char uchar; 61 66 62 67 63 #if defined _M_IX86 && defined _MSC_VER && _MSC_VER < 1700 … … 376 372 return; 377 373 378 //srand(time(NULL)); 379 374 uint8_t rndstate = 0x02; //PRBS-7 from http://en.wikipedia.org/wiki/Pseudorandom_binary_sequence 375 for (i = 0; i < n1; i++) 380 376 { 381 377 sd = i < n ? W[i] : 0; … … 389 385 for (k = 0; k < m; k++) 390 386 { 391 _Tp val = (rand() & 256) != 0 ? val0 : -val0; 387 int rndbit = (((rndstate >> 6) ^ (rndstate >> 5)) & 1); 388 rndstate = ((rndstate << 1) | rndbit) & 0x7f; 389 _Tp val = rndbit == 0 ? val0 : -val0; 392 390 At[i * astep + k] = val; 393 391 }
Note: See TracChangeset
for help on using the changeset viewer.