What does Anova::monteCarlo do? It's possible you have a dead-lock in that method but without seeing it it's hard to say.
vector<boost::thread *> *workerThreads = new vector<boost::thread *>;
workerThreads->clear( );
for( int i=0; i < numberOfCores; i++ )
{
workerThread = new boost::thread( &Anova::monteCarlo, anovas->at( i ) );
workerThreads->push_back( workerThread );
}
for( int i=0; i < numberOfCores; i++ )
workerThreads->at( i )->join( );
void LinAlg::pseudoInverse( double* A, double* Apinv, integer rowsA, integer columnsA )
{
// A is m * n
// Apinv is n * m
integer m = rowsA;
integer n = columnsA;
// Singular value decomposition of Matrix A
double *s = new double[min( m, n )];
double *U = new double[m*m];
double *Vt = new double[n*n];
double *Temp = new double[n*m];
svd( A, s, U, Vt, m, n, true );
// Computing the pseudo-inverse of S (which is a diagonal matrix containing the singular values of s): Spinv (is n x m)
double *Spinv = new double[n*m];
int svIndex = 0; // index of vector s
for( int i=0; i < (n*m); i++ )
{
if( i % (n+1) == 0 ) // main diagonal
{
if( fabs( s[svIndex] ) > ZERO_TOLERANCE ) // non-zero values of s are inverted
Spinv[i] = 1.0f / s[svIndex];
else // zero-values of s
Spinv[i] = 0.0f;
svIndex++;
}
else // off main diagonal
Spinv[i] = 0.0f;
}
// Compute Apinv = V * Spinv * U'
multiply( Vt, Spinv, Temp, n, n, n, m, true, false ); // transpose Vt
multiply( Temp, U, Apinv, n, m, m, m, false, true ); // transpose U; Temp is n x m
SAFE_DELETE_ARRAY( s );
SAFE_DELETE_ARRAY( U );
SAFE_DELETE_ARRAY( Vt );
SAFE_DELETE_ARRAY( Spinv );
SAFE_DELETE_ARRAY( Temp );
}
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Need help on C# Linq query on object | 6 | 53 | |
Excel import error " External table is not in expected format" | 12 | 49 | |
Need a complete list of ASP.NET page load events | 3 | 28 | |
Show/Hide ASP.NET controls with JQuery best practices | 3 | 20 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
21 Experts available now in Live!