1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
//
// superalignmentpairwiseplen.cpp
// iqtree
//
// Created by Olga on 04/05/17.
//
//
#include <stdio.h>
#include "superalignmentpairwiseplen.h"
/**********************************************************
* class SuperAlignmentPairwisePlen
**********************************************************/
SuperAlignmentPairwisePlen::SuperAlignmentPairwisePlen(PhyloSuperTreePlen *atree, int seq1, int seq2)
: SuperAlignmentPairwise((PhyloSuperTree*) atree, seq1, seq2)
{
part_info = &(atree->part_info);
}
double SuperAlignmentPairwisePlen::computeFunction(double value) {
int part = 0;
double lh = 0.0;
for (vector<AlignmentPairwise*>::iterator it = partitions.begin(); it != partitions.end(); it++, part++) {
lh += (*it)->computeFunction(part_info->at(part).part_rate*value);
}
return lh;
}
void SuperAlignmentPairwisePlen::computeFuncDerv(double value, double &df, double &ddf) {
int part = 0;
// double lh = 0.0;
df = 0.0;
ddf = 0.0;
for (vector<AlignmentPairwise*>::iterator it = partitions.begin(); it != partitions.end(); it++, part++) {
double d1, d2;
(*it)->computeFuncDerv(part_info->at(part).part_rate*value, d1, d2);
df += part_info->at(part).part_rate*d1;
ddf += part_info->at(part).part_rate*part_info->at(part).part_rate*d2;
}
// return lh;
}
SuperAlignmentPairwisePlen::~SuperAlignmentPairwisePlen()
{}
|