I'am afraid the algorithmic portion has nothing to do with the informations I gave to you. I can confirm in this sense. And more on my mac I have two virtual machines for simple use , vmware and virtualbox. The same code I mentionned earlier runs 12 seconds on vimware and 13 seconds on virtualbaox knowing that these two virtual machine use a lot less ressources than the host MacOs. I precise the regression appears with clang 15.0 not clang 13.x. . So 5 times slower for g++ clang 15.0
if you want a part of computational code here :
template < typename T >
int OAnacorr<T>::compute_afc_for_burt()
{
size_t n = 0, i = 0 ;
T AKSI, ALAMBDA, PHI2, perc = 0 ;
T CUMUL ;
long TEST0, TEST1 ;
T TOTA = M.sum() ;
KT VL, VC ;
VC.resize( M.getnc() );
VL.resize( M.getnl() );
Mtype M2( M.getnl(), M.getnc() ) ;
KT PII ;
M.peek_sum_rows( PII ) ;
M.to_percent();
KT PJ ;
M.peek_sum_cols( PJ );
Mtype K2( M ) ;
KT KI( M.getnc() ) ;
CUMUL = 0.0 ;
PHI2 = K2.khi_deux_pond() ;
if( Mtype::isnan(PHI2) || PHI2 <= 0 )
return 1;
K2.peek_sum_cols( KI ) ;
KT VVI( KI ) ;
KT SVI( KI ) ;
Mtype TH = M.get_theoric() ;
/*****************************************/
KT VCSUP ;
KT KSUP ;
KT SKI ;
KT A, D ;
if( g_xsup > 0 )
{
VCSUP.resize( TSC.getnl());
KSUP.resize( TSC.getnl() );
A.resize ( VCSUP.size() );
D.resize ( VCSUP.size() ) ;
TSC.peek_sum_rows( KSUP );
Mtype STHEO ( TSC.getnl(), TSC.getnc() ) ;
for( size_t i = 0 ; i < TSC.getnl(); i++ )
for( size_t j = 0; j < TSC.getnc(); j++ )
STHEO(i,j) = (PII[j] * KSUP[i]) / TOTA ;
Mtype ECA = TSC - STHEO;
Mtype SKI2 = ( ECA * ECA ) / STHEO ;
SKI2 /= TOTA ;
SKI2.peek_sum_rows( SKI );
for( size_t i = 0; i < VCSUP.size(); i++ )
D[i] = KSUP[i] / TOTA ;
TSC.to_percent();
vect_to_percent( KSUP );
inth( TSC, KSUP, PJ, 1.0 );
}
os << "\nAnalyse des correspondances (AFC)" << std::endl << std::endl ;
os << "Phi Deux = " << std::setw(8) << std::setprecision(6) << std::fixed << PHI2 << std::endl;
for ( n = 0 ; n < g_nbf ; n++ )
{
if( ( 100.00 - CUMUL ) < 0.0000001 ) goto tend ;
vect_zero( M, VL ) ;
i=0 ;
do
{
TEST0 = (VL[0] * 10000000.0) ;
prod_by_cols( M, VC, VL ) ;
AKSI = reduce_by_pond( PJ, VC) ;
i++;
if( i > 20000 )
{
return 1 ;
}
prod_by_rows( M, VL, VC ) ;
AKSI = reduce_by_pond( PJ, VL ) ;
TEST1 = (VL[0] * 10000000.0) ;
}
while ( TEST1 != TEST0 );
if( g_xsup > 0 )
{
prod_by_rows( TSC, VCSUP, VC );
T RX = reduce_by_pond( KSUP, VCSUP );
mul_vect( VCSUP, RX );
for ( size_t i = 0 ; i < VCSUP.size(); i++ )
if( Mtype::isnan(VCSUP[i])) VCSUP[i] = 0 ;
WSUP.push_back( VCSUP );
}
mul_vect( VC, AKSI );
WWC.push_back( VC ) ;
ALAMBDA = ( n != 0 ) ? AKSI * AKSI : PHI2 ;
rebuild_pond( M2, VC, PJ, AKSI ) ;
M -= M2 ;
if( n == 0 )
{
WWC.push_back( PJ );
if( g_xsup > 0 )
{
WSUP.push_back(VCSUP);
}
}
if( n != 0 )
{
mul_and_div( M2, TH );
M2.peek_sum_cols( KI ) ;
SVI = KI ;
div_vect( SVI, VVI );
WWC.push_back( SVI );
perc = (ALAMBDA / PHI2) * 100 ;
CUMUL += perc ;
g_nbvectors += 1 ;
if( g_xsup > 0 )
{
for( size_t i = 0 ; i < VCSUP.size(); i++ )
{
A[i] = VCSUP[i] * VCSUP[i] * D[i] / SKI[i] ; // cos2
if ( Mtype::isnan(A[i])) A[i] = 0 ;
if( A[i] >= 1 ) A[i] = 0.999;
}
WSUP.push_back(A);
}
std::ostringstream ox ;
ox << "F" << n ;
os << std::setw(5) << std::setfill(' ') << std::left << ox.str()
<< " Val Propre = "
<< std::setw(8) << std::setprecision(6) << std::fixed << ALAMBDA
<< " Pourcent= " << std::setw(5) << std::setprecision(2) << std::right << std::fixed << perc
<< " Cumulé= " << std::setw(6) << std::setprecision(2) << std::right << CUMUL
<< " Nb iter= "
<< std::setw(5) << std::right << ((n>0) ? i : i) << std::endl ;
}
div_vect( KI, ALAMBDA );
WWC.push_back( KI);
if( g_xsup > 0 )
{
for( size_t i = 0 ; i < VCSUP.size(); i++ )
{
A[i] = VCSUP[i] * VCSUP[i] * D[i] / ALAMBDA ; // cpf
if ( Mtype::isnan(A[i])) A[i] = 0 ;
if( A[i] >= 1 ) A[i] = 0.999;
}
WSUP.push_back(A);
}
}
tend:
g_nbf = n ;
os << std::endl;
return 0;
}
djm44