Exemplo n.º 1
0
Kernel::Kernel(Kernel * kernel)
{
  if(kernel->diagonalized == false)
  {
    this->kernel = new Matrix(kernel->kernel);
    if(kernel->N != NULL)
    {
      this->N = new Matrix(kernel->N);
    }
    else
    {
      this->N = NULL;
    }
    this->eigenValues = NULL;
    this->eigenVectors = NULL;
  }
  else
  {
    this->kernel = NULL;
    this->N = NULL;
    this->eigenValues = new Matrix(kernel->eigenValues);
    this->eigenVectors = new Matrix(kernel->eigenVectors);
  }
  
  copyParameters(kernel);
  
  this->genotypes = NULL;
  this->covariates = NULL;
}
void particleFilter::parameterUpdate(double *parMin, double *parMax){

		if (sampCount == sampFreq){

				stochUniResampling(cumWeight,copies);

				copyParameters();

				perturbParameters(parMin, parMax);

				resetCumWeight();
			}
			
}
Exemplo n.º 3
0
Kernel::Kernel(Kernel * kernel, KernelType createType, Genotype* genotype)
{
  if( kernel->type == kernelGRM && createType == kernelEpistaticGRM && kernel->diagonalized == false )
  {
    kernel->normalize();
    this->kernel = new Matrix(kernel->kernel);
    this->N = NULL;
    this->eigenValues = NULL;
    this->eigenVectors = NULL;
    
    copyParameters(kernel);
  
    this->genotypes = NULL;
    this->covariates = NULL;
    
    this->kernel->elementWiseMultiplication(kernel->kernel);
    this->type = kernelEpistaticGRM;
    
    /*genotype->normalizeGenotypes();
    Matrix * temp = new Matrix(genotype->genotypes);
    temp->elementWiseMultiplication(genotype->genotypes);
    Matrix * temp2 = new Matrix();
    temp2->multiply(temp, 'T', temp, 'N');
    temp2->symmetrizeTriangularMatrix();
    delete temp;
    temp = new Matrix(kernel->N);
    temp->elementWiseMultiplication(kernel->N);
    temp->symmetrizeTriangularMatrix();
    temp2->elementWiseDivision(temp);
    this->kernel->add(temp2, 0.5, -0.5); //After this substraction, the kernel have to be divided by 2. This can be arranged with the factors.
    delete temp;
    delete temp2;*/
  }
  else
  {
    misc.error("Error: An internal error was happened. A new kernel cannot be created using this types in src or dest kernels..", 0);
  }
}
/*
 *  Assignment operator: copy neurons parameters.
 *
 *  @param  r_neurons  Neurons class object to copy from.
 */
IAllNeurons &AllSpikingNeurons::operator=(const IAllNeurons &r_neurons)
{
    copyParameters(dynamic_cast<const AllSpikingNeurons &>(r_neurons));

    return (*this);
}