MCPcopy Create free account
hub / github.com/avaneev/biteopt / calcCola

Function calcCola

tests/testfn.h:3711–3755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3709 0.0, 0.0, 0.0, &calcTridiagonalMatrix, &calcTridiagonalMatrix_p };
3710
3711static double calcCola( const double* const x, const int N )
3712{
3713 const double dis[ 46 ] = {
3714 1.27,
3715 1.69, 1.43,
3716 2.04, 2.35, 2.43,
3717 3.09, 3.18, 3.26, 2.85,
3718 3.20, 3.22, 3.27, 2.88, 1.55,
3719 2.86, 2.56, 2.58, 2.59, 3.12, 3.06,
3720 3.17, 3.18, 3.18, 3.12, 1.31, 1.64, 3.00,
3721 3.21, 3.18, 3.18, 3.17, 1.70, 1.36, 2.95, 1.32,
3722 2.38, 2.31, 2.42, 1.94, 2.85, 2.81, 2.56, 2.91, 2.97
3723 };
3724
3725 double s = 0.0;
3726 int k = 1;
3727 double mt[ 20 ] = { 0, 0, 0, 0 };
3728 int i;
3729
3730 for( i = 3; i < 20; i++)
3731 {
3732 mt[ i ] = x[ i - 3 ];
3733 }
3734
3735 for( i = 1; i < 10; i++ )
3736 {
3737 int j;
3738
3739 for( j = 0; j < i; j++ )
3740 {
3741 double temp = 0.0;
3742 int t;
3743
3744 for( t = 0; t < 2; t++ )
3745 {
3746 temp += sqr(mt[i*2+t]-mt[j*2+t]);
3747 }
3748
3749 s += sqr(dis[k-1]-sqrt(temp));
3750 k++;
3751 }
3752 }
3753
3754 return( s );
3755}
3756
3757static void calcCola_p( double* const minv, double* const maxv, const int N,
3758 double* const optv )

Callers

nothing calls this directly

Calls 1

sqrFunction · 0.85

Tested by

no test coverage detected