Beispiel #1
0
void SIM::mutation(GAIndividual<CodeVInt> &indivl)
{
	int starts, ends;
	starts = Global::msp_global->getRandInt(0, m_numDim - 1);
	starts = indivl.data().m_x[(starts - 1 + m_numDim) % m_numDim];
	do
	{
		ends = Global::msp_global->getRandInt(0, m_numDim - 1);
		ends = indivl.data().m_x[ends];
	} while (ends == starts);
	inverse_(starts, ends, indivl);
}
Beispiel #2
0
void inverse(double *mat, int n)  
{
         int i,j;

	 /* convert to column-major order */
	 for(i=0;i<n;i++)  {
	   for(j=0;j<i;j++)  {
	     double t = mat[n*i+j];
	     mat[n*i+j] = mat[n*j+i];
	     mat[n*j+i] = t;
           }
         }

         inverse_(mat, &n);

	 for(i=0;i<n;i++)  {
	   for(j=0;j<i;j++)  {
	     double t = mat[n*i+j];
	     mat[n*i+j] = mat[n*j+i];
	     mat[n*j+i] = t;
           }
         }
}